Repository navigation
debug(#283): instrument transcriptStatus transitions + suspected drop points - #296
Closed
Juliusolsson05 wants to merge 1 commit into
Closed
Juliusolsson05 wants to merge 1 commit into
Juliusolsson05 wants to merge 1 commit into
Conversation
…ted drop points
Stuck-at-'loading' on startup/resume could not be root-caused on paper —
every ordering traced preserved the session id — so this adds the timeline
the issue's "Status" section asked for before fixing at source.
Two write paths can each silently drop an in-flight initial-history load's
terminal status write:
1. loadInitialHistoryForSession writes 'loading' unconditionally but writes
'ready'/'error' only inside `if (!current) return prev`. A drop/re-key of
the runtime entry mid-await discards the terminal write.
2. commitRehydratedState rebuilds runtimes from a fresh `out = {}` and forces
non-ready/error back to 'loading'; if no loader then drives it, the pane
is parked at 'loading'.
Instrumentation:
- transcriptStatusTrace.ts: traceTranscriptStatus appends a STATE
`transcript_status` feed-debug entry (from -> to @ site) per transition,
reusing the existing per-session feed-debug.jsonl channel (no parallel
log system, per #102). Two console warns flag the discard (`!current`
bail) and the rehydrate force-to-loading paths with a greppable
`[transcript-stuck][283]` tag.
- initialHistory.ts: trace all four status writes; warn on both `!current`
bails before they swallow the terminal write.
- rehydrate.ts: warn when the rebuild drops a still-'loading' old key on
re-key, or forces a providerSessionId session back to 'loading'.
Diagnostic only — no behavior change. Reproduce once, read the timeline,
then fix at source and delete this instrumentation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
Closing as superseded. While this was in flight, #284 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
Diagnostic instrumentation for #283 — not the fix. This is the "separate PR" the issue's own Status section calls for: every on-paper ordering preserves the session id, so the stuck-at-
loadinginterleaving needs a runtime timeline before fixing at source.Background (#283)
On startup (rehydrate) and on resuming a killed session, a pane can stay stuck at
transcriptStatus: 'loading'forever; a manual reload unsticks it. Two write paths can each silently drop an in-flight initial-history load's terminal status write:loadInitialHistoryForSessionwrites'loading'unconditionally (prev[id] ?? emptyRuntime()) but writes the terminal'ready'/'error'only insideif (!current) return prev. If the runtime entry is dropped or re-keyed (idMap remap) while the load awaits IPC, the terminal write hits a missing key and is thrown away — the surviving runtime stays'loading'.commitRehydratedStaterebuilds the runtimes map from a freshout = {}and forces any non-ready/errorstatus back to'loading'for sessions with aproviderSessionId. If no loader then drives it to'ready', the pane is parked — exactly "stuck until manual reload" (reload re-invokes the loader under a stable id).What it adds
transcriptStatusTrace.ts(new):traceTranscriptStatusappends aSTATE/transcript_statusentry (from -> to @ site) per transition into the existing per-sessionfeed-debug.jsonl— the channel the issue reporter already reads. No parallel log system (consistent with Consolidate debug infrastructure into one home, remove ad-hoc console.* scatter, enforce a typed logger boundary #102's "one debug home"). Two console warns tag the discard and force-to-loading paths with greppable[transcript-stuck][283].initialHistory.ts: trace all four status writes; warn on both!currentbails before they swallow the terminal write.rehydrate.ts: warn when the rebuild drops a still-loadingold key on re-key, or forces aproviderSessionIdsession back toloading.Safety
Diagnostic only — no behavior change. Renderer-only; typechecks clean (
tsconfig.web.json, 0 errors in touched files). Reproduce once, read the timeline (feed-debug.jsonltranscript_statusseries +[transcript-stuck][283]console lines), then fix at source and delete this instrumentation.🤖 Generated with Claude Code