Skip to content

fix(ui): restore failed cloud sessions from Chat - #135024

Merged
jalehman merged 1 commit into
mainfrom
fix/failed-placement-restart-ui
Sep 1, 2026
Merged

jalehman merged 1 commit into
mainfrom
fix/failed-placement-restart-ui

Conversation

@jalehman

@jalehman jalehman commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Closes #134506

What Problem This Solves

Fixes an issue where operators could not continue an established session from the Control UI after its remote worker placement failed. Recovery required a manual sessions.dispatch RPC, and the composer still accepted turns while replacement placement was syncing even though worker admission rejected them.

Why This Change Was Made

The Gateway projects a closed recoveryAction from worker-environment lifecycle evidence. Chat uses that projection to offer either Restart session… or Stop cloud worker…, reuses the existing target picker, and keeps environment-liveness admission in the Gateway.

The composer also treats requested, provisioning, syncing, starting, draining, reconciling, and failed placements as unavailable. Transitional states show an attached busy status; local, active, and reclaimed remain sendable.

User Impact

Operators can recover failed cloud or device sessions from Chat without creating a replacement session or invoking a low-level RPC. While a replacement environment is being prepared, Chat disables sending and explains the current placement step.

Evidence

Before: failed placement exposed an error but no recovery action near the composer.

Failed placement before the fix

After: failed placement exposes the recovery action beside the disabled composer.

Failed placement recovery after the fix

  • Live OCM verification restarted the existing session and preserved its session identity. The replacement placement progressed through syncing to active.
  • Mocked Chromium verification covered failed recovery and syncing progress; both scenarios passed.
  • pnpm test packages/gateway-protocol/src/schema/session-placement.test.ts src/gateway/server.sessions.placement-projection.test.ts: 50 tests passed after rebasing onto origin/main.
  • pnpm --dir ui exec vitest run --config vitest.config.ts src/pages/chat/chat-pane-placement-composer.test.ts src/pages/chat/chat-pane-placement-restart.test.ts src/pages/chat/chat-pane-placement.test.ts src/pages/chat/components/chat-pane-placement.test.ts src/pages/chat/chat-composer.test.ts: 76 tests passed after rebasing.
  • node scripts/check-changed.mjs: complete changed-file gate passed.
  • pnpm ui:build: production Control UI build passed.
  • P0 Autoreview: 12 of 12 review passes returned no actionable findings.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@jalehman
jalehman marked this pull request as ready for review September 1, 2026 08:44
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Sep 1, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 4:52 AM ET / 08:52 UTC.

ClawSweeper review

What this changes

The PR lets Control UI operators restart a failed remote session on a compatible target, requires worker cleanup when necessary, and visibly disables Chat while a replacement placement is unavailable.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. This is a still-needed maintainer-authored recovery fix: current main does not contain the new failed-placement action or Chat availability behavior, and the Gateway retains final lifecycle validation before a restart can dispatch. No concrete introduced correctness or security defect was found.

Priority: P1
Reviewed head: 07b287175e183fa9d4a110fdde43088039a341dc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent, well-covered recovery implementation with no verified blocking defect; the remaining review attention is proportional to its sizable but owner-aligned production change.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nonetheless reports an OCM restart through syncing to active and includes before/after UI attachments; the attachment content was unavailable for independent inspection here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nonetheless reports an OCM restart through syncing to active and includes before/after UI attachments; the attachment content was unavailable for independent inspection here.
Evidence reviewed 6 items Gateway recovery projection: The introduced projection maps a failed placement to restart only when the existing lifecycle predicate proves its environment is gone; otherwise it reports stop-first.
Final dispatch authority remains server-side: The existing sessions.dispatch owner repeats the same environment-gone predicate immediately before allowing failed-placement redispatch, so the UI field does not grant recovery authority.
Chat recovery and unavailable-state behavior: The introduced presentation maps failed, provisioning, syncing, starting, draining, and reconciling placement states into disabled composer behavior and an actionable failed-session banner.
Findings None None.
Security None None.

How this fits together

Chat consumes the Gateway’s session-placement projection to decide whether an operator can send, stop a worker, or restart a failed session. The Gateway remains the authority that admits or rejects the eventual redispatch based on current worker lifecycle state.

flowchart LR
A[Remote worker failure] --> B[Gateway placement state]
B --> C[Recovery action projection]
C --> D{Old worker gone?}
D -->|Yes| E[Restart target picker]
D -->|No| F[Stop worker first]
E --> G[Gateway dispatch validation]
F --> G
G --> H[Chat composer status]
Loading

Before merge

  • Resolve merge risk (P1) - The bug fix has a +401 net production-line delta; it should retain the single shared placement presentation and the Gateway’s final lifecycle check rather than developing separate header and composer recovery policies.
  • Resolve merge risk (P1) - The supplied before/after attachment images could not be retrieved in this review environment, so their visual content was not independently inspected; this is a reviewer limitation, not a request for contributor proof.
  • Complete next step (P2) - This maintainer-authored, protected-label PR has a coherent implementation and no narrow autonomous repair finding.
Agent review details

Security

None.

PR surface

Source +397, Tests +322, Other +4. Total +723 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 16 524 127 +397
Tests 8 322 0 +322
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 6 2 +4
Total 26 852 129 +723

Review metrics

Metric Value Why it matters
Production versus test delta production +530/-129 (net +401); tests/support +322/-0 The production growth implements the Gateway projection and shared Chat recovery state; the test growth exercises protocol projection, UI composition, and redispatch behavior.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/placement-projector.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #134506
Summary: This PR is the linked candidate fix for the canonical failed-cloud-session recovery report; it remains open and unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the Gateway-computed advisory action and one shared Chat placement presentation, with sessions.dispatch continuing to revalidate lifecycle state at the final owner boundary.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the Gateway-computed advisory action and one shared Chat placement presentation, with sessions.dispatch continuing to revalidate lifecycle state at the final owner boundary.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: the base UI exposed no restart path for failed placements while the existing Gateway dispatch owner already accepted redispatch once the environment-gone predicate held. The linked issue supplies the concrete worker-loss scenario, although this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Projecting a narrow advisory recovery action to Chat while retaining the Gateway’s final lifecycle predicate is the smallest maintainable way to expose the existing redispatch contract without moving authority into the UI.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 22b58372238a.

Labels

Label changes:

  • add P1: The change restores recovery for an established remote session that otherwise cannot continue through the Control UI.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nonetheless reports an OCM restart through syncing to active and includes before/after UI attachments; the attachment content was unavailable for independent inspection here.

Label justifications:

  • P1: The change restores recovery for an established remote session that otherwise cannot continue through the Control UI.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply. The supplied body nonetheless reports an OCM restart through syncing to active and includes before/after UI attachments; the attachment content was unavailable for independent inspection here.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@roboclaw-bot
roboclaw-bot force-pushed the fix/failed-placement-restart-ui branch from 07b2871 to 2ff8be4 Compare September 1, 2026 19:16
@jalehman
jalehman enabled auto-merge (squash) September 1, 2026 19:37
@jalehman
jalehman merged commit 0b1cdf9 into main Sep 1, 2026
285 checks passed
@jalehman
jalehman deleted the fix/failed-placement-restart-ui branch September 1, 2026 19:57
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
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 gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Failed cloud sessions cannot be restarted from Control UI

1 participant