Repository navigation
fix(ai): avoid retrying conflicting Responses terminal statuses - #149242
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
107e19d to
b1f0370
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 6:30 AM ET / 10:30 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR preserves the interpreted Responses terminal status so contradictory completion signals cannot trigger output-limit retries, and updates recovery regression coverage. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main and the latest release. The prior fixture finding is resolved, and this review found no remaining actionable correctness or security defects. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s Responses transport converts provider events into assistant messages and terminal diagnostics. Agent execution and session recovery use those facts to decide whether to settle tools and continue sampling. flowchart TD
A[Provider response events] --> B[Interpret terminal status]
B --> C[Record terminal facts]
C --> D[Validate tool completion]
D --> E{Coherent output limit?}
E -->|Yes| F[Settle tools and bounded continuation]
E -->|No| G[Normal terminal error handling]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +4, Tests +56. Total +60 across 9 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep terminal-status interpretation in the existing transport owner and use its recorded result consistently for bounded recovery. Do we have a high-confidence way to reproduce the issue? Yes, from source: an unfinished tool followed by response.incomplete/max_output_tokens and an explicit conflicting status still satisfies main’s recovery predicate. The PR supplies matching regression cases; this review did not execute them. Is this the best way to solve the issue? Yes. Recording the existing canonical interpretation before tool validation and checking it in the shared predicate is a narrow repair that preserves omitted-status compatibility. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 71382da0c9f9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Keep the canonical terminal stop reason before incomplete-tool validation overwrites the message error. Require coherent output-limit evidence for continuation and preserve status-absent compatibility. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: Dallin Romney <[email protected]>
OpenClaw-Publication: 856c94de-d066-44dc-9f3f-b929b908bbec Co-authored-by: RomneyDa <[email protected]> Co-authored-by: Dallin Romney <[email protected]>
b1f0370 to
0f46e6e
Compare
|
@clawsweeper re-review Rebased onto current main and resolved the session regression-table conflict while preserving both landed identity-conflict coverage and the terminal-status cases. Production fix unchanged; fresh focused proof: 139 passing tests, independent autoreview P0–P2 scoped-clean. Updated details are in the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Addressed the accepted P2 in |
|
🦞👀 Re-review progress:
|
Preserve the canonical length stop in positive output-limit fixtures and keep negative event/reason cases otherwise coherent. This repairs the five failures reproduced through recoverEmbeddedRunAttempt after the main refresh. Co-authored-by: Dallin Romney <[email protected]> Co-authored-by: RomneyDa <[email protected]>
78ac61b to
ebd1905
Compare
|
@clawsweeper re-review Finalized the accepted fixture repair in |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
* commit '0883394977d1fb3af657635967f6e447bd7fff9a': (72 commits) fix(ui): await scheduled rail layout in focus test fix(cron): keep healthy active runs from delaying job lists (#154421) fix(plugins): prevent config conflicts during legacy plugin installation (#154539) perf(gateway): reduce repeated session-list work (#154551) fix(tasks): retain admitted work across list retries (#154338) perf(gateway): speed up transcript artifact downloads (#154726) chore(ui): refresh control ui locales (#154580) fix(release): keep two extended-stable months eligible (#154777) fix(tests): avoid avatar descriptor reuse race (#154747) perf(plugins): reduce callback scope overhead (#154625) fix(ui): include final request time in completed work summaries (#149240) fix(ai): avoid retrying conflicting Responses terminal statuses (#149242) fix: identify malformed Code Mode JavaScript as input errors (#149222) fix(doctor): settle imported JSONL transcript leftovers (#154413) fix(cloud): restore node bootstrap with bundled browser runtime (#154654) test(ui): await publication state notifications (#154768) fix(plugins): keep unchanged plugins running across metadata refreshes (#151281) fix: keep chat panel accessibility targets within each pane (#153478) fix: forced Gateway restarts cancel healthy subagent work (#154300) improve: reduce session delivery reader imports (#154740) ...
…claw#149242) * fix(ai): avoid retrying conflicting Responses terminal statuses Keep the canonical terminal stop reason before incomplete-tool validation overwrites the message error. Require coherent output-limit evidence for continuation and preserve status-absent compatibility. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: Dallin Romney <[email protected]> * fix(ai): avoid retrying conflicting Responses terminal statuses OpenClaw-Publication: 856c94de-d066-44dc-9f3f-b929b908bbec Co-authored-by: RomneyDa <[email protected]> Co-authored-by: Dallin Romney <[email protected]> * test(agents): align output-limit recovery fixtures with terminal facts Preserve the canonical length stop in positive output-limit fixtures and keep negative event/reason cases otherwise coherent. This repairs the five failures reproduced through recoverEmbeddedRunAttempt after the main refresh. Co-authored-by: Dallin Romney <[email protected]> Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: Dallin Romney <[email protected]>
What Problem This Solves
Fixes: Responses sessions start an output-limit continuation when an unfinished tool call is followed by
response.incompleteandmax_output_tokens, even though the response explicitly says it completed, failed, or was cancelled.User Impact
Sessions no longer make an unnecessary continuation request for contradictory terminal statuses. Genuine output-limit recovery still preserves settled tool results without repeating work, including compatible endpoints that omit
response.status. No configuration or migration is required.Why This Change Was Made
Retain the canonical terminal stop reason before tool validation replaces the message-level reason with an error, and require that recorded reason to be
lengthalongside the existing incomplete-event and output-token-limit evidence. Tool settlement, session retry, and embedded recovery consume the same predicate. Refusal and cancellation precedence remain unchanged; partial arguments never become executable.Related: #149071. This independent main-targeted fix does not include or depend on that PR’s earlier validation/drain change.
Evidence
AgentSession.promptcases failed before the fix and passed afterward.be3d22b1745917a2c03a1adb999ed51960a3c275. Resolved the session-table conflict by preserving all landed identity-conflict cases alongside the terminal-status matrix. Range-diff confirms the four-line production change is unchanged; no unrelated CI patches or other PR features were added.NO_PROXY=127.0.0.1,localhostfor fixture servers. The original seven-file run took 37.69 seconds; the newly covered embedded-recovery suite passed all 89 tests. Per-file single-worker costs are recorded below.git diff --checkpassed. The eight-file changed-check pass and incremental recovery-fixture pass both succeeded, covering all nine changed files.outputLimitDetailsfixture with the producer’sstopReason: "length"and kept negative event/reason cases otherwise coherent. Reproduced five failures locally and in the previous CI job; all 89 embedded-recovery tests pass after the repair. Retry budgets and production recovery logic are unchanged.ebd190517738e135f291cdcc6a71fc4020aa573a. Exact-head CI succeeded, includingopenclaw/ci-gate; the repository watcher reported GREEN. ClawSweeper rated this head platinum hermit (4/6) with the prior P2 resolved and no remaining actionable findings.Response.statusis optional and explicit statuses remain authoritative. No authenticated live-provider testing is claimed.Per-file test cost
Each listed file was run separately with
NO_PROXY=127.0.0.1,localhost node scripts/run-vitest.mjs <file> --maxWorkers=1, measured by/usr/bin/time. Wall time includes runner startup and uses the existing compiler cache; no new Gateway boots or sleeps were introduced. CI seconds below sum reported passing-case durations from successful run35585345477; they exclude job setup and are not whole-job wall times.packages/agent-core/src/agent-loop.async-tools.test.tspackages/agent-core/src/agent-loop.responses-continuation.test.tspackages/ai/src/providers/openai-chatgpt-responses.cache.test.tspackages/ai/src/transports/openai-responses-client.terminal-error.test.tssrc/agents/embedded-agent-runner/run/attempt-execution-phase.test.tssrc/agents/sessions/agent-session-responses-eof.test.tssrc/agents/embedded-agent-runner/run/attempt-recovery.test.tsWorked on by: @RomneyDa
Work sessions