Skip to content

fix(agent-runtime): resume active turns from the compaction checkpoint - #2513

Merged
vastsa merged 4 commits into
vastsa:mainfrom
kurtmj93:fix/2512-active-turn-compaction
Nov 23, 2026
Merged

vastsa merged 4 commits into
vastsa:mainfrom
kurtmj93:fix/2512-active-turn-compaction

Conversation

@kurtmj93

@kurtmj93 kurtmj93 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary / 概要

ADR 0136 keeps the active user request across compaction so the model can continue the same task. In #2512, the fresh checkpoint said setup was complete and homepage verification was next. Pi Desktop then presented the original setup request after the checkpoint, and the agent started rediscovering the environment.

For a successful active-turn checkpoint with a nonempty summary, one retained user request, and no reasoning to replay, the Desktop runtime now sends original request → checkpoint → any later user input. The checkpoint identifies the original request as the goal and describes the state to continue from. This matches the relative order in Codex's plaintext compaction path.

The history cutoff, retained messages, and checkpoint format stay the same. Failed-summary recovery keeps its notice ahead of the retained window. DeepSeek reasoning replay keeps the order summary → retained reasoning → user tail. Completed turns, native Pi sessions, and the visible transcript keep their existing behavior.

Requirement link / 需求关联

Closes #2512.

  • The linked issue gives the reproduction and expected behavior.
  • UI screenshots are inapplicable to this runtime change.

Verification

  • Original fix (ec590a1). Shared package, runtime, sidecar bundle, and Rust host built. Agent-runtime suite passed with 2,116 tests and 1 skipped.
  • Fallback follow-up (dabbf76). 164 targeted tests passed. The sidecar tool-pair restore and context-usage checks passed all nine scenarios in Windows PowerShell. The host checkpoint restore check also passed across restart.
  • Local runtime regression check. A tool result triggers a successful summary during the turn. Steering arrives while the summary is generated. The next provider request contains the original goal, the checkpoint, and the steering message once, in that order. This assertion fails with upstream's projection and passes with the fix.
  • Offline payload checks confirmed the order in OpenAI Completions, OpenAI Responses, Anthropic, and Gemini. An earlier Qwen/LM Studio smoke test on a patched development build resumed from the checkpoint on a different task. A controlled model A/B replay remains untested.

Keep recovery notices ahead of the retained request when summary generation fails. Apply active-turn resume framing only to successful checkpoints.
Exercise the runtime continuation path so a later steering message stays ahead of any further model work after compaction.
@kurtmj93
kurtmj93 marked this pull request as ready for review November 21, 2026 23:22
@vastsa
vastsa merged commit 6b8ff1e into vastsa:main Nov 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Automatic Compaction - Agent Treats Retained Original Request as a Fresh Task and Repeats Completed Work

2 participants