Repository navigation
fix(agents): treat observed CLI activity as replay-unsafe for whole-turn retries - #122153
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 1:01 PM ET / 17:01 UTC. ClawSweeper reviewWhat this changesThe PR makes a CLI timeout that reports observed activity unsafe for outer whole-turn retries, so OpenClaw returns existing partial-effects guidance instead of replaying the turn. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. This maintainer PR fixes a source-proven whole-turn retry path that can replay a CLI timeout after observed activity; current main lacks the typed-fact guard. No blocking patch defect found, but exact-head CI and acceptance of the deliberately more conservative recovery behavior remain before merge. Priority: P1 Review scores
Verification
How this fits togetherAgent reply execution selects a model or CLI candidate and handles terminal failures. The CLI runner records timeout activity facts, and the reply error handler decides whether a whole turn may be retried or must surface a final failure. flowchart LR
A[Incoming agent turn] --> B[Model or CLI candidate]
B --> C[CLI timeout activity fact]
B --> D[Execution phase callback]
C --> E[Reply error handler]
D --> E
E --> F{Safe to replay?}
F -->|yes| G[Whole-turn retry]
F -->|no| H[Partial-effects guidance]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +5, Tests 0. Total +5 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the typed timeout check at the shared outer-retry owner, retain the phase callback for its independent activity signals, and land after exact-head CI confirms the conservative no-replay policy. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the focused pre-change scenario creates an observed CLI timeout without an execution-phase mark and demonstrates the current transient whole-turn replay path. Is this the best way to solve the issue? Yes. The reply error handler owns both outer retry gates, while the CLI boundary owns the typed activity fact; using the existing recursive timeout finder preserves that fact through fallback wrappers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 82ba647673f9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where a CLI-backed agent turn that timed out after observable activity could be replayed automatically when no execution phase mark arrived, potentially duplicating side effects.
Why This Change Was Made
The reply layer now consumes the typed
cliTimeout.observedActivityfact recorded at the CLI boundary and marks the shared whole-turn retry state unsafe. Both outer retry gates—overload recovery and the one-shot transient retry—already consume that state; active-tool and background-task counts remain diagnostic only.The only phase-mark consumer for these whole-turn gates is the shared execution-phase callback. Model-candidate fallback uses a separate delivery-evidence decision and does not consult this phase-mark state, so it is not part of this frozen outer-retry behavior change.
User Impact
CLI timeouts after observed activity now surface the existing partial-effects guidance without replaying the whole turn. Release-note context: prevents duplicate side effects after CLI timeouts.
Evidence
node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-execution-provider-failures.test.ts— 75 passed.node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-execution-terminal-failures.test.ts— 20 passed.node scripts/check-changed.mjs— passed thecoreandcoreTestslanes via its documented local fallback.oxfmt --checkandgit diff --check— passed.092f1c35b2ad636c23cdc35a36b325a28f3f91b7— green: https://github.com/openclaw/openclaw/actions/runs/31514961935The requested directory-wide
src/auto-replyrun was attempted locally, but the shared host produced unrelated multi-minute timeouts and cross-suite state fallout; that run was stopped after 30 minutes and is not claimed as proof. Exact-head PR CI is green and is the canonical isolated broad validation.