Repository navigation
Conversation
…laude route On the translated Claude Messages route a Responses provider's native encrypted_content was discarded on the way out, and nothing could carry it back: the body is store:false and Claude Code replays only the thinking block. The routed model lost its own reasoning every turn (lidge-jun#6736). Keep the native blob in the thinking block's ocxr1 envelope as `nat`, with the client-facing model and the provider's item id, and emit that block even when no summary arrived. Inbound restores it as encrypted_content and id only for a request naming the same model; any other model gets the visible text alone. Translated bodies that reason now request include: ["reasoning.encrypted_content"], as Codex does. Refs lidge-jun#6736 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe Claude translation now preserves provider-native encrypted reasoning in Claude thinking signatures and restores it in Responses requests for the same model. It also requests encrypted reasoning when thinking or output effort is configured. New integration tests cover conversion, replay, and malformed envelopes. ChangesClaude reasoning continuity
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No concrete issue remains that would prevent merging after normal checks. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation Issue Resolution Store a stable provider identity with Full details: Docstring CoverageExplanation Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 4 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
|
Results from a second machine, plus prompt caching, which the PR description didn't cover. The same diff runs on v2.80.0 on two machines, routing Claude Code subagents to
🤖 Generated with Claude Code |
Summary
Fixes the reasoning loss reported in #6736. On the translated Claude Messages → Responses route, a Responses provider's own
encrypted_contentwas dropped on the way out (outbound.tsdecodes onlyocxr1:envelopes). Nothing could carry it back either: the body isstore: falseand Claude Code replays only the thinking block. So the routed model lost its own reasoning every turn. With Muse Spark that shows up as long reading phases before the first edit, with the model restating that it is ready many times.src/responses/reasoning-envelope.ts: new envelope fieldnatholds the provider's blob verbatim, plus the client-facing model it was minted for and the provider's item id. It follows the same pattern askrcfor Kiro. A malformednatis ignored.src/claude/outbound.ts(streaming and JSON): a reasoning item with a native blob is signed into its thinking block's envelope. It now gets a thinking block even when no summary arrived; before, most Muse items produced no block at all.src/claude/inbound.ts: a replayed thinking block whose envelope hasnatbecomes a reasoning item with thatencrypted_contentandid, but only when the request names the same model. Any other model gets the visible text alone, so/modelmid-conversation can't hand a blob to a provider that can't decrypt it. Bodies that reason now sendinclude: ["reasoning.encrypted_content"], the same field Codex sends to every Responses provider.sig) and redacted blocks (red) behave as before. Nothing changes for native Anthropic passthrough.structure/clients/claude-desktop.mddocuments the rule.tests/claude-integration/claude-native-reasoning-continuity.test.tsis registered in the test layout on an existing line.This covers the Responses-route fix in #6736. The issue also has a comment about Meta's Anthropic-format endpoint through the
anthropicadapter (src/protocols/opaque-state.ts); that one is a separate design question and is not touched here.Closes #6736
Verification
Run on macOS 26.6.2 (arm64), Bun 1.4.0, branch rebased onto
devat bf9ecf3.bun run typecheck: pass.bun test tests/claude-integration/claude-native-reasoning-continuity.test.ts: 10 pass. Withsrc/reverted todev, 8 of the 10 fail. The 2 that pass either way check unchanged behaviour (an item with no native blob, a malformednat).claude-outbound,claude-inbound,claude-inbound-tool-reference,claude-inbound-token-footer,responses/reasoning-envelope,providers/kiro/kiro-reasoning-roundtrip,adapters/bridge,adapters/anthropic/anthropic-opaque-strip. Together with the new file: 338 pass, 0 fail.bun run structure:check: pass.bun run privacy:scan: pass.bun run test:changed(before the rebase,devat 18a8cda): 33,105 tests, 32,798 pass, 201 fail, 3 errors. Every failure sits in 26 files outside the changed modules (server auth and admission, lab, Kiro catalog, service).devworktree gives the same failing test names: 656 pass, 183 fail in isolation on both trees.HTTPS_PROXYandNODE_EXTRA_CA_CERTS. With those cleared, the same files drop to 56 failures, again identical ondev. I'm leaving the full-suite verdict to CI.Live check: the same diff applied to an installed v2.80.0, route
meta-muse/muse-spark-1.3-contributor(Coding Plan).Recall test. The model is told a random 8-character code and asked to keep it only in its reasoning. On turn 2 the code is replaced with
[removed]and the model is asked for it.[1m]alias, so the guard withholds the blobWithout the fix this route recalled 0 of 3 on the earlier test.
A real Claude Code subagent on the Muse route, given a small test-writing task:
Checklist
structure/clients/claude-desktop.md).🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
New Features
Tests