Repository navigation
feat(ui): run sessions on cloud workers - #107670
Conversation
There was a problem hiding this comment.
💡 Codex Review
https://github.com/openclaw/openclaw/blob/10dd84ee8d78b27609f38e3c33fa3697e80e8496/CHANGELOG.md#L15
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".
10dd84e to
9c1ced4
Compare
There was a problem hiding this comment.
💡 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".
| if (!result) { | ||
| if (requestId !== this.submitRequestToken) { | ||
| return; | ||
| } | ||
| this.error = context.sessions.state.error ?? t("newSession.createFailed"); |
There was a problem hiding this comment.
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 👍 / 👎.
| ${params.placementState | ||
| ? html`<span |
There was a problem hiding this comment.
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 👍 / 👎.
d2f19d2 to
e27081f
Compare
There was a problem hiding this comment.
💡 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".
| this.agentId = this.pendingCloud.agentId; | ||
| this.cloudProfileId = this.pendingCloud.profileId; |
There was a problem hiding this comment.
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 👍 / 👎.
a4cb66e to
54d47e9
Compare
There was a problem hiding this comment.
💡 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 }; |
There was a problem hiding this comment.
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 👍 / 👎.
|
Land-ready proof for
|
|
Merged via squash.
|
* 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
* 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
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.scripts/run-oxlint.mjs, Control UI i18n verification, andgit diff --check— passed.tbx_01kxgvr4x9wb3dntay5yx6fzqa— exact-headpnpm check:changedpassed in 19m16s (Actions run); lease stopped cleanly.Cloud · awsin Control UI, created a forced worktree session, completed a real OpenClaw turn on AWS, remotely verified the nonce artifact, refreshed the browser with chat andCloud worker: activebadge intact, and then destroyed the environment, session, worktree, and lease.claude-cliwas rejected withcloud worker dispatch requires the OpenClaw runtime, not claude-cli; cleanup completed.