Skip to content

feat(ui): dispatch sessions to paired devices - #126187

Merged
steipete merged 1 commit into
mainfrom
steipete/runner-picker-device-dispatch
Aug 19, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/runner-picker-device-dispatch

Conversation

@steipete

@steipete steipete commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

New Session still treated paired machines as legacy execNode command hosts. Device eligibility came from node.list and system.run, session creation embedded the node in sessions.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:

  • current v5 runner inventory persists explicit session-host consent in the existing paired-node JSON surface; live inventory overrides history, offline rows retain host identity, and exact slots remain live-only;
  • environments.list is the single UI source for device status, host consent, exact capacity, lifecycle, and update issues;
  • only an available current session host with a valid positive slot count is selectable; offline, saturated, missing-capacity, non-host, and update-required devices remain visible with actionable reasons;
  • New Session creates a managed-worktree draft without execNode, dispatches with exact deviceId, and sends the first turn through the shared placement startup/recovery owner;
  • Move uses the same authoritative device projection and no longer calls node.list;
  • writers may dispatch or move to paired devices and back to the Gateway, while cloud profile dispatch/moves are dynamically admin-only at the Gateway authorization owner;
  • legacy New Session node-path browsing, node-folder recents, and execNode creation 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.sessionHost member 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 execNode display remains intact, but New Session no longer creates new execNode-bound sessions.

Evidence

  • Pre-fix browser regression reproduced the bug: selecting a node created sessions.create({ execNode }) and never sent sessions.dispatch({ deviceId }).
  • Focused pairing, inventory, catalog, environments, protocol scope, Gateway authorization, and UI owner suites — 540 tests passed across 20 files.
  • Focused post-cleanup UI suites — 26 tests passed across four files.
  • Changed mocked-browser coverage — 49 tests passed across 13 files in bounded runs.
  • Final source-blind behavior run: new-session-page.environment-metadata, new-session-page.device-dispatch, and session-placement.move — 7 tests passed across three files.
  • pnpm ui:i18n:baseline and pnpm 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.
  • Docs formatting/lint/MDX/config/link checks — passed; 6,542 links, 0 broken.
  • pnpm db:kysely:check and git diff --check — passed.
  • Post-rebase focused proof: 743 server tests, 149 UI unit tests, and 47 browser E2E tests passed; the full 109-path changed gate, docs, i18n, UI build, full build, and fresh autoreview all passed.
  • Exact-head CI for 5c9fc309f6cef8c58d5d6ed28e032da3143ebd7c — green.
  • Real paired-node lifecycle — clean Linux Gateway, actual node supervisor, Git workspace transfer, mock-provider turn, device dispatch, Gateway/device moves, disconnect/reconnect, offline retry, exact two-slot capacity, role removal, and cleanup passed.
  • Live Control UI + paired-node run — real served /new flow selected the actual paired node, created a managed worktree without execNode, dispatched the exact device, sent the first turn, completed the assistant response, and verified the active durable worker environment is provider device; 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.
  • Fresh Codex autoreview — clean, no accepted/actionable findings; patch correct (0.98 after rebase).

Visual proof

Before: device placement was inferred from legacy exec capability and cloud profiles were broadly visible.

Before: legacy device picker

After: authoritative host states and exact slots are visible; only duplicate labels receive a quiet short-ID suffix.

After: authoritative device session hosts

Live exact-head flow (real Gateway, paired node, managed worktree, dispatch, turn completion):

runner-picker-live-flow.webm

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime plugin: file-transfer size: XL maintainer Maintainer-authored PR labels Aug 19, 2026
@steipete
steipete marked this pull request as ready for review August 19, 2026 04:44
@steipete
steipete requested a review from a team as a code owner August 19, 2026 04:44
@steipete
steipete force-pushed the steipete/runner-picker-device-dispatch branch from 353d656 to d0cd80a Compare August 19, 2026 05:40
@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 353d65637dc416003325643c10adac4c8da209c8, but the PR head is now d0cd80a7a09903324ced70f1958ecc53627863bc. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

@steipete
steipete force-pushed the steipete/runner-picker-device-dispatch branch from d0cd80a to 5c9fc30 Compare August 19, 2026 05:57
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready evidence is complete on exact head 5c9fc309f6cef8c58d5d6ed28e032da3143ebd7c.

  • Exact-head CI is green after composing eight current-main conflicts.
  • Real paired-node lifecycle passed the actual Gateway/node supervisor/workspace/turn/move/disconnect/capacity/role-removal flow.
  • Live Control UI proof passed the real served New Session flow: selected the actual node, managed-worktree create without execNode, exact device dispatch, first send, assistant completion, active provider-device worker environment, writer/admin scope matrix, offline retained host identity, and exact reconnect slots.
  • The first live readback attempt compared the public node:<deviceId> inventory id with the intentionally distinct durable worker-environment id. The corrected owner assertion passed without a source change.
  • The inspected live recording is attached in the PR body. The separate live screenshot was not published because it contained an ephemeral private hostname; the sanitized mock before/after comparison remains attached.
  • Post-rebase proof: 743 server tests, 149 UI units, 47 browser E2E tests, full changed gate, docs, i18n, Kysely, UI build, full build, diff check, and fresh autoreview clean (0.98).

The PR body now contains the current LOC split and complete evidence.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

The requested fresh-head ClawSweeper review started for 5c9fc309f6cef8c58d5d6ed28e032da3143ebd7c, but its lease expired without publishing a verdict or rank-up moves. No ClawSweeper finding is being skipped; none was emitted for this head.

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 scripts/pr review/prepare/merge guards remain authoritative and will not be bypassed.

@steipete
steipete merged commit 80934e5 into main Aug 19, 2026
239 checks passed
@steipete
steipete deleted the steipete/runner-picker-device-dispatch branch August 19, 2026 08:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
obviyus added a commit that referenced this pull request Oct 16, 2026
…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 |
| --- | --- |
| ![before menu](https://github.com/user-attachments/assets/2e713cae-3bc6-47af-b378-d67e86b82beb) | ![after menu](https://github.com/user-attachments/assets/b9cdae9e-e0ba-4766-98fd-7cbaece41774) |

| Device listing | Picked folder | Missing typed path falls back |
| --- | --- | --- |
| ![device listing](https://github.com/user-attachments/assets/99f21484-e711-478b-9b91-07d676f08c6b) | ![picked](https://github.com/user-attachments/assets/ff604832-d78e-4f2d-a70f-4109a00371db) | ![fallback](https://github.com/user-attachments/assets/f8de3452-59a6-4c5d-b43c-a0291673d63c) |

**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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…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 |
| --- | --- |
| ![before menu](https://github.com/user-attachments/assets/2e713cae-3bc6-47af-b378-d67e86b82beb) | ![after menu](https://github.com/user-attachments/assets/b9cdae9e-e0ba-4766-98fd-7cbaece41774) |

| Device listing | Picked folder | Missing typed path falls back |
| --- | --- | --- |
| ![device listing](https://github.com/user-attachments/assets/99f21484-e711-478b-9b91-07d676f08c6b) | ![picked](https://github.com/user-attachments/assets/ff604832-d78e-4f2d-a70f-4109a00371db) | ![fallback](https://github.com/user-attachments/assets/f8de3452-59a6-4c5d-b43c-a0291673d63c) |

**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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR plugin: file-transfer size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant