Repository navigation
fix(session-ingest): clear a busy session left by a dead CLI - #6568
Conversation
Fix: a session row stays status busy for ever when its CLI dies, so the app keeps showing a running spinner. Production evidence, Pylon issue 28572, kilo user 9febf58a-950d-436b-8860-4f78d8c0d793: - Read-only query on cli_sessions_v2 for the last 7 days returns 11 rows with status busy whose status_updated_at is minutes after created_at and never moves again. Examples: ses_f38b56fe2ffed60eojYSsmo3fe created 2026-09-22T04:06:21Z with status_updated_at 2026-09-22T04:06:32Z; ses_f3e11b421ffeDKgzu4IEO21erN created 2026-09-21T03:06:56Z with status_updated_at 2026-09-21T03:07:15Z. - The parent session ses_f39900bddfffUK9xomduMB1zP7 went idle at 2026-09-22T07:24:06Z. The children stayed busy. - services/session-ingest/src/ingest/metadata.ts:491 defines resetAttentionStatusOnCliDisconnect, the only reconnect-time reset. - services/session-ingest/src/ingest/metadata.ts:513 returns early unless the status is question or permission. - No other code in services/session-ingest writes idle. The status comes from the CLI's own metadata change, so a CLI that dies while busy leaves the row unchanged. - The user reported it as: "many of the tool or agent calls still with a spinner as if they are in progress, even though those turns have already ended". Requirements: 1. A busy session row must not outlive its owner. Decide the owner signal and name it: the CLI socket disconnect event the same file already handles, or the run ledger terminal_at in cloud_agent_session_runs. 2. Reuse resetAtte
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Reviewed the Files Reviewed (2 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
Changelog for users
retry, so the app shows it as waiting for you to retry.busyand keeps its spinner.Changelog for maintainers
resetAttentionStatusOnCliDisconnectalso clears abusyrow when its status write is at least 60 s old, still writingretry.busyrow with nostatus_updated_atis left alone; no production writer setsstatuswithout stamping it.metadata.tsidentical; drift there clears a live row./user/clisocket gets no absence hold, so this rule cannot reach it.busyclear, a recentbusyhold, and a null-timestamp hold.E2E proof — log excerpts
/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e1-row-after.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e1-cli-run.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e1-row-before.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e1-web-event.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e2-row-after.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e2-row-before.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e2-no-status-event.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e3-restamp.log/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e3-row-after.txt/home/igor_kilocode_ai/.local/share/kwf/sections/28572-c-stale-busy-status-de52/e2e-backend/e3-web-frames.txtOwner request
Follow-ups (not changed here)