Repository navigation
fix(ui): restore failed cloud sessions from Chat - #135024
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 4:52 AM ET / 08:52 UTC. ClawSweeper reviewWhat this changesThe 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 readinessKeep 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 Review scores
Verification
How this fits togetherChat 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +397, Tests +322, Other +4. Total +723 across 26 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
07b2871 to
2ff8be4
Compare
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.dispatchRPC, 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
recoveryActionfrom 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, andfailedplacements as unavailable. Transitional states show an attached busy status;local,active, andreclaimedremain 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.
After: failed placement exposes the recovery action beside the disabled composer.
syncingtoactive.pnpm test packages/gateway-protocol/src/schema/session-placement.test.ts src/gateway/server.sessions.placement-projection.test.ts: 50 tests passed after rebasing ontoorigin/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.