Skip to content

fix: preserve execution budgets and late task replies - #148508

Merged
steipete merged 1 commit into
mainfrom
codex/fix-timeout-ownership
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-timeout-ownership

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #148388, #148450

What Problem This Solves

Long-running work can be cut short, lose its configured budget after resuming, or lose its late reply when a shorter startup, monitoring, or wait timeout expires.

User Impact

ACP turns and approved command continuations keep their execution budgets. Recovered and resumed children retain their saved timeout, including explicit zero. Background-task reviews use the ordinary agent budget. Late session replies remain observable, and long node operations receive enough time at both invocation and transport layers. Explicit shorter overrides and cancellation remain effective; no configuration changes are required.

Why This Change Was Made

Execution deadlines belong to the run owner. The patch removes ACPX's duplicate turn timers and the fixed approval-continuation limit, carries saved child budgets through recovery and both descendant-resume paths, and derives heartbeat policy from the events actually included in the turn.

Node operations reuse one timeout calculation with transport grace. A2A observers reuse the run-wait owner through nonterminal snapshots while foreground waits stay bounded. Terminal timeout classification is shared; observers stop on terminal results, transport failure, or Gateway lifecycle cancellation. Observation remains in memory and does not provide delivery across a Gateway restart.

Evidence

  • Reproduced all six defects by running the new regressions against the original production code.
  • 1,140 distinct tests passed across 17 focused and sibling files, including ACP startup/cancellation, approval continuations, child recovery and resume, heartbeat coalescing/isolation, late A2A replies, node overrides, and E2E announcement delivery.
  • Full source build, runtime postbuild validation, and independent Codex review through P2 passed.
  • Repaired one inherited announcement-test assertion tied to retired heading formatting; it now verifies that the current child result is emitted exactly once.
  • Complete changed-file checks passed: production/test types, lint, formatting, plugin/config contracts, dead exports, import cycles, and runtime guards. After final fixture cleanup, all 186 affected tests passed again and fresh independent review remained clean through P2.
  • Hosted CI exposed two inherited main regressions: a Radius plugin import in the core test graph and a wizard recovery test routed away from its required host broker. Both are fixed on main by test: route provider integration and wizard recovery tests correctly #148504. The temporary copy of the Radius repair has been dropped, leaving only the original 38-file timeout patch. The timeout commit remains patch-identical across both rebases. All 23 relevant integration/boundary tests pass on the corrected base.
  • Exact-head CI passed on 7d0502350cf6002caecc7eb2f660990f6f4dab32, with 144 successful GitHub checks. Native prepare and merge verified that same head; landed commit. No live Gateway was modified or restarted.

@steipete steipete self-assigned this Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 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.

@steipete
steipete marked this pull request as ready for review September 14, 2026 20:09
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling extensions: acpx plugin: linux-node size: XL maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 5:13 PM ET / 21:13 UTC (Revision 3).

ClawSweeper review

What this changes

Preserves configured execution limits across agent continuations and recovery, keeps observing late replies, and aligns node-operation and transport timeouts.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main retains the timeout and late-reply defects, and the related merged work does not replace these repairs. No actionable introduced correctness or security defect was found.

Priority: P1
Reviewed head: 7d0502350cf6002caecc7eb2f660990f6f4dab32

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent owner-level repair with useful regression coverage and no actionable introduced defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Supplied evidence covers timeout-owner regressions and boundary tests; it does not claim a live Gateway run.
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 PR is exempt from the external-contributor proof gate. Supplied evidence covers timeout-owner regressions and boundary tests; it does not claim a live Gateway run.
Evidence reviewed 9 items Pinned patch and clean checkout: The original head records the pinned base as its parent. The test merge records that base followed by the exact head. The introduced diff passed whitespace checking, and the checkout remained clean.
Completion observation retains lifecycle cancellation: The shared observer repeats nonterminal waits, stops on terminal outcomes or transport failure, and observes work-scope cancellation and Gateway draining. Only detached A2A and nested-step callers enable completion observation; the foreground sessions-send wait remains bounded.
Existing ACP execution owner remains responsible: The plugin removes its duplicate reply-dispatch timers. OpenClaw's ACP turn manager still resolves configured execution deadlines and cancels timed-out turns; the hook continues passing caller cancellation. This changes OpenClaw-owned dispatch glue without changing a Codex harness contract.
Findings None None.
Security None None.

How this fits together

OpenClaw's agent runtime receives commands, background-task events, and delegated results through the Gateway. Execution owners set run deadlines, while observers wait for completion and route results back to conversations.

flowchart TD
  A[Commands and task events] --> B[Gateway admission]
  C[Configured or saved budgets] --> D[Agent execution]
  B --> D
  D --> E[Completion observer]
  E --> F{Terminal result or cancellation}
  F -->|Still pending| E
  F -->|Completed| G[Conversation reply]
  F -->|Cancelled| H[Stop observation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +50, Tests +244, Docs +14. Total +308 across 38 files.

View PR surface stats
Area Files Added Removed Net
Source 19 140 90 +50
Tests 12 664 420 +244
Docs 7 15 1 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 38 819 511 +308

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +50 lines; tests net +244 lines Production growth supports shared completion observation and timeout calculation, with regressions covering the repaired lifecycle paths.

Technical review

Best possible solution:

Keep execution deadlines with the existing run owners and let completion observers retain late results without changing explicit limits or cancellation.

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

Yes, from source: current main imposes shorter wrapper deadlines and stops reply observation after one wait. Focused regressions exercise those paths, but this review did not execute them.

Is this the best way to solve the issue?

Yes. The patch reuses existing execution and observation owners, preserves explicit overrides, and avoids new configuration or persistent state.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Premature deadlines and discarded late replies interrupt ongoing agent workflows.
  • 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 PR is exempt from the external-contributor proof gate. Supplied evidence covers timeout-owner regressions and boundary tests; it does not claim a live Gateway run.

Evidence

What I checked:

  • Pinned patch and clean checkout: The original head records the pinned base as its parent. The test merge records that base followed by the exact head. The introduced diff passed whitespace checking, and the checkout remained clean. (7d0502350cf6)
  • Completion observation retains lifecycle cancellation: The shared observer repeats nonterminal waits, stops on terminal outcomes or transport failure, and observes work-scope cancellation and Gateway draining. Only detached A2A and nested-step callers enable completion observation; the foreground sessions-send wait remains bounded. (src/agents/run-wait.ts:265, 7d0502350cf6)
  • Existing ACP execution owner remains responsible: The plugin removes its duplicate reply-dispatch timers. OpenClaw's ACP turn manager still resolves configured execution deadlines and cancels timed-out turns; the hook continues passing caller cancellation. This changes OpenClaw-owned dispatch glue without changing a Codex harness contract. (extensions/acpx/index.ts:22, 7d0502350cf6)
  • Recovery preserves existing stored budgets: Restart recovery forwards the existing runTimeoutSeconds value, including zero, through the existing session-admission path. Descendant and requester-settle continuations carry the same value; no stored schema or migration is introduced. (src/agents/subagents/registry/subagent-registry-restart-recovery.ts:408, 7d0502350cf6)
  • Regression coverage inspected: Changed regressions cover late completion after pending and timeout snapshots, terminal failures, lifecycle cancellation, finite and zero budgets, isolated heartbeat queues, and independent shorter node overrides. The captured PR body reports pre-fix failures and passing focused checks; those executions were not independently rerun. (src/agents/run-wait.test.ts:577, 7d0502350cf6)
  • Current main still needs the repair: Fetched main retains the ACPX operation-based reply-dispatch timer and uses only exec-completion classification for heartbeat timeout selection. Its run-reply helper also performs only one wait. (extensions/acpx/index.ts:17, c5695c7579dc)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: 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-14T20:23:27.568Z sha 48adcf668949b755a0bf4ee75b074551476badb7 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T20:40:00.323Z sha 5c9c0e23967c5d92cc679b980f38dd42f3eeca68 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/fix-timeout-ownership branch from 48adcf6 to 5c9c0e2 Compare September 14, 2026 20:29
@steipete
steipete force-pushed the codex/fix-timeout-ownership branch from 5c9c0e2 to 7d05023 Compare September 14, 2026 21:05
@steipete
steipete merged commit eb38ff8 into main Sep 14, 2026
186 checks passed
@steipete
steipete deleted the codex/fix-timeout-ownership branch September 14, 2026 21:29
@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 docs Improvements or additions to documentation extensions: acpx gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. plugin: linux-node rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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