Skip to content

fix(dashboard): read the served bundle id off the event loop - #13952

Merged
chenmingwei23 merged 1 commit into
mainfrom
fix/mesh-3886-bundle-id-off-loop
Sep 25, 2026
Merged

chenmingwei23 merged 1 commit into
mainfrom
fix/mesh-3886-bundle-id-off-loop

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

The dashboard read a file on the event loop every time it sent status.

Each status push (WebSocket frame, /api/status poll, SSE event) builds one snapshot. That snapshot hashed the served frontend file, index.html. The path lookup and the file check ran on the event loop, the one thread every tab and socket shares.

Why it matters

A slow disk stalls that one thread. Then every open tab and socket waits too. The lesson and cron counts were already moved off the loop for this reason (#10907). The bundle id was missed.

What changed (motivation → approach → change)

Before After
file check on the loop file check in a worker thread
path worked out each call path worked out once

The shared status funnel in src/kiro_crew/dashboard now reads the bundle id in one worker-thread hop, then hands it to the snapshot. The check and the read of the file stay in that same hop, so nothing can change between them. The snapshot just prints the value it is given.

Backwards compatibility

Compatible: the status payload keeps the same bundle_id field and value. A caller that passes nothing gets "", which the frontend already treats as "unknown, never reload".

Tests

One new test in test/test_ws_offload.py checks the bundle id is read off the loop thread and reaches the snapshot. It fails when the read is put back on the loop.

Manual verification

N/A — unit coverage sufficient: the change only moves where one read runs.

Related Issues

Mesh-3886

Pattern harvest

Not generalizable: the rule for this class already exists (no-blocking-call-on-event-loop); this was one read it did not catch because it sat behind a sync helper.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

status_snapshot ran served_bundle_id (resolve + stat + read of
static/dist/index.html) inline on the event loop for every WS push,
/api/status poll and SSE event. cached_status_snapshot now reads it in
one asyncio.to_thread hop and passes it in as a bundle_id kwarg; the
default index path is a module constant.

Mesh-3886
@iamwhatever
iamwhatever requested review from a team and Zedmor September 25, 2026 19:19
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 915748f3d343b1944d648b67e98e985d1826bd4c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 915748f

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 915748f3d343b1944d648b67e98e985d1826bd4c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 915748f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 915748f3d343b1944d648b67e98e985d1826bd4c: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 915748f3d343b1944d648b67e98e985d1826bd4c — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (4 items) — 3 justified, 1 harm-free rider

Intent: stop the dashboard status path from doing file I/O on the shared event loop — a FIX, grounded in the documented no-blocking-call-on-event-loop invariant already cited in status_snapshot's own base docstring and the #10907 precedent for the counts.

  1. The served-bundle hash is now computed in a worker thread in the shared status funnel, not on the loop — justified
  2. The snapshot prints a bundle_id it is handed instead of computing it, same field and value on the wire — justified
  3. The served index.html path is worked out once at import instead of per call — rides along: declared ("path worked out once"), but redundant once the call runs off-loop; harm-free, no surface
  4. A new test pins the read off the loop thread and would fail on base — justified

Counts run: state.status_snapshot( has exactly 1 production caller (status_counts.py:239, the funnel behind all three emitters at ws.py:52, handlers_system.py:199, handlers/updates.py:2255); served_bundle_id has exactly 1 production caller (status_counts.py:233); the only other reader in the snapshot body, cached_disabled_approval_modes, does no filesystem access (safety_override.py:2042), so no unfixed sibling remains on this path.

[FIRST-PRINCIPLES-REVIEWED] 915748f

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 915748f3d343b1944d648b67e98e985d1826bd4c — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 915748f

Verdict parsed from the review's SHA-scoped output markers for commit 915748f3d343b1944d648b67e98e985d1826bd4c.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 915748f3d343b1944d648b67e98e985d1826bd4c: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 25, 2026
@chenmingwei23
chenmingwei23 merged commit 4e356ad into main Sep 25, 2026
96 of 103 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/mesh-3886-bundle-id-off-loop branch September 25, 2026 23:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants