Repository navigation
fix: archive sessions with provisioning cloud workers - #145170
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 3:21 PM ET / 19:21 UTC (Revision 2). ClawSweeper reviewWhat this changesArchiving or deleting a session now cancels provisioning and retries failed worker cleanup through the existing Stop service before committing the session change. Merge readiness✅ Ready for maintainer review Keep open: current main and the latest release still reject provisioning archives. This is a focused repair with no actionable correctness findings. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway manages session records and the cloud workers running their work. Archive and delete requests must stop that work, preserve workspace results, and confirm cleanup before changing the session. flowchart TD
A[Archive or delete request] --> B[Check session authority]
B --> C{Worker state}
C -->|Provisioning| D[Cancel captured dispatch]
C -->|Running or failed| E[Drain and safely reclaim]
D --> F{Cleanup confirmed}
E --> F
F -->|Yes| G[Commit session change]
F -->|No| H[Retain session and recovery state]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +32, Tests +110, Docs 0. Total +142 across 14 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one Stop owner for cancellation, reconciliation, and confirmed teardown, with archive and delete committing only after that owner safely releases the worker. Do we have a high-confidence way to reproduce the issue? Yes, from source: archiving a session with a provisioning placement reaches an unconditional refusal on current main. The new regression models that entry point; this read-only review did not execute it. Is this the best way to solve the issue? Yes. Reusing the existing Stop service avoids competing cleanup logic and preserves reconciliation, authorization, and failure-retention safeguards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f770fd99e0ce. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
89a61bf to
05c668c
Compare
|
Merged via squash.
|
* fix: archive sessions with provisioning cloud workers * refactor(workers): keep cancellation types in the leaf service contract * test: align merge fixtures with verified author lookups
What Problem This Solves
Fixes an issue where users archiving a session would be told to wait indefinitely when its cloud worker placement was stuck provisioning. Failed placements also required a separate Stop action before archive could retry cleanup.
Why This Change Was Made
Archive and delete now use the existing worker Stop owner to cancel dispatch and retry failed teardown. Startup cancellation is captured before the session drain can change its placement; running workers retain drain-before-reconciliation ordering. Source checks follow only transitions recorded by the captured dispatch, so a replacement worker cannot be mistaken for the original owner.
The archive commits only after confirmed worker cleanup. Active workers still reconcile their workspace first, and cleanup errors retain the session and recovery state. An already-running workspace reconciliation remains protected. Existing persisted placements use the same cleanup path without a config or storage migration.
User Impact
Archiving stops the cloud worker automatically, including provisioning left behind by an interrupted dispatch. If provider cleanup fails, retrying archive retries cleanup without discarding unsynced work.
Evidence
sessions.patchregression using the real placement store and Stop service. It failed before the fix; it now proves archive waits for confirmed destruction and retains the session on provider failure.