Skip to content

fix(update): keep the candidate canary off the live Gateway's configured listener ports - #145342

Merged
steipete merged 1 commit into
mainfrom
steipete/upd-canary-listener-isolation
Sep 11, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/upd-canary-listener-isolation

Conversation

@steipete

@steipete steipete commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #145280

What Problem This Solves

Fixes an issue where users updating a running Gateway with MCP Apps enabled would hit EADDRINUSE on their configured sandbox port. The candidate used a temporary Gateway port but tried to claim the live Gateway's mcp.apps.sandboxPort, then reported a misleading inference-route repair failure.

Thanks to @Carme99 for the report and the listener/PID evidence.

Why This Change Was Made

The shared rehearsal config disables MCP Apps for Doctor, repair, and validation. Candidate startup also carries the already-shipped --update-canary marker into the HTTP transport, suppressing both eager and lazy sandbox acquisition. The candidate-side guard is essential: installed 2026.9.3 and 2026.9.4 updaters cannot pick up a repair to their own config-copying code before running the candidate.

The canary result records its temporary loopback Gateway endpoint and disabled MCP sandbox as typed isolation facts. Normal Gateway startup still uses configured or default sandbox ports. No new configuration, schema, dependencies, or protocol changes.

The listener audit confirmed that Tailscale and discovery are disabled in the copied config; canvas uses the main HTTP listener; browser, channel webhook, Gmail, and other declared plugin services are suppressed by the existing canary startup gates. Node host is a separate outbound client. Watch-node routes share the Gateway listener, and portals/MCP loopback listeners are on demand and ephemeral. Plugin preflight/listing inspect metadata; Doctor retains its no-service-activation policy.

User Impact

Updates can validate the candidate while the existing Gateway and its MCP Apps sandbox remain available. The activated Gateway retains the operator's normal MCP Apps settings and listener ports.

Evidence

  • node scripts/run-vitest.mjs src/infra/update-candidate-canary.test.ts src/gateway/server-runtime-state.test.ts src/gateway/server-kernel.test.ts — 42 passed.
  • node scripts/run-vitest.mjs src/infra/update-candidate-canary.integration.test.ts — passed against the built CLI with an occupied sandbox port and the configuration retained by published updaters; startup/readiness and process-group cleanup verified.
  • Before the fix, the copied-config regression retained enabled: true, the transport regression published port 18790, and the built-CLI regression failed with EADDRINUSE before readiness. Each passes after the repair.
  • node scripts/check-changed.mjs, pnpm build, and the canonical Docker package integrity check passed.

Real Linux systemd-user fixtures used Node 24.20.0, a live Gateway on 18789, and MCP Apps enabled on 18790. The live Gateway PID owned both ports.

Published updater Published 2026.9.4 candidate Fixed candidate Full update outcome
2026.9.3 Canary failed: EADDRINUSE 127.0.0.1:18790 Canary passed, 21.1 seconds Later package swap failed at 30.0 seconds
2026.9.4 Canary failed: EADDRINUSE 127.0.0.1:18790 Canary passed, 10.2 seconds Later package swap failed at 30.0 seconds

The original Gateway stayed healthy during validation. A separate normal startup of the exact fixed package also reached readiness, kept mcp.apps.enabled=true / sandboxPort=18790, and bound both ports in one PID.

Candidate SHA-256: 6f32367e6dfb9fdcb458c1b46e74c1e93d6f03d4743bad4a4ed382c5699d0d3c. The committed diff exactly matches the source patch used to build that artifact.

Known Gaps

Both full updates remained blocked after the canary passed: the installed drivers failed with global-install-failed / Package rollback verification timed out / retained package tree changed. The published package-update-integrity.ts reader caps its scan at 30 seconds. The 2026.9.4 post-failure triage also timed out after saving the update failure. These later owners are outside this listener repair; no retries, larger timeouts, or weaker checks were used.

The isolation covers OpenClaw's declared listener lifecycle. Arbitrary plugin import-time side effects, ports hidden inside operator-provided MCP commands, and inherited Node inspector flags are outside the declared listener lifecycle. The lead’s P1 autoreview of the approved head is scoped-clean.

Review follow-ups: the later 30-second package swap / rollback-verification timeout seen after this canary passes is owned by #145219; this PR stays scoped to the listener collision

Keep the candidate Gateway and shared Doctor/repair rehearsal off the
serving Gateway's configured MCP Apps sandbox port. Honor the shipped
--update-canary marker at transport startup so installed updaters benefit,
and retain normal sandbox ports outside validation.

Reported by @Carme99 in #145280.
@clawsweeper

clawsweeper Bot commented Sep 11, 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 docs Improvements or additions to documentation gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 22:16
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 6:51 PM ET / 22:51 UTC (Revision 2).

ClawSweeper review

What this changes

The PR prevents update-validation Gateways from opening the live MCP Apps sandbox port, records listener isolation, and adds regression coverage and update documentation.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary and has no actionable correctness findings. The published-updater evidence sufficiently proves this listener repair; the separately tracked package-swap timeout does not justify retaining the previous review blocker.

Priority: P0
Reviewed head: f5c8657bd624f1a7c9238dddc8978f40eed7f00d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with strong published-driver evidence and meaningful regression coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Reported Linux systemd-user runs exercise the installed 2026.9.3 and 2026.9.4 updater entrypoints against the fixed candidate while the live sandbox port remains occupied; both reach readiness, and normal startup preserves configured listeners. Later package-swap failures limit full-update claims but do not invalidate proof of this listener repair.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Reported Linux systemd-user runs exercise the installed 2026.9.3 and 2026.9.4 updater entrypoints against the fixed candidate while the live sandbox port remains occupied; both reach readiness, and normal startup preserves configured listeners. Later package-swap failures limit full-update claims but do not invalidate proof of this listener repair.
Evidence reviewed 9 items Current main still contains the collision path: At the fetched main revision, sandbox startup still runs whenever MCP Apps are enabled, and the rehearsal projection leaves MCP Apps settings unchanged. The central repair is therefore still needed.
Candidate-side eager and lazy listener guard: The transport rejects sandbox acquisition before creating or binding its servers, and skips eager acquisition during canary startup. server-start.ts forwards the existing startup option; ordinary startup retains configured/default sandbox ports.
Live configuration remains unchanged: The rehearsal owner uses structuredClone before disabling MCP Apps in its disposable configuration. Its baseline comparison treats isolation settings as projection rather than repairs to the operator configuration.
Findings None None.
Security None None.

How this fits together

OpenClaw validates an update candidate against copied configuration while the serving Gateway remains running. The candidate must reach startup and readiness without claiming the serving Gateway’s listeners or changing its settings.

flowchart TD
  A[Installed updater] --> B[Copied configuration]
  B --> C[Candidate Gateway]
  A --> D[Existing canary flag]
  D --> C
  C --> E[Temporary loopback listener]
  C --> F[Sandbox listener suppressed]
  E --> G[Startup and readiness checks]
  H[Serving Gateway] --> I[Configured listeners remain available]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +20, Tests +67, Docs +5. Total +92 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 21 1 +20
Tests 3 91 24 +67
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 117 25 +92

Review metrics

Metric Value Why it matters
Published-updater compatibility 2 published drivers pass the repaired canary stage Both 2026.9.3 and 2026.9.4 exercise the candidate-side fix without changing their installed updater code.

Technical review

Best possible solution:

Keep listener suppression in the candidate’s existing canary lifecycle while preserving the activated Gateway’s normal configuration.

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

Yes. Current main retains the configured sandbox port and eagerly binds it during canary startup; the linked report and published-driver before/after runs demonstrate the resulting collision. This reviewer did not execute the runtime.

Is this the best way to solve the issue?

Yes. Honoring the already-shipped canary flag at the listener owner repairs existing updater-to-candidate runs; changing only copied configuration would leave published drivers affected.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P0: The reported collision deterministically blocks the normal update path for running Gateways with MCP Apps enabled, requiring technical intervention.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Reported Linux systemd-user runs exercise the installed 2026.9.3 and 2026.9.4 updater entrypoints against the fixed candidate while the live sandbox port remains occupied; both reach readiness, and normal startup preserves configured listeners. Later package-swap failures limit full-update claims but do not invalidate proof of this listener repair.
  • proof: sufficient: Contributor real behavior proof is sufficient. Reported Linux systemd-user runs exercise the installed 2026.9.3 and 2026.9.4 updater entrypoints against the fixed candidate while the live sandbox port remains occupied; both reach readiness, and normal startup preserves configured listeners. Later package-swap failures limit full-update claims but do not invalidate proof of this listener repair.

Evidence

What I checked:

  • Current main still contains the collision path: At the fetched main revision, sandbox startup still runs whenever MCP Apps are enabled, and the rehearsal projection leaves MCP Apps settings unchanged. The central repair is therefore still needed. (src/gateway/server-runtime-state.ts:560, 7ce6d3de253d)
  • Candidate-side eager and lazy listener guard: The transport rejects sandbox acquisition before creating or binding its servers, and skips eager acquisition during canary startup. server-start.ts forwards the existing startup option; ordinary startup retains configured/default sandbox ports. (src/gateway/server-runtime-state.ts:417, f5c8657bd624)
  • Live configuration remains unchanged: The rehearsal owner uses structuredClone before disabling MCP Apps in its disposable configuration. Its baseline comparison treats isolation settings as projection rather than repairs to the operator configuration. (src/infra/update-candidate-rehearsal.ts:113, f5c8657bd624)
  • Published updater contract and release check: GitHub source reads confirmed that both v2026.9.3 and v2026.9.4 launch the candidate with --update-canary. The v2026.9.4 transport still eagerly starts the sandbox when enabled, so the latest release does not contain this repair. Local release-object inspection failed; the GitHub contents API supplied the source instead. (src/infra/update-candidate-canary.ts:382, 3a9d69db306c)
  • Published-driver behavior proof: The complete supplied PR body, captured under sourceRevision e40e475c442f35c8b2882ced35fcb47ef183838adce536138acb1f47b6ff3e70, reports Linux systemd-user runs with a live Gateway owning ports 18789 and 18790. Published 2026.9.3 and 2026.9.4 drivers failed against the released candidate with EADDRINUSE, then passed candidate validation in 21.1 and 10.2 seconds with the fixed package. The serving Gateway stayed healthy, and separate normal startup preserved both configured listeners. Package SHA-256: 6f32367e6dfb9fdcb458c1b46e74c1e93d6f03d4743bad4a4ed382c5699d0d3c. (f5c8657bd624)
  • Regression coverage exercises the production entrypoint: The integration test holds a real TCP listener, restores the sandbox settings retained by published updaters, launches the built candidate CLI, and checks startup, readiness, retained listener availability, and process cleanup. Unit coverage also checks lazy rejection and normal configured/default ports. Tests were inspected but not executed in this read-only review; the PR reports passing runs and pre-fix failures. (src/infra/update-candidate-canary.integration.test.ts:46, f5c8657bd624)

Likely related people:

  • 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 (1 earlier review cycle)
  • reviewed 2026-09-11T22:25:19.508Z sha f5c8657 :: blocked before merge. :: none

@steipete
steipete merged commit 0cd4c70 into main Sep 11, 2026
268 of 269 checks passed
@steipete
steipete deleted the steipete/upd-canary-listener-isolation branch September 11, 2026 23:07
@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 12, 2026
openclaw update no longer fails with EADDRINUSE on the configured MCP Apps sandbox port while the live Gateway runs. The candidate canary keeps MCP Apps off and records its isolation facts, using the marker already supplied by published updaters. Normal Gateway listener settings remain intact.

Published 2026.9.3 and 2026.9.4 drivers both pass the repaired canary; regression coverage proves failure before the fix and success afterward. The later package swap / rollback-verification timeout is owned by openclaw#145219.

Fixes openclaw#145280.
Thanks to @Carme99 for the report and listener/PID evidence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

[Bug]: Update canary inherits live mcp.apps.sandboxPort and dies EADDRINUSE while gateway runs

1 participant