fix(responses): give every reasoning input item the summary the upstream requires - #4673
Conversation
…eam requires A reasoning item forwarded without `summary` is refused with `Missing required parameter: 'input[N].summary'` before inference, while responsesRequestSchema marks the field optional so it passed every local gate. The chat ingress minted such an item for a replayed assistant turn, and the reasoning sanitizer passed any client-supplied one through untouched. The ingress now carries the replayed thinking as a summary_text part, mirroring src/claude/inbound.ts, and the sanitizer supplies an empty summary for any item that arrives without the key.
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. |
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds reasoning summaries during Chat Completions translation and repairs missing summaries before sending Responses input. Tests cover synthesized summaries, empty-summary injection, existing-summary preservation, encrypted content, raw-content preservation, and replayed requests. ChangesReasoning replay
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The PR supplies the required reasoning summaries for translated and replayed inputs without an identified merge-blocking regression. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 304ef17a2d
ℹ️ 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".
| // Claude ingress (src/claude/inbound.ts), which has always minted both. | ||
| input.push({ | ||
| type: "reasoning", | ||
| summary: [{ type: "summary_text", text: reasoningText }], |
There was a problem hiding this comment.
Update the owned reasoning contract for the new summary shape
This changes translated Chat replay from a content-only reasoning item to one containing a non-empty summary, and the sanitizer now makes that summary the only text sent to canonical Responses targets, but none of the owning structure documents were updated. In particular, structure/providers/chat-compat.md:247-253 still says raw reasoning remains in content and explicitly records that routing raw chain-of-thought through the summary channel was reverted. Update structure/data-planes/inbound-compat.md and the reasoning-channel invariant to describe this new exception, or keep the raw text out of summary, so the repository's architecture contract no longer contradicts the wire behavior.
AGENTS.md reference: AGENTS.md:L33-L41
Useful? React with 👍 / 👎.
…ary in issue-702 replay
리뷰 · 우선순위 75 / 80이 PR은 Chat Completions → Responses 변환과 reasoning 입력 살균에서 고침은 두 층이다. 첫째, chat 인그레스가 Claude 인그레스( 파일 위치도 현재 같은 구멍에 대한 열린 PR #4629(Ingwannu, #4628)와 선택이 다르다. #4629 는 wire 를 맞추려고 라인 / 경로 수준: 라인 ~316 ( 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
Summary
A reasoning item that reaches a Responses upstream without a
summaryfield is refused beforeinference with
Missing required parameter: 'input[N].summary', and the whole turn fails. The fieldis optional in
responsesRequestSchema, so such an item passed every local gate and broke only onthe wire — reported from an Aside/Pi client talking to the proxy over
/v1/chat/completions.Two layers produced or passed on that item, and both are fixed:
src/chat/inbound.tsminted the reasoning item for a replayed assistant turn (Audit F6) withcontentonly. Every other item this proxy mints —src/bridge.ts,src/claude/inbound.ts—already carries
summary; this ingress was the one that did not. It now carries the replayedthinking as a
summary_textpart, matching the Claude ingress, which also matters becausesanitizeReasoningInputContentblankscontentfor every destination except apreserveResponsesReasoningContentprovider, so summary is the only channel that survives to anative backend.
sanitizeReasoningInputContentnow supplies an emptysummaryfor any reasoning input item thatarrives without the key, so a third-party client or another translated ingress cannot reintroduce
the same 400. This is not gated on the destination: an item missing the key is not a shape a
canonical backend issued — Codex and this proxy always emit
summary— so nothing a nativebackend sent is reshaped. An item that already has a summary is returned untouched.
Verification
typecheck, and build were NOT RUN: the maintainer explicitly prohibited local suite runs for
this task.
sanitizeReasoningInputContenthas two direct testowners (
tests/providers/deepseek-reasoning-replay.test.ts,tests/adapters/anthropic/anthropic-thinking-signature.test.ts), and the only whole-item equalityassertion over a summary-less item is the first test in the DeepSeek file, whose expectation is
updated here with the reason inline. Every other test that builds a reasoning item either supplies
summaryor does not compare the sanitized item by equality.tests/providers/deepseek-reasoning-replay.test.ts(summary suppliedwhen absent, existing summary untouched, repair applies on the content-preserving path) and
tests/responses/chat-inbound-reasoning-replay.test.ts(the minted item carries the summary, andthe replayed thinking survives sanitization).
Checklist
Summary by CodeRabbit
Bug Fixes
Tests