Skip to content

refactor: simplify model retry recovery decisions - #151995

Merged
steipete merged 1 commit into
mainfrom
codex/retry-owner-cleanup
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/retry-owner-cleanup

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Related: #151610

What Problem This Solves

Simplifies the model retry code after the recovery-window fix, removing duplicated decisions and stale explanations that make retry ownership harder to review.

User Impact

No user-visible behavior change. Retry budgets, provider wait floors, cancellation, transcript continuation, auth rotation, and native-harness retry policies remain unchanged. No configuration or migration is required.

Why This Change Was Made

The retry classifier now derives transient evidence from its own input instead of accepting a separately computed boolean. Embedded recovery shares repeated tool-continuation predicates and completed-response selection; the run loop records normalized state once for both retry and proceed paths. Removes an unnecessary cast and stale comments, with an exact shrink of its assertion baseline. Net reduction: 42 lines across nine source files and one baseline entry.

This is the maintainer-requested cleanup following #151610. The broader audit separately reproduced text retry-hint parsing gaps and Bedrock's default SDK retry envelope; those functional findings are outside this behavior-preserving PR.

Evidence

All 1,474 selected tests passed across eight files covering classification, recovery, retry budgets, incomplete turns, and model-response completion. The complete changed-file gate passed, including production/test typechecking, lint, formatting, dead-export scans, and architecture guards. Independent review through P2 found no actionable defect in the cleanup. Exact-head CI run 35374858305 passed, including openclaw/ci-gate. ClawSweeper also reviewed the exact head with no actionable findings. No live Gateway was modified or deployed.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 17:31
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 2:07 PM ET / 18:07 UTC (Revision 3).

ClawSweeper review

What this changes

Consolidates model retry classification, continuation checks, and attempt-state updates while removing redundant comments and an unnecessary type assertion.

Merge readiness

✅ Ready for maintainer review

Keep open as a useful, maintainer-requested cleanup. The pinned patch preserves retry behavior, has passing exact-head CI, and introduces no actionable findings; current main does not contain the cleanup.

Priority: P3
Reviewed head: e26b721d69341291a788ec1be2fd1568108336a7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, behavior-preserving cleanup with relevant existing coverage, successful exact-head CI, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal cleanup is exempt from external-contributor runtime proof; its embedded recovery and session classifier changes preserve behavior, with exact-head CI as supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored internal cleanup is exempt from external-contributor runtime proof; its embedded recovery and session classifier changes preserve behavior, with exact-head CI as supplemental validation.
Evidence reviewed 8 items Continuation predicates preserve existing gates: The shared predicate combines the same intentional-termination, asynchronous-work, and approval checks. Completed-response selection preserves precedence, and its declared type excludes null. The asynchronous-work helper is a pure array predicate.
Internal classifier cutover is complete: The sole caller now passes the same signal directly to the retry owner, which computes transient evidence internally. Repository search found no remaining caller of the removed export or old boolean parameter; this is not a plugin API change.
Existing regression coverage: Inspected coverage exercises completed-response precedence, settled-tool continuation, output-limit budgets, pending approvals, asynchronous work, cancellation, and overflow rejection. Tests were inspected but not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

OpenClaw's embedded agent runner consumes model responses and tool-completion evidence to decide whether to continue the transcript, retry, or finish. Its recovery checks preserve completed work and enforce cancellation and retry limits.

flowchart TD
  A[Model response or failure] --> C[Retry classification]
  B[Tool completion evidence] --> D[Continuation safety checks]
  C --> D
  D --> E[Retry budget and cancellation]
  E --> F[Continue existing transcript]
  E --> G[Finish or consider fallback]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -42, Other 0. Total -42 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 9 26 68 -42
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 10 27 69 -42

Review metrics

None.

Technical review

Best possible solution:

Keep retry decisions with their existing owners and retain the current recovery safeguards without adding configuration or parallel policy.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR proposes behavior-preserving cleanup rather than a new bug fix; source inspection found equivalent decisions and existing regression coverage.

Is this the best way to solve the issue?

Yes. Deriving retry evidence inside its owner and sharing identical predicates removes duplication without introducing another recovery path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cfc9723a15fc.

Labels

Label justifications:

  • P3: This is bounded internal cleanup with no intended user-visible behavior, configuration, or migration change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored internal cleanup is exempt from external-contributor runtime proof; its embedded recovery and session classifier changes preserve behavior, with exact-head CI as supplemental validation.

Evidence

What I checked:

  • Continuation predicates preserve existing gates: The shared predicate combines the same intentional-termination, asynchronous-work, and approval checks. Completed-response selection preserves precedence, and its declared type excludes null. The asynchronous-work helper is a pure array predicate. (src/agents/embedded-agent-runner/run/attempt-recovery.ts:120, e26b721d6934)
  • Internal classifier cutover is complete: The sole caller now passes the same signal directly to the retry owner, which computes transient evidence internally. Repository search found no remaining caller of the removed export or old boolean parameter; this is not a plugin API change. (src/agents/failover/retry-evidence.ts:163, e26b721d6934)
  • Existing regression coverage: Inspected coverage exercises completed-response precedence, settled-tool continuation, output-limit budgets, pending approvals, asynchronous work, cancellation, and overflow rejection. Tests were inspected but not executed during this read-only review. (src/agents/embedded-agent-runner/run/attempt-recovery.test.ts:95, e26b721d6934)
  • Exact-head validation: GitHub confirms workflow run 35374858305 completed successfully on the pinned head. The supplied body reports 1,474 selected tests and the changed-file gate passing; those local results were not independently rerun. The read-only diff whitespace check also passed. (e26b721d6934)
  • Cleanup remains absent from current main: Fetched main still computes hasTransientEvidence in the caller and passes it separately. The same caller shape exists in latest release v2026.9.4; the proposed consolidation remains distinct work. (src/llm/utils/retry.ts:53, cfc9723a15fc)
  • Latest-release comparison: The latest supplied release retains the separate transient-evidence calculation; it does not contain this cleanup. (src/llm/utils/retry.ts:53, 3a9d69db306c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Mitchell Etzel: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-18T17:31:20.903Z sha e26b721 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-18T17:38:07.161Z sha e26b721 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@steipete
steipete merged commit 44e8f24 into main Sep 18, 2026
284 checks passed
@steipete
steipete deleted the codex/retry-owner-cleanup branch September 18, 2026 18:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant