Skip to content

fix: archive sessions with provisioning cloud workers - #145170

Merged
steipete merged 3 commits into
mainfrom
codex/archive-provisioning-worker
Sep 11, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/archive-provisioning-worker

Conversation

@steipete

@steipete steipete commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Added a Gateway sessions.patch regression 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.
  • Extended the existing cancellation matrix to cover archive during dispatch transitions and rejection of replacement ownership.
  • Focused archive, deletion, reclaim, recovery, and idle-stop tests; final archive/recovery rerun: 51 passed, cancellation matrix: 9 passed. Production/test types, changed-file lint and repository guards passed; independent reviews found no actionable P0–P2 issues.
  • CI follow-up removes a type-only import cycle. It also adds nine lines to the shared merge-test mock for the author lookup introduced by fix(scripts): drop unverified local git identities from squash co-author credit #145128; both unrelated CI failures were reproduced on current main and pass with the fixture repair. No production merge-tooling changes.
  • Live browser verification was unavailable because the Chrome relay reported an ownership conflict. No UI appearance changes or live Gateway deployment are included.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 18:54
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 3:21 PM ET / 19:21 UTC (Revision 2).

ClawSweeper review

What this changes

Archiving 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
Reviewed head: 05c668ca3e721a10ba9f5e102fed36eead478ab9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with useful regression coverage and no supported blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored exemption applies. Supplied tests exercise archive cleanup and replacement rejection with mocked provider operations; no live backend result is claimed, and the related UI screenshots do not establish one.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored exemption applies. Supplied tests exercise archive cleanup and replacement rejection with mocked provider operations; no live backend result is claimed, and the related UI screenshots do not establish one.
Evidence reviewed 8 items Current-main necessity: Current main rejects any placement that is neither active nor already safe for mutation, including provisioning. Its existing Stop capability therefore does not already solve archive's blocked entry point.
Latest-release comparison: The latest supplied release tag and fetched main both contain lifecycle blob b6a4dfa0b4b8bb0923cc5b2f92410ff0f559dcd4, retaining the same provisioning refusal.
Cleanup ordering and identity: Provisioning Stop starts before ordinary cancellation can settle its dispatch. Archive awaits cleanup, then captures a fresh placement mutation guard; active placements retain drain-before-reclaim ordering. The source check accepts only transitions recorded by captured predecessor operations.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +32, Tests +110, Docs 0. Total +142 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 8 70 38 +32
Tests 5 172 62 +110
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 243 101 +142

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +32 lines; tests and test support +110 lines Production growth supports captured-dispatch ordering and source checks, while regression coverage checks cleanup completion, failure retention, and replacement rejection.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This repairs blocked archive and delete operations for cloud-worker sessions without evidence of a broader runtime outage.
  • 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 maintainer-authored exemption applies. Supplied tests exercise archive cleanup and replacement rejection with mocked provider operations; no live backend result is claimed, and the related UI screenshots do not establish one.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-11T19:00:49.903Z sha 7e6c3098939e47e76a36ae7ec6d3d9ff12f20fcb :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/archive-provisioning-worker branch from 89a61bf to 05c668c Compare September 11, 2026 19:15
@steipete
steipete merged commit 03234b5 into main Sep 11, 2026
179 checks passed
@steipete
steipete deleted the codex/archive-provisioning-worker branch September 11, 2026 19:41
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant