Repository navigation
fix: ChatGPT tool replies fail after unverifiable reasoning replay - #185774
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesOmit stateless Responses reasoning items when neither a replay ID nor eligible encrypted content remains. Example: Fork a conversation containing encrypted reasoning, then execute Code Mode
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review This PR fixes a verified tool-continuation failure that remains on current main; no actionable defects were found. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared Responses converter turns conversation history into provider request items for both transport and provider callers, applying replay attribution before dispatch. flowchart LR
A[Conversation history] --> B[Shared Responses converter]
B --> C[Replay attribution checks]
C --> D[Stateless reasoning eligibility]
D --> E[Responses service]
E --> F[Tool continuation and final answer]
Technical reviewBest possible solution: Apply the eligibility check in the existing shared converter while preserving attribution, valid replay, history, and completed tool results. Do we have a high-confidence way to reproduce the issue? The independently supplied built-Gateway comparison reproduces the failure twice on pinned main using public session forks and real ChatGPT calls; fetched-main source retains the responsible construction. Is this the best way to solve the issue? This is the smallest complete repair for the demonstrated mechanism: reject the unusable reasoning item at construction after attribution filtering, without weakening the fence or widening retries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c600c374499. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +82. Total +87 across 2 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 27, 2026, 7:17 AM ET / 11:17 UTC (Revision 3). |
|
@clawsweeper re-review Added the sanitized recorded Gateway before/after capture and regression RED/GREEN terminal excerpts to the PR body. No source changes; reviewed head remains e3eb1c2. |
|
🦞👀 Re-review progress:
|
Independent built-Gateway real-model proofBuilt pinned main Each repetition generated a fresh real arithmetic answer (4874), then used the public operator route The real tool result is retained in main's canonical history before the rejection; the candidate retains it and persists the final assistant text. No tool re-execution is needed. Same-session encrypted-replay controls return 42 on both builds. Separate native Codex-runtime controls also return 42 on both builds; those controls do not claim to share the changed converter. Credential safety: exclusive task lease, login returned after use, temporary imported profiles removed. Native and both imported profiles had matching access-token expiry before cleanup; no refresh was observed. No source changes or push were needed. Limits: the public fork reproduces this specific real-service failure; it does not establish that every historical #167667 incident has this cause. This comparison independently establishes behavior and canonical provenance, not a new wire-level capture of the omitted request item. No opaque reasoning or credential material is included here. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…penclaw#185774) fix(openai): don't replay unverifiable stateless reasoning into ChatGPT tool continuations When a ChatGPT tool turn continued in a forked session, OpenClaw replayed a stateless reasoning item the service could not verify, so the continuation was rejected and the turn failed after its tool had already run. Unverifiable stateless reasoning is no longer replayed; same-session encrypted reasoning is kept. Evidence: real ChatGPT turns (loop ChatGPT login, no API key) through OpenClaw's own harness and public session forks, no synthetic history. On main the turn ran exec once and then failed with the replay rejection (twice); with this change it ran exec once and saved the final answer (twice). Same-session encrypted replay and the native Codex runtime work on both refs. Details: openclaw#185774 (comment). Items under "Not fixed here" (openclaw#167667) are not addressed. Production 5 lines. Thanks @anyech. Co-authored-by: Ayaan Zaidi <[email protected]>
…185774) fix(openai): don't replay unverifiable stateless reasoning into ChatGPT tool continuations When a ChatGPT tool turn continued in a forked session, OpenClaw replayed a stateless reasoning item the service could not verify, so the continuation was rejected and the turn failed after its tool had already run. Unverifiable stateless reasoning is no longer replayed; same-session encrypted reasoning is kept. Evidence: real ChatGPT turns (loop ChatGPT login, no API key) through OpenClaw's own harness and public session forks, no synthetic history. On main the turn ran exec once and then failed with the replay rejection (twice); with this change it ran exec once and saved the final answer (twice). Same-session encrypted replay and the native Codex runtime work on both refs. Details: #185774 (comment). Items under "Not fixed here" (#167667) are not addressed. Production 5 lines. Thanks @anyech. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 86ddabd) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 0e899f84a1fb14e92d49583a19afd9935c71c9f6)
…185774) fix(openai): don't replay unverifiable stateless reasoning into ChatGPT tool continuations When a ChatGPT tool turn continued in a forked session, OpenClaw replayed a stateless reasoning item the service could not verify, so the continuation was rejected and the turn failed after its tool had already run. Unverifiable stateless reasoning is no longer replayed; same-session encrypted reasoning is kept. Evidence: real ChatGPT turns (loop ChatGPT login, no API key) through OpenClaw's own harness and public session forks, no synthetic history. On main the turn ran exec once and then failed with the replay rejection (twice); with this change it ran exec once and saved the final answer (twice). Same-session encrypted replay and the native Codex runtime work on both refs. Details: #185774 (comment). Items under "Not fixed here" (#167667) are not addressed. Production 5 lines. Thanks @anyech. Co-authored-by: Ayaan Zaidi <[email protected]> Beta.5 baseline adaptation: Retain the native beta.5 owners, fixtures and public contracts; add focused regression controls and bounded fixture extraction; apply checkout formatting. (cherry picked from commit 86ddabd) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 19f5bd835847d4ecff323ccbc315c348664c2884)
…s lane FRV tests (#187567) * docs(secrets): include Beam mirror token in credential matrix (cherry picked from commit dfa7774) * test(infra): supply versions list in astral ClawHub detail fixture The backport of #182753 (74e414a) dropped the versions: { items: [] } default that main's readDetail helper supplies, so the release-branch fixture fails the versions response guard. * test(web-search): carry #179703 envelope bound into release security test Main's 47c1c2a raised the aggregate JSON envelope bound from 22,000 to 23,000 because rows now keep their titles and site names (more wrap envelopes); the 20,000-char untrusted content cap is unchanged. The release backport 2b35452 put the new tests in web-search-budget.test.ts and missed this assertion in the release-only security test file. * test(auto-reply): expect preserved multiline /side input in registry test Backport 9b93c22 (#176293, main d7359a7) intentionally preserves multiline /btw, /side and /loop arguments. The release-only registry test still asserted the old first-line truncation for /side; main no longer has that assertion. * test(pdf): hold a Codex OAuth login in the ChatGPT PDF fixture Backport f41ea65 (#181356, main f64e38f) intentionally resolves a ChatGPT catalog row with only an API key as stale, routing it to the Platform contract. Port main's matching fixture update from 280c7c7 (shipped inside an unrelated visitor-access commit) so the test exercises the Codex subscription route it names. * test(auto-reply): expect agent inventory workspace for reply runtime Release backports 23e702a (#185573) and 59b6c10 (main 786cfd7) together adopt #185512's design: replies prepare the configured agent inventory workspace (preserveWorkspaceDirOnRefresh: false) and nested runs borrow it, while the reply workspace stays the execution boundary. Main's copy of this test no longer asserts the acquire input (db8180b). * test(agents): expect unverifiable stateless reasoning to be omitted Backport c93fe0b (#185774, main 86ddabd) intentionally stops replaying reasoning that has neither a replay ID nor authorized encrypted state when store is disabled. Main removed this test earlier (542e074); the release copy still expected the unverifiable item. * fix(plugins): allow retained registrations on reused inspections Catalog scope growth can reuse the same physical registry inspection. Keep its already-owned registrations in place instead of transferring them into their own resource map and failing with a duplicate-custody error. Preserve live-owner validation and all distinct-inspection transfer and disposal behavior. Extend the resource-backed lifecycle regression with self-adoption before abandoned growth and promotion. Proof: regression fails on unchanged production; fixed resource lifecycle and all seven selected catalog cases pass. Targeted native types, typed lint, format, suppression tests, runtime/static cycles and planner pass. Independent review found no actionable P0-P2 findings. (cherry picked from commit 52df852) * test(agents): seed the worker catalog in the isolated-completion owner test Backport 0c77c1d (#182952, main 4c3bf18, which shipped no test) carried a test adapted from another line that seeded discovered rows only through the in-process catalog builder. On this branch Gateway-configured agents load their full catalog through the catalog worker, so the setup never saw the row and the test failed from the commit that added it. Seed the worker mock too and match the row by its own fields (the catalog adds provenance). Verified: the test fails at the lease assertion when #182952's runtimePluginPurpose normalization is removed and passes with it. --------- Co-authored-by: Peter Steinberger <[email protected]>
Related: #167667
What Problem This Solves
Fixes: ChatGPT tool replies can fail with “Rustponses cannot replay” after saved reasoning loses its replayable encrypted state.
User Impact
User impact: affected conversations can complete tool-result continuations without replaying unverifiable reasoning. Valid encrypted reasoning, ID-based replay, visible answers, and completed tool results retain their existing behavior. No configuration change or migration is needed.
Why This Change Was Made
The existing replay-attribution fence correctly removes ciphertext that no longer belongs to the active replay context. With item IDs disabled, the converter also removes the ID but still sends the remaining reasoning item. A service response to that input may succeed, yet its next cached tool-result continuation rejects the persisted state. Omit that item at the shared request-construction owner rather than weaken the attribution fence or broaden retries.
Evidence
Independent exact-head built-Gateway real-ChatGPT comparison, using public operator forks and fresh model-generated reasoning (main twice rejects after one completed tool call; candidate twice persists final 42): #185774 (comment). Includes passing same-session replay and native-runtime controls.
Behavior addressed: Reasoning without either an item reference or authorized encrypted content must not enter stateless Responses input. Text, tool calls and results must remain intact.
Real setup tested: The native Responses adapter and actual remote service, plus an isolated source Gateway with a real agent, canonical SQLite history, two real sessions and the actual Code Mode tool. The affected reasoning-capable model and credentials were unchanged within each comparison. All history was freshly generated from synthetic arithmetic; no original conversation or pre-existing opaque state was replayed.
Exact steps or command run after this patch: Generate an encrypted reasoning answer through the Gateway; read its canonical session messages and restore them unchanged into a new session; ask Code Mode to execute only
return 42;; then continue with its completed result. Verify the new session attribution fence removes ciphertext, the patched native request omits the residual reasoning item, and the cached result-only continuation completes. The checked-in converter cases, affected consumer suites and prompt-prefix stability suite were executed with the project’s native single-worker Vitest launcher.Evidence after fix: The complete original-code Gateway run executed the tool successfully, then received the exact Rustponses rejection on its third request. With this patch, all three Gateway requests completed and the final answer was 42; the tool was executed once. Separate native-adapter comparisons reproduced the rejection twice on original code and completed both patched three-request sequences (six real requests). Focused converter cases pass 6/6; affected regressions pass 99/99; prompt-prefix checks pass 13/13. Touched formatting, lint and targeted type checks pass. Independent Auto Review found no actionable P0–P2 findings.
Observed result after fix: The malformed stateless reasoning item is omitted; the visible answer and completed result survive. No stored-history rewrite, retry widening or tool re-execution is introduced.
What was not tested: The original historical request’s complete wire data was not retained, so this establishes a matching reproduced mechanism, not exclusive attribution of that incident. A different model completed the unchanged path: missing ciphertext alone is not claimed to make every response fail. Runtime proof is pinned to
b4e7ddf159ec11280e0963e0fa037571bacb315f; publication baseaedd9f3f56585d92ed14947df8c84ef6354f64ccadditionally contains system-prompt preparation changes but the replay seam is unchanged. Current-head CI is separate evidence. No production repair has been installed.The reproduced failure returned a tool-only response before the rejected continuation. The fix prevents that unusable input state instead of relying on a wider retry.
Adjacent upstream work
#168055 adds bounded recovery after a cached continuation rejection; this change prevents one invalid input construction. #113869 filters transient reasoning IDs, a different eligibility rule. #167769 canonicalizes fresh encrypted signatures across local reloads and preserves plaintext-only signatures; it does not remove unverifiable stateless input. Presentation and diagnostic changes remain separate.
Captured behavior proof
Actual Gateway baseline rejection and patched continuation
The projection below preserves the recorded request/output types and outcomes while omitting private identifiers and opaque state. The original run asserts the expected rejection, so both harness processes exit successfully even though the original agent run fails.
Regression RED and GREEN terminal excerpts
Not fixed here
Other cached or full-input rejections, broader bounded recovery, generic error presentation and diagnostics, and every historical incident in #167667 are not fixed by this patch. This is a partial request-construction repair; #167667 remains Related, not closed.