Repository navigation
auto-review rejects valid Responses-API streams that end with a reasoning output item (block-shape assertion is stricter than the protocol)
#12052
fhtpku-Cli
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
auto-review rejects a valid Responses-API stream that ends with a
reasoningitemSummary
With the
@deepseek-ai/dsh-experimental-auto-reviewbundle enabled and approval policyask, every tool call fails before execution when the active model is served by anopenai-responsesprovider that appends a trailingreasoningoutput item after its answer.The reviewer's own decision is correct and well-formed JSON; the failure is purely a content-block shape check inside the reviewer.
Environment
0.2.1-rc.5, macOS (arm64)@deepseek-ai/dsh-experimental-auto-reviewenabled as a profile bundleaskapi: openai-responses(OpenAI Responses-compatible gateway in front of an upstream model)Steps to reproduce
ask.apiisopenai-responses, where the upstream implementation returns a trailingreasoningitem (carryingencrypted_content) after the assistant message.Result: the tool call is rejected with the error above, 100% of the time. The reviewer never approves anything, so auto mode is unusable for that model.
What the provider actually returns
Streaming event sequence for a review request (model output is
{"risk":"low","decision":"allow"}, which is exactly whatREVIEW_POLICYasks for):The
response.completedpayload agrees:The same trailing item appears on ordinary agent calls, not just review calls. A normal tool-using turn produced:
So this is not a review-specific behaviour of the provider; it is how that provider returns every response.
Root cause
Two pieces of DSH code combine badly.
packages/llmResponses adapter creates one slot peroutput_index:Each slot becomes its own content block, so the trailing item at
output_index: 2becomes a third block of typereasoning.BlockAssemblerthen produces[reasoning, text, reasoning], andreadDecisionin the auto-review package validates:The last block is
reasoning, so the check throws and the pending call is dropped.Nothing in the Responses API requires the last output item to be a
message. A trailingreasoningitem carryingencrypted_contentis a legitimate response shape — it is how some implementations hand back replayable reasoning state.Why this is a DSH-side bug
parseDecisionalready validates the JSON protocol, so the block-shape assertion adds no security value. It only couples the reviewer to one specific provider streaming layout.session.requestHeader()→provider/model), with no configuration override. So users cannot point the reviewer at a model whose stream happens to match the expected shape; the only escape is to stop using the affected model.Suggested fix
Relax the assertion in
readDecision:reasoningblocks in any position, and take the last non-emptytextblock as the decision.reasoningblocks entirely (an item with an emptysummaryand no text content carries no information the reviewer needs).text" clause and locate the decision text by scanning for the finaltextblock, then feed that to the existingparseDecision.Keeping
parseDecisionstrict is correct and sufficient; the block-order rule can go.Workaround for affected users
apiisopenai-completions(oranthropic-messages) instead. On those adapters, reasoning and text deltas accumulate into one stable block per type, so the assembled sequence is[reasoning, text]and the assertion passes.Notes on scope
reasoningblock persisted in the assistant message.text" would fail the same way against this provider.Related reports (different root causes)
These report the same symptom (
Auto review of tool "..." failed) but are unrelated to this issue:invalid temperature: only 1 is allowed for this modelsessionId, upstream returns400 MissingSessionIDrun_code/ skill callsThis report is specifically about a content-block shape mismatch caused by a provider returning a trailing
reasoningoutput item.All reactions