Skip to content

fix(resume): accept deferred prompts and declare option semantics - #606

Merged
stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/resume-option-semantics
Nov 2, 2026
Merged

stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/resume-option-semantics

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Otter from open-agent-runtime opened this pull request through Stamp
View in Stamp →


Claude and Codex resumed prompts were refused after observing only the first resumed request. Native compaction changes that result: Claude's replacement and append, and Codex's append, use the newly supplied value after compaction. Omitting them instead drops the saved override at that point. This change forwards those native options and removes the incorrect refusals.

Runtime.resumedSessionOptions declares two independent facts per option: when a different supplied value takes effect, and what omission does. The optional map uses SessionOptions keys; absent entries mean untested. Claude, Codex, Qwen, Pi SDK/RPC and Pi Durable have measured declarations. Refusal declarations remain authoritative. OAR does not compare prompt strings, inject instructions or add a compaction control.

All declared prompt options have native regressions for supplied and omitted values before and after compaction. Claude uses /compact, Qwen uses /compress, and Codex/Pi use native automatic compaction. Qwen must report native completion with a smaller token count; Qwen/Pi must also place a unique native summary in the next main request's history. Sequential resumes track the current saved value. A registry-wide test fixes the declaration inventory and prohibits overlap with refused options.

Host migration: pass the current Claude/Codex prompts on every resume to retain them after compaction. Codex replacement instructions survive omission. Grok append-only sessions are the exception: omit append on resume to retain the saved value; to change it, also supply replacement instructions. A retained native Grok compaction probe supports that exception. The spec, runtime pages, public JSDoc, root example and decision reversing #469 are updated; the old dated report keeps its original text with a correction. Evidence and release-note draft.

Validation:

  • Complete local check: 2,991 tests and 18 mock behaviors; build passed. Packed public type consumption was verified for the unchanged exported types.
  • All 19 declaration-driven native controls passed; the full Durable vendor file also passed.
  • Eight original Claude/Codex mutation controls and eight added Qwen/Pi runtime/dimension mutation runs failed their expected assertions. Durable's incorrect saved_until_compaction declaration now fails after compaction; Qwen/Pi's incorrect saved declaration expects the preceding resume's new marker.
  • Existing Claude/Codex/Grok behavior and vendor regressions passed.

Local native observations are Linux x64 against scripted providers. Cross-platform validation is pending this revision's CI. Codex declarations were exercised with local compaction; ChatGPT remote compaction was only inspected in native source, not exercised. Conditional Grok/OpenCode support and unmeasured Qoder/CodeBuddy omission remain undeclared. Qwen's compaction-status attribution is a separate task (#156).

Task #153. No version bump; release timing belongs to Cindy.

@stamp-build
stamp-build Bot merged commit 4be08e9 into main Nov 2, 2026
36 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/resume-option-semantics branch November 2, 2026 09:20
@stamp-build stamp-build Bot mentioned this pull request Nov 2, 2026
stamp-build Bot added a commit that referenced this pull request Nov 2, 2026
<!-- stamp:review:v1 -->
<sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_5f43dcb5c3dc15f0f18ace9ca5bc3132"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup>

---
<!-- /stamp:review:v1 -->

Minor release: Claude and Codex accept prompt options on resume again, so a resumed session keeps its prompt after native compaction. The new optional `Runtime.resumedSessionOptions` says, before a session opens, when a prompt supplied on resume takes effect and what omitting it does.

## Behavior changes for hosts

### Prompts on resume (#606)
- Claude now accepts `systemPrompt` and `appendSystemPrompt` on resume, and Codex accepts `appendSystemPrompt`. Since #469 these opens were refused with `UnsupportedOptionError`. OAR now forwards them to the native launch.
- A value different from the one the session saved takes effect at the next native compaction; until then the saved prompt stays in effect. Omitting the option keeps the saved prompt only until that compaction; after it, the session gets what a new session without that option would get (the runtime's built-in prompt plus the user's own configuration). Empty and repeated values are now forwarded too, where they used to be refused.
- **Pass the current prompts on every resume.** This holds for Claude and Codex as above, and also for Qwen and Pi (in-process and subprocess), which do not save prompts at all: there an omitted prompt is gone on the very next request.
- Why the change: #469 observed only the first resumed request, where the new value was ignored, and advised hosts to omit these options to keep the saved prompt. At compaction Claude drops its saved prompts and Codex its saved append, so a session resumed that way silently lost its prompt at its next compaction.
- Codex `systemPrompt` (replacement) is unchanged: it applies immediately on resume and keeps the saved value when omitted, including across compaction.
- New optional `Runtime.resumedSessionOptions`, keyed by `SessionOptions` names. Each entry has `provided` (`immediate` or `next_compaction`, for a value different from the saved one) and `omitted` (`saved`, `default` or `saved_until_compaction`). It is declared for Claude, Codex, Qwen, Pi (in-process and subprocess) and Pi Durable, measured on Claude 2.1.316, Codex 0.166.0, Qwen 0.26.5 and Pi 1.4.0. An absent entry means untested; it implies neither support nor refusal, and refusals stay in `refusedSessionOptions` and conditional `UnsupportedOptionError`s (for example Pi Durable still refuses changed settings while adopting an active run). `ResumedSessionOptions` and `ResumeOptionSemantics` are exported from the package root. The Codex entries were measured with local compaction; compaction under a ChatGPT login was checked in Codex source only.
- Grok: resuming with `appendSystemPrompt` but no `systemPrompt` is still `UnsupportedOptionError`, now with a migration hint, because Grok (1.0.70) never applies a changed append on resume, even after compaction. It is refused even when the text is unchanged, since OAR cannot compare it with the saved value. For an append-only Grok session, omit `appendSystemPrompt` on resume; the saved one stays in effect. To change it, supply `systemPrompt` as well. Match on `option`, not on the text.
- OAR does not compare prompt text, insert a prompt into the first input, or compact on its own.

### Qwen memory extraction (#605: docs and a regression, no behavior change)
- With Qwen 0.26.5 (observed on Linux with a scripted provider), each completed ordinary turn also makes a managed-memory extraction request after the main reply and before the native `result`. Its time and usage belong to that turn, and `promptAndWait` waits for it. Receiving all of the reply text does not mean the turn has ended: disposing before `turn_ended` interrupts the extraction like any active turn, so that turn has no native `result` or complete OAR usage, and a raw assistant frame may hold only the main request's partial usage. This is not a claim about every memory configuration or provider.

## Known issue
- Qwen's native compaction report (`Context compressed (old -> new)`) is projected as model text (`text_delta`), and Qwen sessions emit no compaction events. Qwen 0.26.5's stream-json output marks it no differently from model text, and a user's own `compress.toml` can replace `/compress` with an ordinary model turn, so OAR cannot tell them apart and does not guess. Do not treat that line as the model's answer. A request for Qwen to report compaction structurally is being drafted.

## Tests and CI
- Native regressions read each `resumedSessionOptions` declaration and verify supplied and omitted values before and after native compaction: Claude via `/compact`, Codex via native automatic compaction, Qwen via `/compress`, Pi and Pi Durable via native compaction. A registry test pins which runtimes declare entries and that no declared option is also refused (#606).
- Qwen and Pi resumed-prompt regressions (#605).
- Pi provider tests no longer depend on DeepSeek or Anthropic credentials in the host environment (#604).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Cindy <[email protected]>
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.

0 participants