Repository navigation
feat(ui): dispatch sessions to paired devices - #126187
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
353d656 to
d0cd80a
Compare
|
Codex review: stale review; fresh review needed. Summary Next step |
d0cd80a to
5c9fc30
Compare
|
Land-ready evidence is complete on exact head
The PR body now contains the current LOC split and complete evidence. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
The requested fresh-head ClawSweeper review started for Per repository policy, a queued or late review publisher refresh is not a landing blocker once exact-head CI, required proof, and independent review are complete. This head has green exact CI, clean pre- and post-rebase autoreview, the real paired-node lifecycle run, and the corrected live Control UI/Gateway/node proof documented above. The native |
|
Merged via squash.
|
…ns (#174713) Related: #169722 ## What Problem This Solves **Existing folder on device** sessions require you to type an absolute path on the paired device. The **Browse folders** picker lists only the Gateway host, so it cannot help you find the folder on the device. ## User Impact Admins can choose **Browse folders on <device>** in the New Session project menu, open folders on the selected paired device, and click **Use this folder** to fill the device path. Writers still type the path, because node folder listing is admin-only. ## Why This Change Was Made - The Gateway already routes `fs.listDir` with `nodeId` to the node's directory listing (#105114). #126187 removed that route from New Session together with legacy `execNode` sessions, so the picker cannot reach it now. - This change reuses the same picker and Gateway route for device-folder sessions only. The menu item appears when all of these are true: - device folders are available for the selected device - the operator is an admin - the device can invoke `fs.listDir` - Device listings skip Gateway-only side effects: folder approval, the Git checkout probe and project registration. - The Gateway now keeps a node's `INVALID_REQUEST` folder errors (for example `ENOENT`) as request errors. Before, it reported them as `UNAVAILABLE`. With this change, a stale or partly typed device path opens the device home folder, the same as the Gateway picker does. - There is no protocol, schema or config change. The listing is not limited to `nodeHost.workerRuns.folders` roots. The device still checks the chosen folder when the session is created. The docs say this. ## Evidence **Live, isolated Gateway + separate session-host node (both from this branch), real Control UI:** - Selected the paired node, chose **Browse folders on Synthetic laptop**, and opened `projects/`. The listing showed the node's own home, not the Gateway's. - Picked `device-only-tries`. The path field filled, and `sessions.create` stored that `deviceFolder`. - The session dispatched to the device. A turn ran `pwd > proof.txt`, and the file appeared in the picked folder on the node. - Typed `/nope/missing-on-device`, then chose browse. The picker opened the device home with no error. | Before (`main`) | After | | --- | --- | |  |  | | Device listing | Picked folder | Missing typed path falls back | | --- | --- | --- | |  |  |  | **Focused tests:** - `new-session-page.device-folder.e2e.test.ts`: 4 passed, including the new browse-and-create case and the writer case (no browse item). - `new-session-page.places` and `operator-scopes` e2e: 19 passed, so Gateway browsing still works. - `draft-place-browser.test.ts`: 33 passed. - `src/gateway/server-methods/fs.test.ts`: 16 passed. The new node error-code case fails without the `fs.ts` change. - `tsgo:ui`, oxlint and oxfmt on the changed files, `ui:i18n:verify`. **Gap:** the live node ran on the same host as the Gateway. A cross-machine device uses the same node WebSocket path, but I did not exercise one. **Merge danger:** two-way door. A revert removes the menu item and the error-code change, and no state, config or contract changes. Blast radius: admin operators in New Session with a device-folder-capable paired device. Other `fs.listDir` node callers now see `INVALID_REQUEST` instead of `UNAVAILABLE` for node path errors. Co-authored-by: Ayaan Zaidi <[email protected]>
…ns (openclaw#174713) Related: openclaw#169722 ## What Problem This Solves **Existing folder on device** sessions require you to type an absolute path on the paired device. The **Browse folders** picker lists only the Gateway host, so it cannot help you find the folder on the device. ## User Impact Admins can choose **Browse folders on <device>** in the New Session project menu, open folders on the selected paired device, and click **Use this folder** to fill the device path. Writers still type the path, because node folder listing is admin-only. ## Why This Change Was Made - The Gateway already routes `fs.listDir` with `nodeId` to the node's directory listing (openclaw#105114). openclaw#126187 removed that route from New Session together with legacy `execNode` sessions, so the picker cannot reach it now. - This change reuses the same picker and Gateway route for device-folder sessions only. The menu item appears when all of these are true: - device folders are available for the selected device - the operator is an admin - the device can invoke `fs.listDir` - Device listings skip Gateway-only side effects: folder approval, the Git checkout probe and project registration. - The Gateway now keeps a node's `INVALID_REQUEST` folder errors (for example `ENOENT`) as request errors. Before, it reported them as `UNAVAILABLE`. With this change, a stale or partly typed device path opens the device home folder, the same as the Gateway picker does. - There is no protocol, schema or config change. The listing is not limited to `nodeHost.workerRuns.folders` roots. The device still checks the chosen folder when the session is created. The docs say this. ## Evidence **Live, isolated Gateway + separate session-host node (both from this branch), real Control UI:** - Selected the paired node, chose **Browse folders on Synthetic laptop**, and opened `projects/`. The listing showed the node's own home, not the Gateway's. - Picked `device-only-tries`. The path field filled, and `sessions.create` stored that `deviceFolder`. - The session dispatched to the device. A turn ran `pwd > proof.txt`, and the file appeared in the picked folder on the node. - Typed `/nope/missing-on-device`, then chose browse. The picker opened the device home with no error. | Before (`main`) | After | | --- | --- | |  |  | | Device listing | Picked folder | Missing typed path falls back | | --- | --- | --- | |  |  |  | **Focused tests:** - `new-session-page.device-folder.e2e.test.ts`: 4 passed, including the new browse-and-create case and the writer case (no browse item). - `new-session-page.places` and `operator-scopes` e2e: 19 passed, so Gateway browsing still works. - `draft-place-browser.test.ts`: 33 passed. - `src/gateway/server-methods/fs.test.ts`: 16 passed. The new node error-code case fails without the `fs.ts` change. - `tsgo:ui`, oxlint and oxfmt on the changed files, `ui:i18n:verify`. **Gap:** the live node ran on the same host as the Gateway. A cross-machine device uses the same node WebSocket path, but I did not exercise one. **Merge danger:** two-way door. A revert removes the menu item and the error-code change, and no state, config or contract changes. Blast radius: admin operators in New Session with a device-folder-capable paired device. Other `fs.listDir` node callers now see `INVALID_REQUEST` instead of `UNAVAILABLE` for node path errors. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
New Session still treated paired machines as legacy
execNodecommand hosts. Device eligibility came fromnode.listandsystem.run, session creation embedded the node insessions.create, cloud profiles were writer-visible, and offline session-host identity disappeared with the WebSocket connection. The move dialog repeated the same stale policy and hid device moves from write-scoped operators.Why This Change Was Made
This completes the “devices host sessions” picker boundary:
environments.listis the single UI source for device status, host consent, exact capacity, lifecycle, and update issues;execNode, dispatches with exactdeviceId, and sends the first turn through the shared placement startup/recovery owner;node.list;execNodecreation are deleted rather than retained as a fallback.There is no protocol-version or SQLite schema-version bump, no new config/env surface, and no older-Gateway compatibility path. The additive
node_surface_json.sessionHostmember is safe for older readers; missing means false.Production LOC: +972 / -982 (net -10). Tests: +1,744 / -2,018 (net -274). Docs: +95 / -41. The server growth records the durable owner fact and enforces the target-specific authorization boundary; the UI cutover removes more production code than it adds.
AI-assisted: yes. I reviewed the paired-node persistence transaction, reconnect generation fences, dynamic scope policy, session ACL revalidation, environment parser/eligibility owner, New Session and Move flows, recovery semantics, visual output, and proof.
User Impact
Operators with write access can select an eligible paired session-host device in New Session or move an active session to one. The picker shows exact worker slots and keeps unavailable devices visible with the reason they cannot currently run a session. Cloud allocation remains admin-only.
Existing historical session
execNodedisplay remains intact, but New Session no longer creates newexecNode-bound sessions.Evidence
sessions.create({ execNode })and never sentsessions.dispatch({ deviceId }).new-session-page.environment-metadata,new-session-page.device-dispatch, andsession-placement.move— 7 tests passed across three files.pnpm ui:i18n:baselineandpnpm ui:i18n:verify— passed (5,442 keys, 6,178 literal references, 58 template prefixes).node scripts/check-changed.mjs -- <108 changed paths>— passed core, coreTests, UI, docs, and tooling lanes.pnpm ui:build— passed; startup bundle stayed within budget.pnpm build— passed; all public plugin SDK subpaths verified.pnpm db:kysely:checkandgit diff --check— passed.5c9fc309f6cef8c58d5d6ed28e032da3143ebd7c— green./newflow selected the actual paired node, created a managed worktree withoutexecNode, dispatched the exact device, sent the first turn, completed the assistant response, and verified the active durable worker environment is providerdevice; writer/admin scope, offline identity, and reconnect slot assertions all passed. The initial proof harness compared the public node inventory id with the intentionally distinct worker-environment id; the corrected owner readback passed without a source change.Visual proof
Before: device placement was inferred from legacy exec capability and cloud profiles were broadly visible.
After: authoritative host states and exact slots are visible; only duplicate labels receive a quiet short-ID suffix.
Live exact-head flow (real Gateway, paired node, managed worktree, dispatch, turn completion):
runner-picker-live-flow.webm