Repository navigation
🤖 fix: keep frozen system sections on an assistant-last retry - #7654
Conversation
A request whose history ends with an assistant row (a retry after a stream failure, or a resume) cannot carry a system row, so a changed frozen section re-froze at the live value. On the live host that rewrote the cached tool block three times on 2026-10-26: each time the retry came 2 s after "Anthropic stream closed unexpectedly", and the skill list had changed during the turn. The section now stays frozen, the request records nothing, and the next request after a user message sends the change as a row. The turn's earlier steps read the frozen section anyway. --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
…ile-change row - aiService: an OpenAI route (no system rows) still sends the <mcp> server list in its system prompt after #7653, live, with no tail row or record. - turnContextAssembler: with a durable <system-file-update> row as the newest user row, post-compaction attachments go between the user's message and the notification, and a retry after the committed assistant row, a budget warning appended mid-turn, the plain request and the next turn all keep the rows before the turn's request. --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc27080698
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🟢 e2e stories (Haiku): 14 passed22 agent steps · 7 replayed from cache · 15 model calls · 46.3k tokens (28% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 12s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 8.0k tokens (32% cached) All 3 tests in 3 files
e2e 0.20.0 · 20.1s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts |
An assistant-last request keeps the frozen sections (F36), but only the custom-instructions channel took the model/agent switch re-freeze. A partial turn resumed under another agent, model or route then kept the old agent's frozen Tool: instructions, skill index and volatile tail until a later user turn. planSystemPrompt now computes the switch once and passes it to every channel's planner, so a switch re-freezes all sections and records "system" for each, which replay reads back. A same-agent retry still keeps the frozen sections. Codex PRRT_kwDOPxxmWM6wf11x. --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Summary
A retry after a failed stream no longer rewrites the warm prompt cache when a frozen system section changed during the turn. Before, a request whose history ends with an assistant row (a retry after "stream closed unexpectedly", or a resume) re-froze every changed section at its live value: the skill index, AGENTS.md blocks,
Tool:sections, the MCP list and the volatile tail. Now such a request keeps the frozen sections and records nothing. The next request after a user message sends the change as a row. The PR also adds two tests for #7652 and #7653.Background
On 2026-10-26 the host logged three
cache.prefix_breakevents in the tool block (agent_skill_read), on a build that already freezes the skill index (#7308). Each came 13 to 22 seconds afterturn.failed("Anthropic stream closed unexpectedly") and an automatic retry. In two workspaces, the retry's assistant row recorded a secondsystemskill-index record inside the same segment (12,113 to 11,996 characters), because the skill list had changed globally during the turn. The only path to a mid-segmentsystemrecord is the assistant-last branch ofplanSystemSection.Implementation
planSystemSection(volatileSystemTail.ts): when the history does not end with a user message, it now returns the frozen section plus the rows already sent, with no new record. It no longer re-freezes at the live value. A re-freeze for a model, route or agent switch still runs first and is unchanged.Validation
<mcp>list in the system prompt, with no row and no record.convertToModelMessagesdrops the metadata.Risks
Low. On an assistant-last request, the model reads the frozen sections until the next user turn. A flow that never adds a user row would never see a change. I know of no such flow. The rebuilds in
turnRequestBuilder.ts(rebuildAfterSequencing, the thinking-level rebuild) still reuse the first payload's tools. With this fix both builds plan the same tools, but the code does not enforce that.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$604.04