Repository navigation
fix(ui): prevent cloud draft recovery dead ends - #120970
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
🦞👀 Pull request received. I will update this pull request when review starts. |
bb4e124 to
f1d250d
Compare
|
Codex review: found issues before merge. Reviewed August 9, 2026, 4:49 AM ET / 08:49 UTC. ClawSweeper reviewWhat this changesThe PR improves Control UI cloud-session recovery and adds a Stop action for non-active cloud workers that have an environment. Merge readinessKeep this PR open: most recovery repairs are coherent, but the new Stop action can offer a dead-end during attached-worker teardown states. The protected maintainer label and unresolved lifecycle contract require maintainer handling before merge. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI creates and recovers cloud sessions through Gateway placement and environment APIs. It presents recovery outcomes and session controls to operators after placement state changes. flowchart LR
A[New session form] --> B[Cloud placement]
B --> C[Gateway lifecycle]
C --> D[Recovery state]
D --> E[Visible UI outcome]
E --> F[Session Stop action]
Decision needed
Why: The UI cannot safely infer attachment ownership from placement state, while the raw Gateway method intentionally rejects attached workers. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +164, Tests +241. Total +405 across 20 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make Stop available only when Gateway can prove the worker is unattached, or add a Gateway-owned lifecycle operation with explicit safe teardown semantics and cover transitional and failed states. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: a draining, reconciling, or failed placement with an attached environment receives the new Stop action, while Gateway rejects its raw destroy request. Is this the best way to solve the issue? No: the UI currently infers destruction eligibility from placement state even though Gateway owns attachment lifecycle; narrow the UI action or add a stateful Gateway contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 29c442d48389. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
f1d250d to
ead07d2
Compare
|
Merged via squash.
|
* fix(ui): harden cloud draft recovery Refs openclaw#120953. * fix(gateway): keep minimal metadata startup lazy * fix(ui): preserve interrupted cloud setup state * fix(ui): separate cloud recovery lifecycle fences
Refs #120953
What Problem This Solves
Fixes four dead ends in the Control UI cloud new-session flow: transient placement lookup failures could leave paid workers orphaned, recovery ownership changes could fail silently and replay a stale send, interrupted tab navigation could incorrectly blame a Gateway change, and pending cloud placements with a live environment had no stop-worker action.
Why This Change Was Made
The UI now cleans up the last known environment before rejecting an ambiguous placement lookup, retires only the current submission's recovery state when another window takes ownership, records the actual interruption reason for recovery messaging, and routes stop-worker actions through the placement owner: active placements use
sessions.reclaim, while pending placements with an environment use unforcedenvironments.destroy.This PR is limited to the Control UI. The two Gateway issues described in #120953 are intentionally excluded and remain owned by the sibling Gateway branch. AI-assisted; no agent transcript is included.
User Impact
Cloud sessions now leave a visible, accurate outcome instead of silently replaying work or blaming an unrelated Gateway change. Users can also stop paid workers that are stuck before the active state, while active workers keep the existing reclaim behavior and confirmation flow.
Evidence
node scripts/run-vitest.mjs ui/src/pages/new-session/ ui/src/e2e/mcp-app-conformance.e2e.test.ts ui/src/e2e/control-ui-auth-transports.e2e.test.ts ui/src/e2e/new-session-page.cloud-startup.e2e.test.ts src/gateway/server-chat-metadata-lifecycle.test.ts src/gateway/server-methods/chat-metadata-runtime.test.ts: gateway 23 tests passed; UI 8,086 passed and 46 skipped; browser E2E 10 tests passed. The first broad UI pass exposed an order-sensitiveui/src/app/overlays.test.tsfailure; its isolated rerun passed 47/47 and the required aggregate retry passed.node scripts/run-oxlint.mjswith no findings.pnpm ui:i18n:baselineverified 97 raw-copy baseline entries and 4,615 source keys with no baseline diff.git diff --checkpassed.Reduced ownership model and land-onto-red repair
The pre-existing
mainControl UI E2E breakage came from #120926 eagerly running thechat.metadatacatch-up refresh during minimal Gateway startup. On that path, the roughly 120-second model-catalog build blocked startup. This PR includes the land-onto-red repair: minimal metadata startup stays lazy, so the catch-up refresh no longer blocks the startup path.Cloud recovery now uses the simpler ownership identity of Gateway URL, recovery scope, and session key. The realm-local lease/successor-token design was removed after repeated reset/remount races. The accepted tradeoff is that concurrent same-key replacement pages may both clear recovery in the rare multi-tab flow; preserving that edge is not worth reintroducing the ownership machinery.