Repository navigation
fix(gateway): reject outdated workers during pending recovery - #125083
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
8631832048cf, 2026-07-19) split pending-result recovery intoplacement-dispatch-pending-results.tsand carried a copy of the then-current active-environment predicate.73a9eed95ba2, authored by @joshavant and manually squash-merged 2026-08-11) added theworker-execution-context-v1fence to the original restart-recovery predicate, but the split copy was not updated. That made the duplicated policy drift and left pending-result recovery able to accept the legacy launch shape.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
node scripts/run-vitest.mjs src/gateway/worker-environments/placement-dispatch.test.tsfailed exactly because the dialect-mismatched pending result becamereclaimedrather thanfailed(49 passed, 1 failed). The same regression now lives in the dedicated restart-recovery suite.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.node scripts/check-changed.mjs(the repositorypnpm check:changedowner) — 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.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.