Skip to content

feat(ui): run sessions on cloud workers - #107670

Merged
steipete merged 14 commits into
mainfrom
codex/cloud-worker-control-ui
Jul 14, 2026
Merged

steipete merged 14 commits into
mainfrom
codex/cloud-worker-control-ui

Conversation

@steipete

@steipete steipete commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #104294

What Problem This Solves

Cloud worker profiles were available through the Gateway, but Control UI users could not select one when creating a session. Starting a remote session required direct RPC/CLI work and offered no safe browser recovery if dispatch or the first send crossed a reconnect.

Why This Change Was Made

The New Session page now discovers configured worker profiles, exposes them under Where, forces the managed-worktree contract required by dispatch, and hands the first turn to the active worker. A credential-scoped, current-tab recovery record preserves ambiguous handoffs without leaking tasks across Gateway identities; definitive failures tear down the worker and return the draft to an editable state.

User Impact

Operators can choose Cloud · in Control UI, start the session remotely, and keep using the normal sidebar/chat flow. Sidebar rows show cloud placement state, attachments survive recovery, and stale or failed handoffs no longer strand billable workers or lock the composer indefinitely.

Evidence

  • node scripts/run-vitest.mjs ui/src/pages/new-session/cloud-recovery.test.ts ui/src/pages/new-session/cloud-recovery-state.test.ts ui/src/pages/new-session/cloud-submit.test.ts ui/src/pages/new-session/cloud-target.test.ts ui/src/e2e/new-session-page.e2e.test.ts — 47 focused unit tests and 28 Chromium E2E tests passed.
  • node scripts/run-tsgo.mjs -p tsconfig.ui.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/ui.tsbuildinfo — passed.
  • Targeted scripts/run-oxlint.mjs, Control UI i18n verification, and git diff --check — passed.
  • Structured autoreview — clean; no accepted or actionable findings remain.
  • Testbox-through-Crabbox tbx_01kxgvr4x9wb3dntay5yx6fzqa — exact-head pnpm check:changed passed in 19m16s (Actions run); lease stopped cleanly.
  • Credential rotation, reconnect recovery, attachment retry, terminal-worker redispatch, definitive rejection cleanup, and missing-session recovery have regression coverage.
  • ClawMac live proof — selected Cloud · aws in Control UI, created a forced worktree session, completed a real OpenClaw turn on AWS, remotely verified the nonce artifact, refreshed the browser with chat and Cloud worker: active badge intact, and then destroyed the environment, session, worktree, and lease.
  • Negative live proof — an otherwise dispatchable managed-worktree session bound to claude-cli was rejected with cloud worker dispatch requires the OpenClaw runtime, not claude-cli; cleanup completed.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

https://github.com/openclaw/openclaw/blob/10dd84ee8d78b27609f38e3c33fa3697e80e8496/CHANGELOG.md#L15
P2 Badge Remove the normal feature entry from the release changelog

This commit is adding a normal feature note directly under CHANGELOG.md, but the repo instructions for CHANGELOG.md say it is release-only and that normal PRs/direct fixes should put release-note context in the PR body or squash/direct commit message because release generation owns this file. Leaving this entry here risks stale or duplicated release notes when the generated changelog is cut.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete
steipete force-pushed the codex/cloud-worker-control-ui branch from 10dd84e to 9c1ced4 Compare July 14, 2026 17:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2f19d276e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 737 to 741
if (!result) {
if (requestId !== this.submitRequestToken) {
return;
}
this.error = context.sessions.state.error ?? t("newSession.createFailed");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear cloud recovery when create fails

When a cloud target is selected, pendingCloud.stageCreate(...) has already persisted a recovery record and set pendingCloud.sessionKey before sessions.create runs. If createResult returns null for a definitive create failure such as worktree creation/base-ref/permission errors, this branch only sets an error, so the page remains in pending-cloud mode with the message and target controls locked and reload restores the same failing creating record; clear the staged recovery and return the draft to editable state when no session was created.

Useful? React with 👍 / 👎.

Comment on lines +38 to +39
${params.placementState
? html`<span

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid badging local placements as cloud workers

When cloud workers are configured, ordinary local runs can still get a placement row: withLocalSessionPlacementTurnAdmission records a local turn claim, ensureLocal inserts state local, and sessions.list projects any placement record. This check renders the cloud/server badge for every truthy placement state, so local sessions that have run show a misleading Cloud worker: local badge; restrict the badge to worker-owned/terminal cloud states or explicitly exclude local.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the codex/cloud-worker-control-ui branch from d2f19d2 to e27081f Compare July 14, 2026 17:46
@steipete steipete self-assigned this Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e27081f8fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +417 to +418
this.agentId = this.pendingCloud.agentId;
this.cloudProfileId = this.pendingCloud.profileId;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve recovered cloud agent selection

When a cloud recovery record for a non-default agent is restored before the first updated() reset, this recovered agentId is immediately overwritten by the unconditional adoptAgentDefaults() later in resetDraft(). If that recovered handoff then definitively fails and clears pendingCloud, the still-visible draft retains the message/cloud target but retries under the default agent instead of the recovered agent, or becomes disabled if the default agent cannot use worktrees.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the codex/cloud-worker-control-ui branch from a4cb66e to 54d47e9 Compare July 14, 2026 19:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54d47e9314

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return { status: "cleanup-rejected", error: cleanupError };
}
}
return { status: "rejected", placement };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reclaim failed placements before deleting drafts

When dispatch reaches a terminal placement such as failed, this returns dispatch-rejected after destroying the environment, and advanceCloudDraftSession immediately calls sessions.delete for the draft. The server-side delete guard rejects any placement that is not local (or reclaimed for delete) in src/gateway/server-methods/sessions-shared.ts, so a real failed placement remains undeletable, the recovery record is kept, and the New Session UI stays locked on a draft that cannot be retried or edited. Add a server-supported reclaim/clear path for terminal draft placements before relying on sessions.delete.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 54d47e9314218654996a4ccf00dd25bff22e8f6e:

  • Full hosted release gate: CI run 29361869763, 116/116 jobs completed successfully on the exact PR head.
  • Testbox through Crabbox: tbx_01kxh0sd758zp0szrxav9hzbxp; OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed exited 0 in 19m14.95s (Actions run 29361022737); the one-shot lease stopped after success.
  • Focused behavior: node scripts/run-vitest.mjs ui/src/pages/new-session/cloud-recovery.test.ts ui/src/pages/new-session/cloud-recovery-state.test.ts ui/src/pages/new-session/cloud-submit.test.ts ui/src/pages/new-session/cloud-target.test.ts ui/src/e2e/new-session-page.e2e.test.ts passed 47 unit tests plus 28 Chromium E2E tests.
  • UI typecheck, targeted oxlint, Control UI locale parity, generated protocol parity, and git diff --check passed.
  • Structured AutoReview completed with no accepted or actionable findings.
  • Live ClawMac proof on this patch: selected Cloud · aws in Control UI, created the forced managed-worktree session, completed a real OpenClaw turn on AWS, verified the remote nonce artifact, refreshed with chat and the Cloud worker: active badge intact, and destroyed the environment, session, worktree, and lease. Negative claude-cli dispatch proof rejected the unsupported runtime and cleaned up.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 107670 completed successfully with hosted exact-head gates. No known proof gaps; canonical-main ClawMac deployment and the same real E2E path will be repeated after merge.

@steipete
steipete merged commit 4f0e131 into main Jul 14, 2026
224 checks passed
@steipete
steipete deleted the codex/cloud-worker-control-ui branch July 14, 2026 19:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 15, 2026
* feat(ui): add cloud session targets

* test(ui): cover cloud session attachments

* test(ui): use recovery token fixture

* test(ui): record cloud locale fallbacks

* fix(ui): harden cloud session recovery

* fix(ui): track cloud handoff phase

* fix(ui): close cloud recovery escape paths

* fix(ui): finish cloud recovery hardening

* fix(ui): recover ambiguous cloud session creation

* fix(ui): isolate stale cloud creation recovery

* test(ui): preserve cloud recovery literals

* fix(ui): complete cloud session release artifacts

* chore: move cloud release note to PR body

* docs(ui): name cloud session menu exactly
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
* feat(ui): add cloud session targets

* test(ui): cover cloud session attachments

* test(ui): use recovery token fixture

* test(ui): record cloud locale fallbacks

* fix(ui): harden cloud session recovery

* fix(ui): track cloud handoff phase

* fix(ui): close cloud recovery escape paths

* fix(ui): finish cloud recovery hardening

* fix(ui): recover ambiguous cloud session creation

* fix(ui): isolate stale cloud creation recovery

* test(ui): preserve cloud recovery literals

* fix(ui): complete cloud session release artifacts

* chore: move cloud release note to PR body

* docs(ui): name cloud session menu exactly
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 size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Cloud workers — run agent sessions on ephemeral SSH-reachable machines

1 participant