Repository navigation
Conversation
…r-request oracle Add tests/oracles/modelMessageTransform.oracle.ts: it sends the output of sanitizeAssistantModelMessages + transformModelMessages through the real @ai-sdk/anthropic and @ai-sdk/openai (fake fetch) and judges the request body against seven approved laws. On the unchanged code 327 of 1045 tests failed. Fixes, oracle first: - One response stays one message: splitMixedContentMessages is gone; rows without step boundaries split in insertStepStartPartsForSdk. - Thinking replay is one option (off, strip, manual, adaptive); only manual thinking moves the open turn's first message's thinking to its front, and the "..." placeholder is gone. - Tool calls and results pair by position; a misplaced pair leaves. - Streamed parts coalesce in sanitize before whitespace text is dropped; an OpenAI part with another itemId opens a new item; no pass edits its input. - task_await coalescing keeps each run's last no-progress pair. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
Codex Review Summary: ✅ CompletedThis 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. |
Oracle evidenceRound 2 (head 8a1e852): 66 gapsThe oracle now also drives OpenAI with
Closed in this round: the 2 OpenAI
Round 1 below. RED on the unchanged code (base 676c698)327 of 1045 oracle tests failed. Failed tests by law:
Gaps: 74 remain (187 at the first green run)Run
The 247 unowned mutants sit outside the stage: Live requestINCONCLUSIVE. The direct key got a 401; the gateway answered 200. In 24 attempts on Opus and Sonnet 5.5, the model never produced a |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
🟢 e2e stories (Haiku): 14 passed21 agent steps · 5 replayed from cache · 18 model calls · 77.1k tokens (37% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 16s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 7.9k tokens (22% cached) All 3 tests in 3 files
e2e 0.20.0 · 21.0s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 6.3s · 2 targets (web, phone) · run artifacts |
🛡️ 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. |
The oracle gains a config and two corrupt histories: - OpenAI with store: false (ZDR) sends reasoning items with their encrypted content and summary, so item coalescing shows on the wire. - An empty user message (a persisted user row with no text or file part converts to one). On the previous head it reached Anthropic as a message with no content: 2 of 1330 tests failed (no empty block). - A tool message before the first prompt. One first pass, keepSendableParts, now keeps the parts a request can carry (answered calls, the reasoning the provider replays) and drops every message left empty, of any role. That removes the branches whose mutants no history could tell apart: the role guards in filterReasoningOnlyMessages and stripUnsignedAnthropicReasoning (gone), the empty-content reads in the user merge and openTurnStart, and the empty-message drop in sanitize. --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. 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. |
Why
The next turn's rebuild split one model response at every thinking block or text that sat between its tool calls:
[P1, call A, P2, call B]went back as two assistant messages with a tool result between them, so two parallel calls replayed as two sequential ones. The request stopped repeating the bytes the turn sent (prompt-cache miss), and on prefix-bound Claude models block P2 lost its signed prefix. This hit 28 of the 49 response shapes the Anthropic docs describe (31 with adaptive thinking).This PR adds an oracle for the stage between conversion and cache control (
sanitizeAssistantModelMessages+transformModelMessages). It sends the stage's output through the real@ai-sdk/anthropicand@ai-sdk/openaiwith a fakefetchand judges the request body. On the unchanged code, 327 of its 1045 tests failed.What changed
tests/oracles/modelMessageTransform.oracle.ts: seven laws (no throw; tool calls answered in place; no empty block; user text stays; thinking goes back unchanged; one response, one message; input stays as given). Its two owned files are added toORACLE_SOURCES.splitMixedContentMessagesis gone. Rows persisted without step boundaries still split where a step must have ended (legacyStepStartsininsertStepStartPartsForSdk).anthropicThinking: "off" | "strip" | "manual" | "adaptive", resolved inmessagePipeline.ts. Only manual thinking moves thinking to the front, and only in the open turn's first message. The"..."placeholder is gone: the SDK dropped it anyway.keepSendableParts, keeps the parts a request can carry and drops every message left empty. Calls and results pair by position: a result outside the tool message right after its call leaves the request, and so does its call. Before this change, the AI SDK threwMissingToolResultsError. The reasoning a provider replays is a predicate of this pass (stripUnsignedAnthropicReasoningis gone).convert-to-model-messages.ts), and before this change Anthropic got a message with no content.sanitizeAssistantModelMessages, before whitespace-only text is dropped (sanitize no longer drops messages; the first pass does), so a dropped text can no longer join two thinking blocks under one signature. A part with another OpenAIitemIdopens a new item. No pass edits its input anymore.task_awaitcoalescing is rewritten: a no-progress poll pair leaves when the next pair is the same poll.Scope
Anthropic and OpenAI only. The other providers' reasoning handling is a stated limit, and the oracle does not generate provider-executed tools.
Tradeoffs
task_awaitcoalescing and 14 in the assistant-text merge; each of those two areas needs a law the approved spec does not hold. The other 6 are stated limits: provider-executed results inside an assistant message (4) and the unknown-provider replay (2). The list is in a comment below.stripAnthropicReasoningnow runs only within a turn (StepPreparation.ts), so the oracle no longer owns it.Blast Radius
The request bytes change for a history that has any of these: a step with thinking or text between its calls, a misplaced tool result, an empty user message, a no-progress poll whose message also held reasoning the provider does not replay (it now coalesces), or (with manual thinking) a finished turn whose first message started with text. Each affected chat gets one prompt-cache miss on its first request after the upgrade. Persisted history does not change, so a downgrade is safe.
Verification
make test-oracles: 1330 tests pass (gap report below). The documented shapesT? X? (T? C){1,3}run under every config, OpenAI withstore: false(ZDR) among them.[thinking, tool_use, thinking, tool_use]step to replay.External rules the stage encodes, tagged
Docs fetched 2026-12-05. D1 Messages API, D2 handle-tool-calls, D3 extended-thinking, D4 thinking, D5 OpenAI function-calling.
tests/ipc/streaming/emptyAssistantMessage.test.ts, commit ecc2e22)TextBlockParam.textminLength 1)tool_resultcomes right after itstool_use, results firstGenerated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh• Cost:$33.59