Repository navigation
fix(update): keep the candidate canary off the live Gateway's configured listener ports - #145342
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 11, 2026, 6:51 PM ET / 22:51 UTC (Revision 2). ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherOpenClaw 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +20, Tests +67, Docs +5. Total +92 across 8 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
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.
Fixes #145280
What Problem This Solves
Fixes an issue where users updating a running Gateway with MCP Apps enabled would hit
EADDRINUSEon their configured sandbox port. The candidate used a temporary Gateway port but tried to claim the live Gateway'smcp.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-canarymarker 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.enabled: true, the transport regression published port 18790, and the built-CLI regression failed withEADDRINUSEbefore 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.
EADDRINUSE 127.0.0.1:18790EADDRINUSE 127.0.0.1:18790The 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 publishedpackage-update-integrity.tsreader 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