Skip to content

test(resume): verify Qwen and Pi prompt replacement - #605

Merged
stamp-build[bot] merged 1 commit into
mainfrom
agent/otter/qwen-pi-resume-prompts
Nov 2, 2026
Merged

stamp-build[bot] merged 1 commit into
mainfrom
agent/otter/qwen-pi-resume-prompts

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 →


Qwen and Pi accept fresh systemPrompt and appendSystemPrompt values when resuming a conversation, but omitted options do not restore the old overrides. Add native vendor regressions for replacement, append and both together across Qwen, Pi SDK and Pi RPC. Each case keeps the session id and prior user history, then checks raw provider requests for old values, replacement values and omission. The existing vendor CI jobs collect these cases without workflow changes.

While separating Qwen's main requests from its auxiliary memory requests, seven controlled runs established that memory extraction happens after the main reply and before the native result. Document its timing and usage, preserve the probe and selected observations, and distinguish interrupted partial assistant usage from a complete turn total. Product code is unchanged.

Validation: CI=1 pnpm run check; all three new cases pass on each of Qwen 0.26.5, Pi SDK 1.4.0 and Pi RPC 1.4.0 (nine native cases). The seven memory controls use Qwen 0.26.5 on Linux x64 with a synthetic provider, including delayed replies and disposal while memory extraction is streaming. Windows/macOS vendor results remain for CI; the memory observations are scoped to Linux.

Task #151.

@stamp-build
stamp-build Bot merged commit e997f02 into main Nov 2, 2026
36 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/qwen-pi-resume-prompts branch November 2, 2026 06:32
@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