Repository navigation
fix: match machine join commands to the Gateway release - #168680
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. |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
|
Codex review: needs maintainer review before merge. What this changesThe Gateway selects and formats version-matched machine join commands for the CLI and Control UI. Example: Create a machine join command from a Gateway running published OpenClaw 2026.9.9.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a concrete enrollment-version problem that remains on current main, and no introduced correctness defect was found. Current-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe administrator-only pairing RPC receives join-code requests, consults existing installation and npm metadata owners, and returns a single-use URL with commands consumed by the CLI and browser. flowchart LR
A[Administrator] --> B[CLI or Control UI]
B --> C[Gateway pairing RPC]
C --> D[Installation identity]
C --> E[Npm metadata]
C --> F[Pairing worker]
C --> G[Join commands]
G --> B
Technical reviewBest possible solution: Land the Gateway-owned command selection while preserving explicit hosting consent and the documented matching-build fallback. Do we have a high-confidence way to reproduce the issue? Current-main source still produces an unpinned command, consistent with the supplied baseline terminal output; this read-only review ran no target code. Is this the best way to solve the issue? Centralizing version selection in the Gateway is appropriate because it knows the enrolling release and prevents CLI and browser formatting from drifting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 76bfd5a284be. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +88, Tests +161, Docs +21. Total +270 across 11 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 10, 2026, 8:19 PM ET / October 11, 2026, 00:19 UTC (Revision 3). |
98d57af to
04eb590
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
662c65f to
309bf08
Compare
) ## What Problem This Solves Fixes machine enrollment silently running an old cached npm release when the Gateway is newer. ## User Impact `devices join-code` and the Control UI now suggest the Gateway's published npm version, not the invoking CLI's version. Both also show the short alternative for an existing OpenClaw installation. The default remains a background service with explicit session-host consent; command-only services remain available. Source checkouts and unpublished builds prefer a resolvable matching channel tag. If npm cannot confirm a target, the command stays unpinned and a one-line note asks for a matching Gateway build. JSON keeps `joinUrl` and `command`, adding `serviceCommand`, `installedCommand`, and optional `versionNote`. ## Why This Change Was Made [openclaw#168623](openclaw#168623) / `13d3847f108` established the one-paste service/session-host default but deliberately left npm unpinned. npm can reuse an old cached package. The Gateway now owns version selection and command formatting in the same RPC that mints the URL; CLI and UI consume its commands instead of independently rebuilding them. The existing update owners supply install identity and channel policy. Joining does not run a full update/dependency inspection. This composes with the durable service installation work in [openclaw#168644](openclaw#168644); it does not change node execution, service lifecycle, or upgrade commands. No overlap with Pash/Sarah changes. ## Evidence - Regressions on `13d3847f108`: eight Gateway/CLI-boundary cases and three CLI text/JSON cases fail for missing authoritative commands; the real browser regression reaches the setup RPC and fails waiting for the pinned command. - Focused Gateway and CLI suites: 84 tests passed after the final lightweight-install-discovery refinement. The Gateway suite took 173.85s and CLI suite 43.42s on the loaded local host (including transform/setup); assertions took about 1.7s and 15.5s respectively. - All five browser flows passed. After the final template simplification, the real bundled UI mint/refresh flow passed again (46.41s, including setup), covering the pinned command, installed alternative, and development fallback note. The Control UI Lit ratchet also passed. - Real isolated Gateway text/JSON: baseline printed unpinned npm commands; candidate printed `[email protected]`, matching the Gateway release, plus the existing-installation alternative. Both exited successfully. This proof exercises command generation, not installation on a second machine; durable service installation is covered separately by openclaw#168644. - The built CLI bootstrap guard passed. The local changed gate stopped at an unrelated existing mock-export violation in `src/model-picker/apply-session-model-selection-placement.test.ts`; the rebase picked up its existing `mock-isolation` explanation. Hosted exact-head CI is the final check. - Inherited CI failure: [the final-head job](https://github.com/openclaw/openclaw/actions/runs/38096158809/job/114342554800) failed `plugin-sdk-surface-report.test.ts` on SDK export-budget drift: 3672 > 3656 exports, 2133 > 2122 callables, 158 > 154 deprecated exports, and two deprecated-entrypoint budgets. Clean `origin/main` at `39900fc906e66ff0e4bf61ef11ad531883ea979f` reproduces the same budget failures (2 failed, 3 passed, 1 Linux-only test skipped on macOS; 18.84s). The aggregate CI gate reports this failure; fail-fast cancelled the other unfinished lanes. This PR changes no plugin SDK surface or budget. Production: +105/-17 lines; tests: +188/-27; documentation: +23/-2. The added production logic replaces independent CLI/UI formatting with one Gateway decision owner. <details> <summary>Real isolated Gateway terminal output (redacted)</summary> Gateway: `OpenClaw 2026.9.9`. Both text and JSON commands exited 0. Only the ephemeral loopback port and single-use code are redacted. Before (`devices join-code`): ```text npx -y openclaw connect http://127.0.0.1:<port>/j/<code> --service --session-host ``` After (`devices join-code`): ```text npx -y [email protected] connect http://127.0.0.1:<port>/j/<code> --service --session-host Already have OpenClaw installed? Run: openclaw connect http://127.0.0.1:<port>/j/<code> --service --session-host ``` After (`devices join-code --json`): ```json { "joinUrl": "http://127.0.0.1:<port>/j/<code>", "command": "npx -y [email protected] connect http://127.0.0.1:<port>/j/<code> --service --session-host", "serviceCommand": "npx -y [email protected] connect http://127.0.0.1:<port>/j/<code> --service", "installedCommand": "openclaw connect http://127.0.0.1:<port>/j/<code> --service --session-host" } ``` </details> ### Connect a machine | Before | After | | --- | --- | |  |  | The screenshots use synthetic Gateway data and the actual bundled Control UI. ## Bounded cost Only explicit join-code creation performs registry work: at most two npm metadata GETs, each with a one-second deadline including the response body. No background polling, model calls, package-manager subprocesses, retries, or new caches. Existing prepared install identity is reused; if absent, the update owner's lightweight local classifier runs without dependency inspection, with its Git probe bounded to one second. No registry lookup is performed by CLI or UI. ## Compatibility and Risk The RPC fields are additive. A new CLI needs a Gateway that returns the authoritative commands and explains how to update if it connects to an older Gateway. Published npm releases use exact versions; development/unpublished/offline results are explicitly marked as requiring a matching build. Shell quoting remains owned by the existing CLI argument helper. Two-way door: reverting changes future suggestions and added response fields only. It does not change existing pairings, service state, or session-host consent. The blast radius is enrollment instructions and their presentation. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes machine enrollment silently running an old cached npm release when the Gateway is newer.
User Impact
devices join-codeand the Control UI now suggest the Gateway's published npm version, not the invoking CLI's version. Both also show the short alternative for an existing OpenClaw installation. The default remains a background service with explicit session-host consent; command-only services remain available.Source checkouts and unpublished builds prefer a resolvable matching channel tag. If npm cannot confirm a target, the command stays unpinned and a one-line note asks for a matching Gateway build. JSON keeps
joinUrlandcommand, addingserviceCommand,installedCommand, and optionalversionNote.Why This Change Was Made
#168623 /
8f91e4bb65festablished the one-paste service/session-host default but deliberately left npm unpinned. npm can reuse an old cached package. The Gateway now owns version selection and command formatting in the same RPC that mints the URL; CLI and UI consume its commands instead of independently rebuilding them.The existing update owners supply install identity and channel policy. Joining does not run a full update/dependency inspection. This composes with the durable service installation work in #168644; it does not change node execution, service lifecycle, or upgrade commands.
Evidence
8f91e4bb65f: eight Gateway/CLI-boundary cases and three CLI text/JSON cases fail for missing authoritative commands; the real browser regression reaches the setup RPC and fails waiting for the pinned command.[email protected], matching the Gateway release, plus the existing-installation alternative. Both exited successfully. This proof exercises command generation, not installation on a second machine; durable service installation is covered separately by fix(node): keep npx-installed services outside the npm cache #168644.src/model-picker/apply-session-model-selection-placement.test.ts; the rebase picked up its existingmock-isolationexplanation. Hosted exact-head CI is the final check.plugin-sdk-surface-report.test.tson SDK export-budget drift: 3672 > 3656 exports, 2133 > 2122 callables, 158 > 154 deprecated exports, and two deprecated-entrypoint budgets. Cleanorigin/mainatdd4b258a3cfa6fdef41535e5518fe260f5665a9creproduces the same budget failures (2 failed, 3 passed, 1 Linux-only test skipped on macOS; 18.84s). The aggregate CI gate reports this failure; fail-fast cancelled the other unfinished lanes. This PR changes no plugin SDK surface or budget.Production: +105/-17 lines; tests: +188/-27; documentation: +23/-2. The added production logic replaces independent CLI/UI formatting with one Gateway decision owner.
Real isolated Gateway terminal output (redacted)
Gateway:
OpenClaw 2026.9.9. Both text and JSON commands exited 0. Only the ephemeral loopback port and single-use code are redacted.Before (
devices join-code):After (
devices join-code):After (
devices join-code --json):{ "joinUrl": "http://127.0.0.1:<port>/j/<code>", "command": "npx -y [email protected] connect http://127.0.0.1:<port>/j/<code> --service --session-host", "serviceCommand": "npx -y [email protected] connect http://127.0.0.1:<port>/j/<code> --service", "installedCommand": "openclaw connect http://127.0.0.1:<port>/j/<code> --service --session-host" }Connect a machine
The screenshots use synthetic Gateway data and the actual bundled Control UI.
Bounded cost
Only explicit join-code creation performs registry work: at most two npm metadata GETs, each with a one-second deadline including the response body. No background polling, model calls, package-manager subprocesses, retries, or new caches. Existing prepared install identity is reused; if absent, the update owner's lightweight local classifier runs without dependency inspection, with its Git probe bounded to one second. No registry lookup is performed by CLI or UI.
Compatibility and Risk
The RPC fields are additive. A new CLI needs a Gateway that returns the authoritative commands and explains how to update if it connects to an older Gateway. Published npm releases use exact versions; development/unpublished/offline results are explicitly marked as requiring a matching build. Shell quoting remains owned by the existing CLI argument helper.
Two-way door: reverting changes future suggestions and added response fields only. It does not change existing pairings, service state, or session-host consent. The blast radius is enrollment instructions and their presentation.