Repository navigation
fix(agents): resume output-limited tool calls without repeating work - #148440
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 4:49 PM ET / 20:49 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR lets output-limited OpenAI Responses requests continue from settled tool results, preserves cancellation and retry accounting, and adds regression coverage and documentation. Merge readiness✅ Ready for maintainer review The fix remains necessary: current main and the latest release lack this recovery classification. No actionable correctness or security defect was found in the introduced changes; this maintainer-authored PR should remain open for normal landing. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s built-in agent loop turns model responses into tool executions and recorded results. The session recovery owner uses those results to continue an interrupted task without replaying the original request. flowchart TD
A[Model response stream] --> B{Output limit interrupts a tool call?}
B -->|Yes| C[Settle admitted tools]
C --> D[Record results and terminal usage]
D --> E{Cancelled or intentionally stopped?}
E -->|Yes| F[End run]
E -->|No| G[Bounded session retry]
G --> A
B -->|Other failure| F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +51, Tests +374, Docs +6. Total +431 across 14 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep bounded continuation in the session owner, preserving settled results, durable failure history, cancellation, and existing tool admission checks. Do we have a high-confidence way to reproduce the issue? Yes, from source: an incomplete-tool terminal caused by max_output_tokens bypasses current main’s session retry classifier. The regression fixtures model that path; this review did not execute it. Is this the best way to solve the issue? Yes. Reusing session continuation preserves completed work without adding another retry owner or weakening the outer replay guard. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5d461f09667b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
e963845 to
41ddd2a
Compare
Continue from settled tool results after output-limit truncation while preserving cancellation, intentional tool termination, and bounded retries. Retain the provider incomplete reason and reset retries only after a complete response.
…overy Persist the original output-limit terminal once after admitted tools settle, and keep cancellation ahead of critical tool-loop termination. Preserve the existing usage assertions and cover both event and result completion. Isolate the memory queue rejection fixture from background startup catchup so its controlled sync mocks cannot be consumed by unrelated work.
a6cb27a to
b401f47
Compare
|
Merged via squash.
|
…penclaw#148440) * fix(agents): resume output-limited tool calls without repeating work Continue from settled tool results after output-limit truncation while preserving cancellation, intentional tool termination, and bounded retries. Retain the provider incomplete reason and reset retries only after a complete response. * fix(agents): preserve terminal accounting and cancellation during recovery Persist the original output-limit terminal once after admitted tools settle, and keep cancellation ahead of critical tool-loop termination. Preserve the existing usage assertions and cover both event and result completion. Isolate the memory queue rejection fixture from background startup catchup so its controlled sync mocks cannot be consumed by unrelated work.
What Problem This Solves
Fixes tasks stopping with an unfinished-tool-call error when an OpenAI Responses request reaches its output limit, even though completed work can be retained.
User Impact
Tasks continue from completed tool results within the existing retry budget. The truncated call never executes. Stop, provider refusals, and intentional tool termination still prevent continuation. No configuration or migration is required.
Why This Change Was Made
The session already owns continuation, but output-limit failures bypassed it and reached the guard against replaying an entire attempt. This change reuses session continuation after admitted tools settle, preserving their results and the original failure in durable history. The provider's bounded incomplete reason distinguishes this case from refusals and inconsistent terminal responses.
Cancellation and tool outcomes take precedence over recovery. The original usage-bearing terminal is recorded once, and retry accounting resets only when a response completes, so streamed tool fragments cannot reset the budget. The outer replay guard remains unchanged.
Evidence
git range-diff.b401f47679e38d251eba8343121ef7edab4feed4. Its first attempt rejected an unchanged plugin-inspection fixture's config before inspection. The single failed-shard rerun passed on Ubuntu under existing workflow policy; the original Blacksmith rejection remains unexplained. Test assertions, setup, timeouts, and retry policy were unchanged. The original failure and independent controls are retained separately.867e655d51d892c47ee68fc7f02c7e8ca0a5628d, before the final rebase.