Repository navigation
fix: resume tasks after tools finish and the model times out - #147203
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 13, 2026, 1:39 PM ET / 17:39 UTC (Revision 3). ClawSweeper reviewWhat this changesThe embedded agent resumes unfinished tasks after settled tools and a model idle timeout, with regression coverage, retry documentation, and an awaited Workboard test cleanup. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and v2026.9.4 retain the idle-timeout exclusion, and the related summary-recovery fix addresses a different outcome. No actionable correctness or security findings remain. Priority: P2 Review scores
Verification
How this fits togetherThe embedded agent runner coordinates model requests, tool execution, and recovery within an admitted task. Recovery consumes recorded tool results and timeout facts to choose another attempt or a terminal response. flowchart TD
A[User task] --> B[Model and tool execution]
B --> C[Recorded results and idle timeout]
C --> D{Tools settled and recovery allowed?}
D -->|Yes| E[Existing bounded retry controller]
E --> F[Continue transcript with tools available]
D -->|No| G[Existing terminal handling]
F --> B
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +10, Tests +85, Docs +2. Total +97 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep settled idle-timeout continuation in the existing recovery owner, preserving transcript results, bounded retries, and the same admitted run. Do we have a high-confidence way to reproduce the issue? Yes, from source: a settled side-effecting tool batch followed by a prompt idle timeout fails main's replay-safe continuation gate and reaches tools-disabled finalization. The submitted baseline-failing regressions support this path; no runtime reproduction was executed here. Is this the best way to solve the issue? Yes. The patch narrowly extends the existing transcript-continuation mechanism while retaining settlement, cancellation, harness ownership, and retry-budget checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f96fed1a7cc0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Updated head: The first CI run found a missing @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* commit '201f11afefdb19a9c75e9d3542bf7425c80df7a7': (141 commits) fix: keep catalog discovery scoped and execution lazy (#147159) fix: serialize reclamation worker shutdown with foreground writes (#147178) test(sessions): cover abrupt committed transcript recovery (#143984) fix: stop transcript storms during context overflow recovery (#147202) fix: reduce CPU overhead for small history and usage reads (#147205) fix: resume tasks after tools finish and the model times out (#147203) refactor(scripts): share SQLite reliability message waits (#146900) feat(exec): configure approval reviewer thinking and fastMode (#147192) test: remove redundant Bonjour module headers (#146981) refactor: share streaming media tail boundary update (#146989) refactor(tui): classify resume candidates once (#146983) improve: skip unused toast dismissal work (#147196) fix(linux): recover saved remote connections without replacing active sessions (#146047) fix: doctor stays silent when Windows state dir is under OneDrive (#123720) feat: announce successful Daybreak retries (#147146) feat(code-mode): reuse results across code cells (#147154) refactor(test): reuse CLI plugin fixture writer (#147186) test: skip unused compiler setup in routing fixtures (#147194) test: reuse LINE webhook runtime fixture (#146710) fix(code-mode): check automation and process result types (#147143) ...
* commit '2d87daf04b78992382299d552f15ac84a86a23ed': (1815 commits) fix(ui): distinguish tool activity with semantic icons (#147207) fix(linux): recover completed Quick Chat replies without resending (#146048) feat(desktop): unify Tauri title bar and window controls (#147097) refactor(test): share plugin fixture server shims (#147225) perf(gateway): defer worker workspace execution imports (#143496) fix(gateway): post-ack webhook work fails with "Async work scope is closed" (#144801) refactor(scripts): centralize upgrade survivor version floors (#146975) fix(ci): check publication registries before FRV fanout (#147184) fix(qa): align system-agent delegation with channel contracts (#145905) improve: reduce repeated chat message identity work (#147210) fix(channels): remove stale pre-tool previews from Slack and Telegram (#147106) fix: keep catalog discovery scoped and execution lazy (#147159) fix: serialize reclamation worker shutdown with foreground writes (#147178) test(sessions): cover abrupt committed transcript recovery (#143984) fix: stop transcript storms during context overflow recovery (#147202) fix: reduce CPU overhead for small history and usage reads (#147205) fix: resume tasks after tools finish and the model times out (#147203) refactor(scripts): share SQLite reliability message waits (#146900) feat(exec): configure approval reviewer thinking and fastMode (#147192) test: remove redundant Bonjour module headers (#146981) ...
…w#147203) Co-authored-by: VACInc <[email protected]>
Summary
High Level TLDR
An embedded task could stop with a progress summary when the model idled out after finishing tool calls. Resume from the recorded results with tools available, preserving completed work and the existing retry limits.
What Problem This Solves
Fixes unfinished tasks requiring another user message to continue after a model idle timeout following settled tool activity.
User Impact
The agent can continue the remaining work, including investigating a recorded tool failure. Cancellation, pending approval, unfinished or asynchronous tools, deliberate tool termination, native harness ownership, and run/retry limits keep their existing boundaries. No configuration or migration is required.
Why This Change Was Made
The existing transient recovery owner already resumes the saved transcript without resubmitting the original request. Allow that path for an embedded prompt idle timeout when the latest tool batch has matching recorded results and every lifecycle item has settled. Keep the original-prompt replay and model-switch gates unchanged.
Root Cause
Observed attempts had an idle timeout after all tool calls finished, with no external cancellation or tool/compaction/run-budget timeout.
recoverEmbeddedRunAttemptrejected continuation because side effects madecurrentAttemptReplaySafefalse. Recovery then selectedsettled-tool-finalization, which disables tools and returns a summary as a successful result despite unfinished work.This completes the no-replay repair introduced in #122516 (August 12): that PR explicitly introduced and tested summary-only finalization for this case. #130721 (August 27) restored recorded-transcript continuation after transport drops, and #139397 (September 5) generalized transient recovery; both retained the idle-timeout exclusion. The earlier implementation did not establish safe continuation either, so this is a missing recovery path left by those repairs.
Related #141072 addresses reporting when summary recovery is empty or fails. This change instead restores task continuation before summary-only recovery is reached.
CI integration repair
The first hosted run tested the PR merged with
1d879559c3b7and caught an unrelated missingawaitin the Workboard concurrent attachment-deletion test added on main after this branch started. The branch now includes that same upstream base and awaits the existing asyncharness.close()before its test returns. This is a one-line test cleanup repair; the continuation implementation is unchanged. Original failing lint job.Evidence
Real behavior proof
The closest feasible deterministic proof runs the public
runEmbeddedAgententry point with synthetic attempt results and isolated test state. The fixture requests a write followed by verification, records the completed write, then injects a prompt idle timeout. It checks the next attempt's actual dispatch parameters and returned payload.4b2b59362dec62f34576812124249389c42d9651: the embedded regression fails because the next prompt says, “Tools are unavailable in this step”; the native harness control passes.action: proceedand pass after the patch withaction: retry, for both successful and failed settled tool results. Missing results, active lifecycle items, async work, deliberate termination, approval, yielding, native transport ownership, and timeout/budget exclusions are covered.Verification
Linux x64, Node 24.19.0. Commands run in an isolated worktree:
extensions/workboard/src/store.test.tspassed.7a8fb93f3a2: exact-head run.7a8fb93f3a2: no correctness/security findings; ready for maintainer review with no requested changes.Repeatable recovery-owner microbenchmark
Same existing
recoverAfterTransportDropfixture, with a settled side-effecting batch and{ kind: "timeout", phase: "prompt", source: "idle" }. Run 100 warmups and 1,000 fresh-controller samples per revision, using the baseline production owner and then the patched owner with the same test fixture. Provider calls and backoff are stubbed; this measures recovery routing/fixture overhead, not model latency or tool execution.7a8fb93f3a2Reproduce in an isolated checkout by generating this temporary test beside
attempt-recovery.test.ts, keeping that file's imports and fixture definitions before its top-leveldescribe("recoverEmbeddedRunAttempt", ...), followed by:Run
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-recovery-benchmark.test.ts --reporter=dotfor each production revision. Remove only the generated test afterward. No benchmark-only production seam or test configuration is added.What was not tested
No live provider, Telegram, or physical-device execution was performed with the patch, and it has not been deployed. The integration fixture injects attempt results; it does not prove a model will choose the intended next tool. This PR does not change normal model final responses or fix the separate synchronous transcript-rewrite starvation tracked in #119720.