Skip to content

fix(gateway): reject outdated workers during pending recovery - #125083

Merged
steipete merged 1 commit into
mainfrom
steipete/w3-worker-recovery-fix
Aug 17, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/w3-worker-recovery-fix

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Gateway restart recovery could reuse a worker that matched the saved bundle and placement ownership but did not support the current execution-context launch contract. A durable pending workspace result could therefore cross into tunnel recovery through an outdated worker instead of failing closed for reprovisioning.

Why This Change Was Made

The full active-worker reuse invariant now has one owner. Active-placement adoption, runtime reconciliation, and pending workspace-result recovery all consume the same predicate, including its current execution-context capability check. The two divergent local predicates and an obsolete exported type surface are removed.

No protocol, config, storage schema, migration, or compatibility surface changes. Current workers behave as before; only outdated workers are rejected from pending-result recovery.

Provenance

User Impact

After a Gateway restart, a pending worker result can no longer be recovered through an outdated worker launch dialect. The placement fails closed and can be reprovisioned instead of using stale execution-context semantics.

Production LOC: +34/-61 (net -27) | Tests/test support: +72/-4 (net +68).

Evidence

  • Pre-fix regression: node scripts/run-vitest.mjs src/gateway/worker-environments/placement-dispatch.test.ts failed exactly because the dialect-mismatched pending result became reclaimed rather than failed (49 passed, 1 failed). The same regression now lives in the dedicated restart-recovery suite.
  • Post-fix focused proof: node scripts/run-vitest.mjs src/gateway/worker-environments/placement-dispatch.test.ts src/gateway/worker-environments/placement-dispatch-recovery.test.ts — 2 files, 52 tests passed.
  • Post-rebase changed gate: linked-worktree-safe node scripts/check-changed.mjs (the repository pnpm check:changed owner) — success on Blacksmith Testbox, run https://github.com/openclaw/openclaw/actions/runs/31997453361. Core/core-test typechecks, changed-file lint, dead exports, import cycles, database-first, schema, sidecar, pairing, formatting, and selected guards passed.
  • P1-depth structured autoreview on exact branch diff: clean; no accepted/actionable findings.

Best-fix verdict: best. The placement-failure boundary already owns the shared environment/placement types and failure policy, so it is the canonical home for the reusable invariant. Keeping a second pending-result predicate, adding only a consumer-side feature check, or preserving an alias would leave the same drift class in place.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 05:38
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper exact-head outcome: patch correct (0.91), no review findings, security cleared, and this PR is the canonical root-cause repair. The P1 marker is the confirmed bug's triage severity, not a technical finding.

Rank-up move: rebase on current main and complete exact-head CI, including focused worker recovery proof.

This satisfies the substantive rank-up proof without changing the reviewed patch.

@steipete
steipete merged commit 0af3b86 into main Aug 17, 2026
274 of 276 checks passed
@steipete
steipete deleted the steipete/w3-worker-recovery-fix branch August 17, 2026 06:11
@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: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant