Skip to content

Regression: session startup/resume stuck at 'loading transcript' until a manual reload #283

Closed

Description

@Juliusolsson05

Symptom

On app startup (rehydrate) and on continuing a killed session (resume), the pane is stuck at "loading transcript" indefinitely. Running a manual reload command clears it. Regression — worked before.

Root-cause investigation (so far)

The transcript-load lifecycle has an asymmetric state-write bug:

  • `loadInitialHistoryForSession` (`src/renderer/src/workspace/hook/actions/initialHistory.ts`) sets `transcriptStatus: 'loading'` unconditionally (creating the runtime entry, ~line 118).
  • But it only writes the terminal `'ready'` (~line 256) / `'error'` (~line 295) inside an `if (!current) return prev` guard (lines 144 and 290).

So if the session's runtime entry is rebuilt / dropped / renamed while the async load is in flight, the `'ready'` write is silently discarded and the pane stays at `'loading'` forever. A manual reload re-runs the load against a now-stable id, which is why it unsticks.

Why the manual reload path works but auto doesn't

`reloadAgentSessions` (the manual path) does its id-remap `setRuntimes` first, then calls the loader last under the stable new id. The auto paths interleave the loader with state rebuilds.

Prime suspect for the drop

`commitRehydratedState` (`src/renderer/src/workspace/hook/persistence/rehydrate.ts:374-`) is the only wholesale runtimes rebuild in the codebase — it returns a fresh `out = {}` map. Every other `setRuntimes` is additive `{...prev}`. A load-vs-rebuild ordering race here (or in the resume/`replaceSession` path) would orphan the in-flight loader's `'ready'` write.

Likely regression window: "Stream initial history loading" (`4765e51`, introduced the async slot/streaming load) and/or the #248 id-remap commits (`f85cfa5`/`ae42bd7`/`49472fb`).

Status

Every ordering traced on paper still preserves the id, so this is a genuine async race (or an unread path). Next step is diagnostic instrumentation (separate PR) that logs every `transcriptStatus` transition + flags when the loader resolve finds its runtime gone and when `commitRehydratedState` drops an in-flight `'loading'` key — reproduce once, read the timeline, then fix at the source.

Acceptance

  • Startup and resume reach `transcriptStatus: 'ready'` automatically (no manual reload).
  • No regression to live streaming / ghost reconciliation.

Activity

  1. added a commit that references this issue on Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions