fix(claude): bound streamed reasoning identity - #1377
Conversation
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
|
Please rebase this PR onto the latest |
3ca029b to
6087441
Compare
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe Claude outbound path now creates bounded SHA-256 identities for reasoning metadata. Thinking-block keys preserve item and part distinctions without retaining large upstream values. Tests cover large, repeated, changed, and malformed identities. ChangesReasoning identity boundaries
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Rate Limit Exceeded
|
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== PR metadata =='
gh pr view 1377 --repo lidge-jun/opencodex --json number,headRefOid,baseRefOid,commits,title,url
echo '== Changed files and diff =='
git diff --find-renames origin/dev...HEAD -- src/claude/outbound.ts tests/claude-outbound.test.ts
echo '== Source outline =='
ast-grep outline src/claude/outbound.ts --items all --view expanded
echo '== Relevant source references =='
rg -n -C 5 -e 'thinking|reasoning|summary_index|item_id|createHash|sha256' src/claude/outbound.ts
echo '== Relevant test references =='
rg -n -C 8 -e 'thinking|reasoning|summary_index|item_id|large|malformed' tests/claude-outbound.test.tsLength of output: 1654 🏁 Script executed: #!/bin/bash
set -u
echo '== PR diff from GitHub =='
gh pr diff 1377 --repo lidge-jun/opencodex -- src/claude/outbound.ts tests/claude-outbound.test.ts || true
echo '== Source outline =='
ast-grep outline src/claude/outbound.ts --items all --view expanded || true
echo '== Relevant source references =='
rg -n -C 7 -e 'thinking|reasoning|summary_index|item_id|createHash|sha256' src/claude/outbound.ts || true
echo '== Relevant test references =='
rg -n -C 10 -e 'thinking|reasoning|summary_index|item_id|large|malformed' tests/claude-outbound.test.ts || trueLength of output: 39555 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Changed-file patches =='
gh api --paginate 'repos/lidge-jun/opencodex/pulls/1377/files?per_page=100' \
--jq '.[] | select(.filename == "src/claude/outbound.ts" or .filename == "tests/claude-outbound.test.ts") | "FILE: \(.filename)\n\(.patch)\n"'
echo '== Streaming parser and budget context =='
sed -n '218,410p' src/claude/outbound.ts
echo '== SSE decoding and payload handling references =='
rg -n -C 6 -e 'JSON\.parse|sseFieldValue|translatorBudget|reserve|replaceRetained' src/claude/outbound.ts src/lib/sse-decoder.ts src/lib/translator-budget.tsLength of output: 66764
I found no correctness issue in the reviewed change.
I did not execute repository tests in this review. The readiness gate reports that all required checks passed.
|
|
Thanks @luvs01 — nice stream-state hardening. Hashing oversized reasoning identities keeps the equality/boundary semantics intact without retaining attacker-sized metadata, and the malformed-identity regressions cover the tricky cases well. 🙏 |
Summary
item_idand part-index strings with fixed-size SHA-256 identities.\n\nboundaries, including malformed string and array metadata, instead of collapsing all invalid identities to one sentinel.Verification
bun test tests/claude-outbound.test.ts— 38 passed.bun run typecheck— passed.bun run privacy:scan— passed.git diff --check HEAD^ HEAD— passed.Checklist
dev.Review readiness checklist
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Tests