Skip to content

A 12,000-turn Session fails to open: task-load error surface with no turns rendered within 300s #5844

Open

Description

@ggbdpq

Summary

A single Session with 12,000 transcript turns (~210MiB of stored transcript) fails to open on current main: the Runtime Host stays alive and serves other operations (zero candidate exits, zero handler errors at this scale), but opening the session lands on the task-load failure surface ("任务加载失败 / 重试载入") with no turn rendered within 300 seconds. Screenshot archived.

The distinction from the sibling report (#5843, candidate election storms at larger total volume) matters: at this scale the Host is healthy - the failure is in the session-open path itself, one dimension finer.

Scale context

dimension value outcome
4,000 turns (~70MiB), single session opens normal, tail visible
12,000 turns (~210MiB), single session fails to open error surface, 0 turns in 300s
total store 360MiB (multi-session) Host never ready #5843

Fixture: 18KiB replies per turn through the standard seeding helpers, real Electron + Host + storage. Within the first hour of heavy use a heavy session can plausibly reach this depth.

What is observed

  • The Host process is alive: other operations complete; no candidate storms.
  • Opening the 12k-turn session renders the failure surface instead of the transcript.
  • Whether the surfaced "重试载入" retry actually recovers has not been verified - the initial attempt failed deterministically within a 300s observation window on repeated runs.

Open questions (for whoever picks this up)

  • Where does the open path spend/abort those 300 seconds (transcript ledger scan? projection fold? initial tail budget across 12k turns)?
  • Is the retry path recoverable, or does it re-fail deterministically?
  • Should the open path stream the tail first and fold the rest in background (as the bounded-tail design elsewhere suggests), and what breaks at this depth today?

Raw logs, the failure screenshot, and the archived spec are available; the fixture recipe is the same seeding helper family as #5843.

Activity

  1. ggbdpq commented on Sep 29, 2026

    @ggbdpq
    ContributorAuthor

    Root cause pinned (instrumented reproduction on the archived recipe) - with one scope correction to this issue's framing.

    The failure is not in the bounded tail / pager path. subscription.open blocks synchronously in readDurableHighWater -> ensureTranscriptLedger -> materializeTranscriptLedger (packages/runtime/src/runtime-ledger-repair.ts), because the seeded session headers omit transcriptLedgerVersion - stored as 0 = legacy/imported transcript, which by design "cannot serve its first transcript page until" the full legacy-to-ledger conversion finishes (linear in transcript bytes; 256-row/4MiB pagination + per-message event append + full ordinal resequence).

    The conversion for ~210MiB exceeds the client's 30-second request timeout (connection.ts), so the open is interrupted, Main retries every ~30s and re-blocks on the same wall -> error surface at the first timeout, zero turns at 300s. 4,000 turns (~70MiB) fits under the timeout, which is why it opens - the threshold is the request timeout, not a byte limit.

    Scope correction: sessions born on the ledger (transcriptLedgerVersion: 1, everything the current app writes) skip this path entirely - their opens use the bounded tail bootstrap. So this issue, as measured, is a version-0 (imported / pre-ledger-cutover) transcript materialization-scaling defect: real users with imported or pre-cutover sessions hit the same wall; current-app sessions of the same depth do not (a true version-1 12k-turn open has not been measured here - seeding one requires writing ledger events directly).

    Timeline (instrumented): +30.0s subscription.open was interrupted (five handlers) -> error surface at +29.96s; then the same wall every ~30s to +300s. Secondary: ~95 candidate exits (exit 2, election losers) around +280s with a reconnection-window error, recovered +291s - the Host degrades under the retry bombardment.

    Retry answer: the surfaced retry re-fails deterministically inside the window; the conversion itself is resumable (deterministic ids + SQLite dedup + repair queue) and would succeed once it completes - it just never completes in-window at this scale.

    Fix directions for discussion: (a) serve a bounded tail for version-0 transcripts without full conversion (read legacy rows directly for the tail), running the conversion on a background lane; or (b) take the materialization off the subscription.open critical path (separate request). Both keep the bounded-tail contract; today the reader is gated before it can use it.

  2. garvit-arora commented on Sep 29, 2026

    @garvit-arora
    Contributor

    take

  3. garvit-arora commented on Sep 29, 2026

    @garvit-arora
    Contributor

    Plan (following the root-cause note above)

    1. Reproduce at runtime-host level with a version-0 / legacy transcript fixture sized past the 30s subscription.open timeout (seed-helpers family).
    2. Stop gating subscription.open tail bootstrap on full materializeTranscriptLedger completion — serve a bounded tail from legacy session_messages while conversion runs on a background lane.
    3. Keep ledger conversion resumable/deduped; do not change version-1 open behavior.
    4. Add focused tests in session-transcript-reader / session-manager coverage; verify retry no longer deterministically fails inside the window.

    Branch: fix/5844-legacy-transcript-open-tail

    Happy to align on (a) legacy-tail-first vs (b) separate materialization request before pushing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions