Skip to content

fix: re-adopt healthy cloud workers after Gateway restart - #112928

Merged
steipete merged 1 commit into
mainfrom
claude/restart-adoption
Jul 23, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/restart-adoption

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #112869
Closes #112870

AI-assisted: implemented and reviewed with Codex. The maintainer understands and approved the change.

What Problem This Solves

Fixes an issue where restarting the Gateway discarded healthy attached cloud workers, released their leases, and forced sessions to pay the full dispatch delay again. It also resolves orphaned workspace recovery journals that logged forever, and makes a reclaim whose tunnel disappears after durable teardown report the committed success instead of a stale error.

Why This Change Was Made

Worker bundle identity now excludes lazily built Control UI assets, which never execute on workers but previously changed the bundle hash between otherwise identical Gateway starts. Exact worker runtime bytes remain admission-fenced; incompatible workers are cleanly destroyed and reclaimed rather than recorded as bootstrap failures.

Startup journal GC now deletes only rows whose exact monotonic placement owner can no longer apply them, while retaining the named forced-teardown rollback contract. Reclaim uses a typed tunnel-owner disconnect error and normalizes the shared in-flight promise only after the placement has durably reached reclaimed, so coalesced callers agree and unrelated errors remain failures.

User Impact

Gateway restarts no longer discard healthy cloud workers because of lazy Control UI build timing; dead recovery journals are collected once, and completed reclaim operations no longer surface a stale tunnel error.

Evidence

  • Live before-fix reproduction with one real AWS cloud worker: an exact-head restart changed the worker bundle from 203696a… to 392f4a…, moved the placement from active to reclaimed, and released the lease. Extracting the two bundles showed the only changed subtree was dist/control-ui/**.
  • Live patched Gateway: startup emitted one discarded orphaned cloud workspace journal event for a7a66d3d-8826-4382-bea9-c2a23eb9977f; the row count became zero and Gateway health returned ok: true.
  • node scripts/run-vitest.mjs src/gateway/worker-environments/: 102 files passed, 1,263 tests passed.
  • node scripts/check-changed.mjs -- <13 touched files>: Blacksmith Testbox tbx_01ky6p9k690fqvszz3pe5vza25, Actions run 29981588569, exit 0 (19m18s command time).
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main: clean, no accepted/actionable findings.
  • Cleanup verified: dev Gateway stopped, port 19001 closed, and zero AWS Crabbox leases remained.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Jul 23, 2026
@steipete
steipete marked this pull request as ready for review July 23, 2026 05:33
@steipete
steipete merged commit 7381924 into main Jul 23, 2026
195 of 198 checks passed
@steipete
steipete deleted the claude/restart-adoption branch July 23, 2026 05:45
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

1 participant