mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8818] [MERGED] fix(dottore): resend an empty max_tokens reply instead of failing the review #8825
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#8825
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8818
Author: @SpicyMarinara
Created: 11/4/2026
Status: ✅ Merged
Merged: 11/4/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/dottore-empty-capped-reply📝 Commits (2)
5e8b659fix(dottore): resend an empty max_tokens reply instead of failing the review8e09386fix(dottore): count empty capped replies and keep a scout's places when its call fails📊 Changes
3 files changed (+155 additions, -25 deletions)
View changed files
📝
.github/dottore-review/README.md(+7 -4)📝
.github/dottore-review/dottore_review.py(+58 -21)📝
scripts/regressions/dottore-stream-progress.regression.mjs(+90 -0)📄 Description
Linked issue
Closes #8817
Why this change
Dottore Review has been failing whole reviews with "the finder reply reached its 64000-token output cap" on small diffs (#8800 and Agents #2100 today). The calls never came near the cap: the gateway returned a reply with
stop_reason=max_tokensand 0 output tokens 5 to 15 seconds after the request.claude_replymarked anymax_tokensstop as capped, sorun_agentresent it once at a lower effort and then failed the review when the second reply came back empty too. The retry built for transient gateway faults (RETRY_DELAYS, same effort) never ran. Every such failure costs a manual/dottorererun and leaves the PR blocked in the meantime.What changed
max_tokenswith 0 output tokens is a gateway fault:claude_replyraisesResponseFailedwith no error code, whichtransient_erroralready retries, sochat()resends at the same effort afterRETRY_DELAYS(15 s, then 45 s). It counts towardMAX_ROLE_FAILURESonly when every resend fails. The message says "the gateway ended the reply at max_tokens before Claude wrote anything".usage.output_tokensis the signal because it is the SDK's billed total (it counts thinking even when only a summary is relayed); the real API cannot stop atmax_tokenswith 0 output tokens.responses_replyapplies the same rule to aresponse.incompletethat reports 0 output tokens, and names the incomplete reason. The output cap, or no reason, is retried; another reason, such ascontent_filter, fails at once with that reason instead of a lower-effort resend and a misleading "output cap" error. A response without usage keeps the old path.DOTTORE_COST_LIMIT_USDand the role's telemetry (model_calls,prompt_tokens,usd) through onecharge()helper shared with the success path, so the cost limit does not undercount while a gateway repeats the fault.stop_error. A run that has kept nothing still raises..github/dottore-review/README.md(role limits and cost limit) and theResponseFailed/run_agentdocstrings describe the new behaviour.scripts/regressions/dottore-stream-progress.regression.mjsdrivesrun_agentandchat()with stub Claude and Responses streams: an empty capped reply then a tool call succeeds at the same effort after one 15 s wait; a capped reply with output drops one effort level; three empty replies end in a transientResponseFailedwith waits [15, 45] and every attempt charged; the Responses reasons; and a scout keeping its places. The new cases fail on staging'sdottore_review.pyand on the first commit, and pass with the fix.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
completion_tokens=0; ... stop_reason=max_tokenscontinues with aDottore call retry: ... the gateway ended the reply at max_tokens before Claude wrote anythingline at the same effort instead of "reached its N-token output cap".review_spent_usdand the role'smodel_callsinclude those retried attempts.Agent-run checks (for reference):
node scripts/regressions/dottore-stream-progress.regression.mjs: passed (15 tests); on staging'sdottore_review.py5 failures, on the first commit 3 failures and 3 errors (copies restored,cmpidentical)node ./scripts/run-regressions.mjs --filter dottore: 8/8 passedpython3 -m py_compile .github/dottore-review/dottore_review.py: okgit diff --check: cleanrun_agent/chat/claude_replythrough stub streams: three empty replies record 3 calls and their prompt tokens; a scout tripped mid-run returns its kept placeIndependent adversarial review: changes (1 medium, 1 low), both fixed in
8e09386365. One part was kept as designed: an empty reply that fails every resend counts toward the role's failure breaker, which is the dead-endpoint case the breaker exists for; the harm the reviewer showed (a scout losing its kept places) is fixed. A suggestion to print prompt tokens on each retry line was not taken (diagnostics only; the error text already says no output was written).Known limits and risks:
output_tokens. A gateway that always reported 0 would turn a real cap into up to three same-effort resends instead of one lower-effort one; such a gateway already showscompletion_tokens=0and $0 on every call.output_tokensis the billed total.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.