Repository navigation
fix: keep rate-limit retries transient and prevent split chat replies - #139465
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: blocked before merge. Reviewed September 6, 2026, 3:18 AM ET / 07:18 UTC. ClawSweeper reviewWhat this changesThe PR keeps provider retries within one chat reply, defers failed-attempt text and diagnostics, preserves tool and media facts, and displays transient retry progress. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful work beyond current main. The prior budget, cancellation, and partial-content findings are addressed; inspected persistence and legacy-replay coverage also resolves the generic migration warning. No new blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe agent runner turns provider responses into stored conversation history and live Gateway events. The Gateway and shared client projection translate those events into Control UI replies and retry indicators. flowchart TD
A[Provider response or failure] --> B[Agent retry controller]
B --> C{Recover or finish}
C -->|Retry| D[Transient working status]
C -->|Finish| E[Logical run settlement]
E --> F[Conversation transcript]
D --> G[Gateway and client projection]
F --> G
G --> H[Control UI reply]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +220, Tests +1324, Docs +14, Other +4. Total +1562 across 74 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Mantis proof suggestionOptional web UI chat evidence would directly demonstrate the transient retry indicator and single recovered reply. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Technical reviewBest possible solution: Keep recovery under one logical-run owner, preserve durable tool/media facts, and publish only the final outcome through the existing transcript and Gateway contracts. Do we have a high-confidence way to reproduce the issue? Yes, from source: repeated transient provider failures exercise the existing immediate error persistence and terminal projection paths. The supplied regression coverage targets those boundaries; no runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. The patch repairs logical-run ownership and reuses canonical persistence and client projection rather than adding a competing recovery path; existing-row, legacy-history, and reopen coverage supports compatibility without a schema migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0c74e5e040d1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
40d21a1 to
6401907
Compare
6401907 to
a6b7f8d
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Persist failed-attempt facts before dependent results while deferring partial text and terminal diagnostics. Keep display overrides and code-source ownership consistent without duplicating tool facts or billing.
Reuse run-aware Gateway history recovery and consolidate its repeated-attempt coverage. Preserve oversized provider retry floors through error projection, keep non-rate retry status visible, and require newer run-event order before resuming terminal error projections.
Re-export the existing Gateway run-event normalizer and types through the public session projection module. Remove the redundant forwarding wrapper and fix test lint after the history recovery consolidation.
3ed3304 to
defbe03
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper approve |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Merged via squash.
|
…openclaw#139465) * fix: keep rate-limit retries transient in chat * fix(agents): retain tool and media facts across retries Persist failed-attempt facts before dependent results while deferring partial text and terminal diagnostics. Keep display overrides and code-source ownership consistent without duplicating tool facts or billing. * fix: preserve retry recovery ordering after rebase Reuse run-aware Gateway history recovery and consolidate its repeated-attempt coverage. Preserve oversized provider retry floors through error projection, keep non-rate retry status visible, and require newer run-event order before resuming terminal error projections. * refactor(client): keep run event normalization in its owner Re-export the existing Gateway run-event normalizer and types through the public session projection module. Remove the redundant forwarding wrapper and fix test lint after the history recovery consolidation.
…penclaw#141238) Honor the documented openclaw#139465 continuation budget for subscription limits. Keep rotation-only fixtures explicit about disabling transient retries. Proof: auth-profile rotation E2E (31), failover (881), retry owner (61), node scripts/check-changed.mjs, pnpm build; independent review clean.
What Problem This Solves
Transient provider failures could leave permanent assistant error rows and split a recovered Control UI reply into partial messages. This PR keeps recovery within one logical run while preserving tool calls and media needed by later transcript replay.
Why This Change Was Made
The logical-run owner buffers failed partial text and diagnostics, preserves tool/media facts through the canonical fenced append, and persists the final diagnostic only when recovery fails. Tool calls remain ordered before their results, successful recovery discards failed plain-text fragments, and terminal failure retains its last partial text without duplicating facts or usage.
Rate limits allow at most ten total attempts, honoring smaller explicit
retry.provider.maxRetriessettings. Other transient failures retain the existing eight-retry/90-second policy. Shared Retry-After parsing preserves SDK headers and the greatest valid timing floor; unrepresentable positive floors remain non-retryable through provider-error projection. Cancellation remains effective during long waits.Gateway sends transient working status instead of attempt terminals. Rate limits include bounded retry counters; overload, server-error, and timeout recovery retain ordinary working status. The client only reopens a diagnostic-only error after a strictly newer valid run-event sequence, so delayed, equal, or unsequenced deltas cannot erase a genuine terminal failure. Repeated terminals retain the latest ordering evidence.
The rebase reuses main's run-aware history recovery: attributed failures retire only after a successful answer from the same run. Main's newer replay fixtures, cleanup ownership, and widget-authoring parameter flow are retained. Duplicate history-state tests were consolidated into main's projection and SSE coverage. Stored transcripts are not rewritten.
User Impact
Recovered replies remain one reply, failed attempts do not leave stray text/error rows, and tools and attachments survive recovery and replay. Terminal errors remain visible when stale output arrives afterward.
The protocol addition remains optional:
state: "status"may carry aretryobject with integerattempt/maxAttemptsin 1–10 andreason: "rate_limit". Existing clients can continue showing ordinary working status. There is no configuration addition, SQLite schema change, or protocol version bump.Evidence
Current head:
defbe03b984aa4b3a1b5076def8a575de0e4d220, rebased onto main5579546f18c89b97d2fe3002cd7641504659eda4. The three functional commits were patch-identical across the final rebase (git range-diff); subsequent mechanical lint cleanup was reviewed separately. The PR remains open and unmerged.assistant-error-transcripttest selector was replaced by its existingsession-tool-result-guard.transcript-eventscoverage.git diff --checkpassed.The first rebase exposed main's stale history fixture at
session-history-state.test.ts:398. That unrelated failure was repaired independently by #139794; the final rebase includes its fix.LOC against
origin/main...HEADat the recorded base; production includes generated protocol and ratchet files:Existing synthetic UI evidence:
Release-note: Keep rate-limit retries transient, preserve tool/media facts across recovery, prevent split live replies, and hide recovered historical attempt errors.