Skip to content

fix(agents): await execution callback settlement - #150396

Merged
steipete merged 3 commits into
mainfrom
codex/execution-callback-series-20260916
Sep 20, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/execution-callback-series-20260916

Conversation

@steipete

@steipete steipete commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Execution-start and post-admission callbacks can return work that runtime callers ignore, allowing execution or ACP completion to overtake it. Repeated notifications can also skip a binding that is already in progress.

User Impact

Runtime execution and ACP completion wait for accepted callback work to settle. Existing callbacks still accept incidental synchronous return values. Cancellation and current run authority are checked again after the wait.

Why This Change Was Made

Propagate settlement through the existing CLI, embedded, Gateway, worker-turn, and Cron callers. Repeated binding notifications join one outcome. ACP joins prompt notifications that have already started; unresolved readiness that never started a notification cannot hold terminal completion. The CLI bridge includes startup callbacks in its existing transcript and listener cleanup scope.

This change preserves the current synchronous task, flow, and Cron storage owners. Their physical worker conversion remains separate. A standalone test-only commit corrects a stale prepared-runtime fixture import without changing production code or assertions.

Evidence

Six focused regressions fail before their repairs: both binding arrival orders, ACP terminal publication overtaking a started notification, CLI preparation and dispatch overtaking callbacks, and missing transcript cleanup after a startup callback error. All pass with the repair.

The callback candidate passes 300 tests across ten files, including repeated admission and closure, ACP completion and delivery, CLI entry and dispatch, public SDK compatibility, real Cron receipt/task binding, and the Gateway worker-turn boundary. The fixture correction separately passes 47 tests, its owning types, and its full selected changed-file gate. Fresh independent reviews through P2 found no actionable findings; the composed source preserves both reviewed changes exactly.

Core production and full core test types, targeted typed lint, formatting, package/export boundaries, SDK budgets, and all selected source guards pass. The initial broad gate exposed the stale fixture import, reproduced on the unchanged base; the composed candidate includes the verified correction. Two test-only executor-return lint issues were corrected with behavior-preserving blocks and validated by scoped lint and fresh review. Static proof was completed across the frozen reviewed changes; no single combined aggregate-gate rerun is claimed. Exact-head CI passes at e88108e8ce8314c245ad9f752adaecf71e5bdc47. Proof used isolated synthetic state; no external provider or operator-state campaign is claimed.

Historical CI on the prior head failed a UI bundle budget by 118 bytes and a Codex receipt fixture execution budget. The inspected receipt owners were unchanged and that fixture supplied no modified callback, but no exact-baseline runtime reproduction established the timing cause. Those failures are retained as historical evidence, not described as flaky or current-head success.

@clawsweeper

clawsweeper Bot commented Sep 17, 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 17, 2026 00:15
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling labels Sep 17, 2026
@steipete
steipete requested a review from a team as a code owner September 17, 2026 00:15
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 20, 2026, 4:27 AM ET / 08:27 UTC (Revision 4).

ClawSweeper review

What this changes

Makes agent startup and ACP completion await accepted callback work, preserves cancellation checks and cleanup, and updates regression coverage.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful repair: current main still ignores callback settlement. No actionable correctness findings remain. The prior compatibility concern is explicitly acknowledged in the maintainer-authored PR and does not establish a new repair requirement.

Priority: P2
Reviewed head: e88108e8ce8314c245ad9f752adaecf71e5bdc47

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage, successful exact-head CI, and no actionable correctness findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository context identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Supplied regressions exercise callback settlement, cancellation, and cleanup; exact-head CI passed, but no external-provider run is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository context identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Supplied regressions exercise callback settlement, cancellation, and cleanup; exact-head CI passed, but no external-provider run is claimed.
Evidence reviewed 9 items Verified introduced changes: Reviewed the merge-base-to-head production and test diffs. The supplied test merge is stale and was not used to infer removal of current-main behavior.
Current main still needs settlement: Current main invokes the CLI startup callback without awaiting it; its execution-owner binding also uses a boolean rather than joining an outstanding binding promise.
Shared settlement and live authority: Post-admission binding shares one promise, checks the existing admitted authority before binding and after settlement, and propagates failure to concurrent callers. The added tests cover both notification orders, shared rejection, and closure during persistence.
Findings None None.
Security None None.

How this fits together

Agent execution connects Gateway requests and scheduled jobs to embedded, CLI, and worker runtimes. Startup callbacks establish lifecycle bookkeeping before execution continues, while ACP stream handling coordinates notifications and completion.

flowchart TD
  A[Gateway requests and scheduled jobs] --> B[Run admission]
  B --> C[Startup callbacks and owner binding]
  C --> D[Await accepted work]
  D --> E[Recheck cancellation and authority]
  E --> F[Execute selected runtime]
  F --> G[Settle notifications and publish completion]
Loading

Before merge

  • Resolve merge risk (P1) - Existing plugins returning long-lived background promises from execution-start callbacks can now delay startup, and rejected promises can fail startup; third-party callback behavior was not exercised.
Agent review details

Security

None.

PR surface

Source +39, Tests +270. Total +309 across 32 files.

View PR surface stats
Area Files Added Removed Net
Source 16 88 49 +39
Tests 16 308 38 +270
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 32 396 87 +309

Review metrics

Metric Value Why it matters
Production versus regression coverage production +39 net LOC; tests and test support +270 net LOC Production growth implements shared settlement and post-wait checks, while most growth protects ordering, failure propagation, cleanup, and SDK compatibility.

Merge-risk options

Maintainer options:

  1. Accept the stated callback contract (recommended)
    Retain the explicitly described promise-settlement behavior, with plugin callbacks returning only work that must finish before startup continues.

Technical review

Best possible solution:

Adopt the maintainer-described settlement contract through the existing runtime owners, retaining synchronous callback compatibility and explicit acceptance of the SDK timing change.

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

Yes, from source: current main discards returned startup and binding promises, allowing continuation before settlement. The PR supplies focused failing-before regressions; this review did not execute them.

Is this the best way to solve the issue?

Yes. Propagating settlement through existing owners is a focused repair, and the patch preserves cleanup and cancellation checks without introducing another execution or storage owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs bounded execution-ordering races without evidence of an urgent user-facing outage.
  • merge-risk: 🚨 compatibility: A released public callback now awaits returned promises, changing startup timing and rejection behavior despite preserved type assignability.
  • 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 repository context identifies this as maintainer-authored, so the external-contributor proof gate does not apply. Supplied regressions exercise callback settlement, cancellation, and cleanup; exact-head CI passed, but no external-provider run is claimed.

Evidence

What I checked:

  • Verified introduced changes: Reviewed the merge-base-to-head production and test diffs. The supplied test merge is stale and was not used to infer removal of current-main behavior. (e88108e8ce83)
  • Current main still needs settlement: Current main invokes the CLI startup callback without awaiting it; its execution-owner binding also uses a boolean rather than joining an outstanding binding promise. (src/agents/cli-runner.ts:166, 9f5ebbad1e73)
  • Shared settlement and live authority: Post-admission binding shares one promise, checks the existing admitted authority before binding and after settlement, and propagates failure to concurrent callers. The added tests cover both notification orders, shared rejection, and closure during persistence. (src/audit/execution-owner-binding.ts:53, e88108e8ce83)
  • ACP terminal ordering: Terminal results join prompt notifications that have already started; unresolved readiness that never entered a notification does not block completion. The focused regression holds the notification open and checks that completion remains unpublished. (src/acp/control-plane/manager.turn-stream.ts:167, e88108e8ce83)
  • Released callback compatibility: The v2026.9.5 command contract exposes onExecutionStarted as a void-returning callback. The PR preserves incidental synchronous return values but intentionally changes promise settlement behavior; its public SDK test checks assignability across ingress and embedded runtime surfaces. (src/agents/command/types.ts:151, ec9c1a13db89)
  • Prior review disposition and proof scope: The supplied completed review for this same head contains no findings or published rank-up moves. Its timing concern is addressed explicitly by the captured PR body, which describes awaited callbacks, preserved synchronous returns, isolated regression evidence, and the absence of an external-provider campaign. (e88108e8ce83)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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 (3 earlier review cycles)
  • reviewed 2026-09-17T00:24:13.613Z sha 9e722ac :: blocked before merge. :: none
  • reviewed 2026-09-20T07:21:39.240Z sha 4373514 :: blocked before merge. :: none
  • reviewed 2026-09-20T07:30:00.370Z sha e88108e :: blocked before merge. :: none

Join accepted execution-start and post-admission work before runtime continuation and terminal publication. Preserve current authority after awaited callbacks, repeated notification settlement, public callback compatibility, and transcript cleanup on startup failure.
@steipete
steipete force-pushed the codex/execution-callback-series-20260916 branch from 9e722ac to 4373514 Compare September 20, 2026 07:14
@steipete
steipete merged commit d3781fb into main Sep 20, 2026
214 checks passed
@steipete
steipete deleted the codex/execution-callback-series-20260916 branch September 20, 2026 09:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
* fix(agents): await execution callback settlement

Join accepted execution-start and post-admission work before runtime continuation and terminal publication. Preserve current authority after awaited callbacks, repeated notification settlement, public callback compatibility, and transcript cleanup on startup failure.

* test(agents): use lifecycle replacement factory in fixture

* test(agents): avoid returning timer handles from executors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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