Skip to content

bug(runtime): safe-boundary continuation silently drops prior-turn history from the provider request #5907

Description

@me2seeks

What happened

A long session whose provider-reported context usage had exceeded the model's reported window was interrupted mid-turn (stop button) and later resumed through the safe-boundary continuation path. The continuation replayed the interrupted turn's full event prefix correctly, but the rebuilt provider request silently excluded all prior completed-turn history — no compaction checkpoint, no summarization call, no projection transitions, and no user-facing indication. The model continues the turn with amnesia of everything that happened before the interrupted turn.

Expected: the continued turn's provider request contains the full session history (as the pre-abort requests did) — or, if reduction at this seam is intended, it goes through a visible, durable compaction (summary + checkpoint), never a silent drop.

Evidence from ~/.config/Maka/workspaces/default/runtime.sqlite:

Provider request sizes (usage_model_call_attempts)

time (local) turn call_kind input_tokens
20:14:26 582a5323 (pre-abort) main 302,839
20:15:03 582a5323 (last pre-abort) main 304,452
22:17:52 093a6dd1 (first after resume) main 81,600
22:21:06 093a6dd1 (~10 steps later) main 89,699

304,452 − 81,600 = 222,852 ≈ the runtime's own estimate of the prior-turn history alone: contextBudget.estimatedTokens = 230,549 over keptEvents = 1007, keptTurns = 2 (runtime_fact recorded at abort time). The continued turn's requests never re-include the prior history across 10+ subsequent steps.

Turn extents (runtime_session_turn_extents)

turn ordinals events in post-resume provider context?
5bd23f43 (first ~1.2 h of work) 1–997 997 no
26223850 998–1007 10 no
582a5323 (interrupted) 1008–1335 328 yes — fully replayed (sourceRuntimeEventHighWater: 328 = the source invocation's full extent)
093a6dd1 (continuation) 1336– ongoing yes

Every legitimate reduction channel is ruled out: no summarization call (every post-resume attempt is call_kind = main), no history-compact checkpoint events in runtime_events, and no new model_projection_transition records (only 2 exist, both from the first turn, matching its prunedToolResults: 2). The durable ledger is intact — the 1,007 events exist in runtime_events; they simply never enter the continued turn's provider requests.

How to reproduce

  1. Build a session with substantial completed-turn history (observed: ~230k estimated tokens across 2 turns).
  2. Start a new turn and let it run until provider-reported input approaches or exceeds the model's context window (observed: 304k on a 262k-window model).
  3. Abort the turn mid-flight (stop button).
  4. Resume the session so the runtime continues the interrupted turn via safe-boundary continuation (invocation_opened with source.kind = continuation).
  5. Compare input_tokens of the last pre-abort attempt with the first post-resume attempt in usage_model_call_attempts; the drop equals the size of the prior-turn history.

Observed once in the wild on a real session; not yet reduced to a scripted minimal reproduction.

Environment

  • Maka version or commit: 1e80e3b885 (runtime-host running from source checkout)
  • OS and version: Linux x64
  • Surface: TUI + Runtime Host
  • Node.js version: 26.3.0
  • Connection/model: kimi-coding-plan / k3-256k (fetched contextWindow 262,144); modelOverrides empty, so no compactionThreshold is declared and proactive history compaction is not armed — which rules out compaction as the cause of the drop.

Logs, screenshots, or additional context

  • Same resume area as bug(runtime): safe-boundary resume rejects Code Mode exec calls #5876 (safe-boundary resume rejects Code Mode exec calls).
  • Hit while dogfooding feat(desktop): offer authoritative turn resume from the composer send slot #5903 (authoritative turn resume from the composer send slot): the session was developing that feature, and the interrupted turn was later resumed in the TUI through the safe-boundary continuation path.
  • User-visible symptom: the TUI ctx segment follows the latest settled request's inputTokens, so it falls from 262k/262k 100% to ~82k/262k 31% right after resume — looking exactly like a successful "compression" that never happened.
  • Reporter-local forensics ids: session cb1d809b-4cf5-473e-811f-4802c2c19d46, source turn 582a5323-0e80-4876-a3be-45276ead74d4, continuation turn 093a6dd1-0720-441e-8774-bb014590baef, continuation invocation edf3ca60-610c-4bb1-bbd2-a50dab41fe87.

Drafted with AI-agent assistance (Maka) from local runtime forensics; reviewed and submitted by @me2seeks.

Activity

  1. me2seeks commented on Oct 1, 2026

    @me2seeks
    ContributorAuthor

    take

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions