Skip to content

fix(agents): preserve tool timeout outcomes - #180247

Merged
RomneyDa merged 1 commit into
mainfrom
fix/tool-timeout-recovery-checkpoint
Nov 2, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/tool-timeout-recovery-checkpoint

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Tool execution timeouts lose their phase during terminal settlement and can tell users to retry even though the tool's side effects are unknown.

Why This Change

  • Preserve tool_execution through canonical terminal normalization, runner error handling, and worker lifecycle validation.
  • Tell the user to inspect current state before repeating an operation whose outcome is unknown.
  • Keep main's current terminal-settlement behavior: continuation is ordinary new input, not automatic replay.

Rebase Scope

Rebased onto main 3523ef6747820e3253442a633dc09888c4cdf5fe. Main intentionally removed the restart-recovery/checkpoint system since this PR was opened. This revision retains the applicable timeout fix without restoring that system, its state fields, or replay restrictions. The older release line's checkpoint behavior is a separate backport concern.

Evidence

  • Exact rebased head: abad27a53ce6837e8067fba4f660a96d7630b6dc.
  • 142 tests passed across terminal outcomes, prompt failures, assistant failover, timeout handling, and worker admission schema.
  • Generated Gateway validator freshness check passed.
  • git diff --check passed.
  • All authored files are unchanged from the previously reviewed repair; the generated validator was verified against current main's generator.
  • Broad CI must run on this new head; prior-head results are not current-head CI evidence.

@clawsweeper

clawsweeper Bot commented Oct 22, 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 app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves tool-timeout attribution and saves durable checkpoints that require replay-safe continuation.

Example: The tool watchdog interrupts run tool-run in agent:main:main.

  • Before: Settlement loses the tool_execution phase and does not preserve a usable safe recovery checkpoint.
  • After: The session becomes interrupted, records the unknown outcome, and requires replay-safe tools even with Full Access.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, coherent fix with sufficient owner-boundary authority and compatibility evidence; confidence remains limited to harness receipts and incomplete CI.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (terminal): The unchanged production owners have supplied boundary receipts covering allowed inspection, rejected mutations and hook rewrites, foreign and revoked recovery callers, CLI refusal, and durable checkpoint reopening; maintainer authorship exempts ordinary shipped-entry-point proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A tool watchdog timeout can leave unfinished work without a safe resumable checkpoint despite unknown side effects.
Reason: The maintainer-authored direction addresses a concrete source failure and preserves the established ordinary-restart permission contract.

Merge readiness

✅ Ready for maintainer review

This PR provides a useful maintainer-authored recovery fix still absent from main; no actionable introduced bug was found, but restart-handoff CI remains unresolved.

Priority: P2
Reviewed head: 373522a663a6e4228e7e3fa67f17d8f14ca11f5b

Before merge

None.

Findings

None.

Agent review details

How this fits together

The terminal normalizer converts attempt results into lifecycle facts; the session writer persists recovery state, which startup and explicit recovery consume before dispatching another turn.

flowchart LR
  A[Tool watchdog] --> B[Terminal normalizer]
  B --> C[Session lifecycle writer]
  C --> D[SQLite recovery checkpoint]
  D --> E[Recovery dispatcher]
  E --> F[Replay-safe tool execution]
Loading

Technical review

Best possible solution:

Preserve timeout attribution and safe continuation through the existing terminal, lifecycle, and recovery owners while retaining ordinary restart permissions.

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

Current-main source drops tool_execution during canonical settlement, and the supplied persistence comparison reports the pre-fix failure; no target code was executed during this review.

Is this the best way to solve the issue?

The patch repairs the producer and existing recovery consumers together; the persisted safety flag distinguishes tool-timeout recovery from ordinary Full Access restart recovery without adding another owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Canonical terminal settlement keeps the original intent (61f036f: Centralize attempt outcomes and precedence in one normalization owner.)
  • Full Access recovery keeps the original intent (45ae22e: Allow ordinary Full Access restart continuation to inspect interrupted operations using fresh tools.)
  • Lifecycle persistence keeps the original intent (5b1d81e: Reduce lifecycle events against current stored rows through the existing worker operation.)
  • Claude runtime-input recognition keeps the original intent (667b2e5: Keep generated runtime prompts from appearing as user-authored messages.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 61f036f adds src/agents/agent-run-terminal-outcome.ts:605 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 61f036f74864; files: src/agents/agent-run-terminal-outcome.ts)
  • Vincent Koc: Raw commit 6b5fb4b adds src/agents/main-session-recovery/main-session-restart-recovery-store.ts:431 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 6b5fb4b23509; files: src/agents/main-session-recovery/main-session-restart-recovery-store.ts)
  • Marvinthebored: Raw commit 667b2e5 adds src/gateway/cli-session-history.claude.ts:382 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 667b2e519112; files: src/gateway/cli-session-history.claude.ts)

PR surface

Source +69, Tests +202. Total +271 across 30 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 11 96 27 +69
Tests 19 244 42 +202
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 30 340 69 +271

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs recovery after a tool watchdog timeout, with bounded impact on interrupted agent turns.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-22T03:35:41.917Z sha 11bae7f357039baff6bc80f9ad12389579989b41 :: blocked before merge. :: [P1] Preserve Full Access for ordinary restart recovery | [P2] Update affected consumers for the new timeout and prompt contracts
  • reviewed 2026-10-22T23:04:27.726Z sha c9e7f88 :: blocked before merge. :: [P1] Apply timeout safety to an existing recovery cycle
  • reviewed 2026-10-23T08:08:02.969Z sha 0f5042d :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-23T23:48:19.518Z sha 2e39d44 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-24T00:08:46.980Z sha 4cab71c :: needs maintainer review before merge. :: none
  • reviewed 2026-10-24T00:21:35.164Z sha 31cede2 :: needs maintainer review before merge. :: none

Reviewed October 23, 2026, 10:50 PM ET / October 24, 2026, 02:50 UTC (Revision 7).

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@RomneyDa
RomneyDa force-pushed the fix/tool-timeout-recovery-checkpoint branch from f84a9d3 to c9e7f88 Compare October 22, 2026 22:56
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

Exact-head CI follow-through for 31cede219c1b4:

  • Fixed the stale active-refresh fixture to prove the injection is accepted exactly once before dispatch completion, then expect the production terminal response after completion.
  • Removed an event-loop race in the abort-settlement fixture while retaining exact cardinality, live-signal, and no-dispatch assertions.
  • Allowlisted the scheduler canary model in the test fixture so current validation reaches the durable offline-scheduler behavior (same fixture correction as perf(cron): avoid roster allocation in availability checks #182002).

Validation:

  • progress-card active-refresh cases: 2 passed
  • accepted-injection abort case: 1 passed
  • focused scheduler E2E: 1 passed, 2 skipped
  • git diff --check: clean
  • independent P0-P3 review: no findings

These are test-only follow-through fixes for deterministic failures seen on the prior exact head; the Android SDK unzip failure remains infrastructure-only.

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@RomneyDa
RomneyDa force-pushed the fix/tool-timeout-recovery-checkpoint branch from 373522a to abad27a Compare October 29, 2026 18:39
@RomneyDa RomneyDa changed the title fix(agents): preserve tool timeout recovery checkpoints fix(agents): preserve tool timeout outcomes Oct 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S and removed size: M labels Oct 29, 2026
@RomneyDa
RomneyDa merged commit 054516f into main Nov 2, 2026
211 of 215 checks passed
@RomneyDa
RomneyDa deleted the fix/tool-timeout-recovery-checkpoint branch November 2, 2026 22:21
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
tideclaw-bot pushed a commit that referenced this pull request Nov 4, 2026
Required coverage: #189395, #187875, #186976, #182429, #184434, and remaining #180247.
Preserve stable transport and terminal-settlement owners. Include #190695 sampling parity and only the required symbol/export prerequisites. No broad Gemini transport cutover.

Source commits:
d6a1327
fe0f8d1
cd486ed
e72b356
807075d
28f5f25
ab7631a
9346376
054516f

Proof: 216 focused tests passed; dedicated pre-fix regressions failed. Scoped typechecks/lint/format passed. Fresh independent P0-P2 review clean. Live provider/native qualification remains pending.

Co-authored-by: Yiğit ERDOĞAN <[email protected]>
Co-authored-by: evomach <[email protected]>
Co-authored-by: Sasan <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: goslingmanagment <[email protected]>
Co-authored-by: Dmitriy <[email protected]>
Co-authored-by: Sukhdeep Johar <[email protected]>
Co-authored-by: Dallin Romney <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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