Skip to content

fix(acp): wait for pending acpx startup probes - #177499

Merged
steipete merged 1 commit into
mainfrom
steipete/acp-startup-race
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/acp-startup-race

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The first ACP spawns after Gateway start could fail even though ACP is healthy. The acpx backend starts lazily; the real backend registers before its readiness probe finishes and reports unhealthy in that window, and requireAcpRuntimeBackend (src/acp/runtime/registry.ts) rejects unhealthy backends with ACP_BACKEND_UNAVAILABLE. Sub-agent fleets spawn many children at once, so they land in the window reliably. Live: an Opus parent's first batch of 8 runtime: "acp" spawns all failed with ACP runtime backend is currently unavailable. Try again in a moment.; a second batch 6 seconds later was accepted. The backend registered at 16:13:22.18 and reported ready at 16:13:23.97.

User Impact

Sub-agents spawned through ACP right after Gateway start wait for the backend's initial readiness check instead of failing while it is still starting. No configuration changes or migration are required.

Why This Change Was Made

The deferred acpx service (extensions/acpx/register.runtime.ts) keeps admissions waiting on its existing shared startup promise and rechecks registered health before creating a session. A failed initial probe rejects the waiting spawns; a steady-state unhealthy backend still fails fast; /acp doctor recovery is unchanged. No polling, configuration, or public API. The quickstart notes the behavior.

Evidence

  • Live (Linux, Gateway built from this branch, docs-baseline acp config): two 8-child runtime: "acp", agentId: "codex" fleets started as the first ACP use after a fresh Gateway start; zero currently unavailable errors in either parent or the Gateway log, both fleets merged all modules, both parents reported machinery: clean. On main the same first-use burst fails.
  • extensions/acpx/register.runtime.startup.test.ts (new) fails on main (pending admissions settle prematurely; initiating admission succeeds after a failed probe) and passes; 80 focused acpx/registry/spawn tests pass. Targeted format, lint, and review clean.

Release note context

Fix: sub-agents spawned through ACP right after Gateway start no longer fail with "ACP runtime backend is currently unavailable" while the backend is still starting.

CI qualification

CI run 39288914131, attempt 1, completed on head 65d0d79d6f713c83d97375dcd242bb9ac3c76843. All selected checks passed except checks-fast-baseline-ratchets and its downstream CI gate. The sole ratchet failure is mock-exports at src/infra/openclaw-process-census.missing-command.test.ts:12 for ./container-environment.js, outside this PR's four changed files.

The same ratchet command reproduces the identical failure on the exact tested main base 4ba34fdbb69fc1dbeafd93a2c946e362141ff0be. The offending test, target module, baseline ledger, and scanner have identical Git blobs in that base and CI's tested merge 8cbeb9d247c4d92b16b74faa685da99474fc9be5. Current main separately fixes the mock in cc942bc04e1. Landing uses the explicitly authorized native inherited-failure exception; the failed CI is retained as failed. No baseline changes, retries, or source changes were made for this PR.

Keep the deferred ACPX facade available while callers share its bounded startup promise, then recheck registered health before creating a session. Failed probes reject waiting spawns with ACP_BACKEND_UNAVAILABLE; later admissions fail fast and doctor recovery stays available.

Add regression coverage for concurrent success, failed probes, steady-state failure, and doctor recovery. Focused acpx, registry, and spawn tests: 80 passed. Targeted package typecheck remains blocked by missing generated Plugin SDK declarations; no build was run.
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 19, 2026 16:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T16:53:55.224282Z 65d0d79 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: acpx size: S labels Oct 19, 2026
@steipete
steipete enabled auto-merge (squash) October 19, 2026 17:00
@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. labels Oct 19, 2026
@steipete
steipete disabled auto-merge October 19, 2026 17:03
@steipete
steipete merged commit 99adde0 into main Oct 19, 2026
179 of 183 checks passed
@steipete
steipete deleted the steipete/acp-startup-race branch October 19, 2026 17:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
Keep the deferred ACPX facade available while callers share its bounded startup promise, then recheck registered health before creating a session. Failed probes reject waiting spawns with ACP_BACKEND_UNAVAILABLE; later admissions fail fast and doctor recovery stays available.

Add regression coverage for concurrent success, failed probes, steady-state failure, and doctor recovery. Focused acpx, registry, and spawn tests: 80 passed. Targeted package typecheck remains blocked by missing generated Plugin SDK declarations; no build was run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. docs Improvements or additions to documentation extensions: acpx size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant