Repository navigation
fix(infra): join the shared worker host at terminal native close - #206930
Merged
Merged
Conversation
Since #206721 one-shot processes host plain task-pool workers (plugin catalog reader) in the shared worker host. Their pools have no native close, so terminal native source close found the host alive and threw 'Native worker execution owners have not joined'. In the update finalize worker that set exit 1, and shipped 2026.11.10 updaters rolled back the update. The host now registers with its native source; terminal close stops its remaining endpoints so the host joins.
Contributor
|
🦞👀 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. |
Collaborator
Author
|
Landed in d359ea2.
|
roboclaw-bot
added a commit
that referenced
this pull request
Nov 27, 2026
Bring in #206930 so the historical published updaters can finish Doctor without a live worker host. No conflict resolution or additional runtime changes. Co-authored-by: daniel-lxs <[email protected]>
This was referenced Nov 27, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 28, 2026
…nclaw#206930) ## Problem On macOS, a stable 2026.11.10 install rolls back when it updates to current `main`. - The updater runs the target's `update-migrated-finalize.worker.js --doctor`. Doctor finishes ("Doctor complete."), then the worker exits 1 and the updater restores the previous package and databases. - The saved failure keeps only `exit; └ Doctor complete.; Doctor: Update schema admission`, plus a truncated `Native worker execution owners have not joined`. - Reproduced in scratch: a fresh `[email protected]` (setup baseline, Gateway started and killed) running `openclaw update --tag <main package>`. 2 of 3 runs rolled back. - Every `doctor` run on `main` against that state prints `CLI cleanup failed: shared-state: Native worker execution owners have not joined` (5/5). Cause (regression from openclaw#206721): - The finalize worker runs with the `cli-oneshot` database role (`src/infra/update-migrated-finalize.worker.ts:92`). Since openclaw#206721, `claimsSharedHostSlot` therefore hosts its core workers in the shared worker host. That includes the plugin model catalog reader, a plain task pool with no native close of its own. - The shared host's physical worker is a retained native worker. At exit, `closeDefaultRetainedNativeWorkerSource` (`:649`) finds it still alive, because the catalog reader endpoint was never stopped. `source.close()` throws (`src/infra/worker-native-lifecycle.ts:398`), and the worker's catch sets `process.exitCode = 1` (`:675-677`). - Before openclaw#206721, that reader was a plain worker outside native custody. Bisect: the teardown error appears in 0/3 Doctor runs at `4587727e` (parent of openclaw#206721), 3/3 at `bfb9fb67`, and 5/5 at `68bccee8`. ## Fix `src/infra/shared-worker-host.ts`: when the host starts, it registers with its native source. Terminal close of that source stops the endpoints that are still live (reason `shutdown`), so the host joins before the source checks for live workers. No new state, flag or option. ## Impact | PR | Population | Failure class | Evidence | |---|---|---|---| | this | Every install that updates through a shipped updater (2026.11.10 and earlier) to a release that contains openclaw#206721: the target's finalize worker exits 1 and the update rolls back. Every one-shot CLI command on `main` (`doctor`, `agent --local`, …) also prints the false teardown failure. Gateway: shutdown with the lean profile, through the same native source close. | Update/Doctor, cluster A (target Doctor gates the update) | `src/infra/update-migrated-finalize.worker.ts:92,649,675-677`; `src/infra/shared-worker-host.ts:84-105`; `src/infra/worker-native-lifecycle.ts:397-398` | User signal: the 2026.11.10 → main scratch upgrade (the release path for every stable user). Cluster A has 57 reports of target-Doctor exit 1 rolling back updates, for example openclaw#200606 and openclaw#203211. This regression is a new, unreleased instance of the same class. ## Evidence - Red on base, green with the fix: `src/infra/shared-worker-host.test.ts` › "joins the host at terminal native close when an endpoint's owner never stops it". On the merge base it fails with `Native worker execution owners have not joined`. - `doctor --fix --non-interactive` on 2026.11.10 state, built CLI: `main` 5/5 teardown failures; this branch 0/2. - Sibling tests pass: shared-worker-host (unqualified close), worker-native-lifecycle, worker-task-host, sqlite-worker-broker (lifecycle and core), agent-local cold start, agent-cli recovery. - `agent-local-rpc-cleanup.process.test.ts` fails on the merge base too: its background command hit the overall timeout at host load 40-58. - Upgrade from the latest stable, in scratch (`env -i`, own HOME, state dir, config path and npm prefix; fresh `[email protected]` from `setup --baseline`; Gateway started and killed; `openclaw update --tag <package> --yes --no-restart --json`): | Target | Runs | Outcome | `openclaw doctor` step | |---|---|---|---| | `main` `68bccee8` (full build, packed) | 3 | 2 rolled back (2026.11.10 restored); 1 passed, with a tracer attached | exit 1 after "Doctor complete." in the 2 failed runs | | this branch `099d54f3` (full build, packed) | 3 | 3/3 `ok`, `openclaw --version` = 2026.11.10 (099d54f) | completed/0, no teardown error | - Local ClawSweeper on `099d54f3`: complete, patch correct, no findings. Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot
pushed a commit
that referenced
this pull request
Nov 29, 2026
…6930) ## Problem On macOS, a stable 2026.11.10 install rolls back when it updates to current `main`. - The updater runs the target's `update-migrated-finalize.worker.js --doctor`. Doctor finishes ("Doctor complete."), then the worker exits 1 and the updater restores the previous package and databases. - The saved failure keeps only `exit; └ Doctor complete.; Doctor: Update schema admission`, plus a truncated `Native worker execution owners have not joined`. - Reproduced in scratch: a fresh `[email protected]` (setup baseline, Gateway started and killed) running `openclaw update --tag <main package>`. 2 of 3 runs rolled back. - Every `doctor` run on `main` against that state prints `CLI cleanup failed: shared-state: Native worker execution owners have not joined` (5/5). Cause (regression from #206721): - The finalize worker runs with the `cli-oneshot` database role (`src/infra/update-migrated-finalize.worker.ts:92`). Since #206721, `claimsSharedHostSlot` therefore hosts its core workers in the shared worker host. That includes the plugin model catalog reader, a plain task pool with no native close of its own. - The shared host's physical worker is a retained native worker. At exit, `closeDefaultRetainedNativeWorkerSource` (`:649`) finds it still alive, because the catalog reader endpoint was never stopped. `source.close()` throws (`src/infra/worker-native-lifecycle.ts:398`), and the worker's catch sets `process.exitCode = 1` (`:675-677`). - Before #206721, that reader was a plain worker outside native custody. Bisect: the teardown error appears in 0/3 Doctor runs at `afa038c1` (parent of #206721), 3/3 at `a6d787f1`, and 5/5 at `8bd18635`. ## Fix `src/infra/shared-worker-host.ts`: when the host starts, it registers with its native source. Terminal close of that source stops the endpoints that are still live (reason `shutdown`), so the host joins before the source checks for live workers. No new state, flag or option. ## Impact | PR | Population | Failure class | Evidence | |---|---|---|---| | this | Every install that updates through a shipped updater (2026.11.10 and earlier) to a release that contains #206721: the target's finalize worker exits 1 and the update rolls back. Every one-shot CLI command on `main` (`doctor`, `agent --local`, …) also prints the false teardown failure. Gateway: shutdown with the lean profile, through the same native source close. | Update/Doctor, cluster A (target Doctor gates the update) | `src/infra/update-migrated-finalize.worker.ts:92,649,675-677`; `src/infra/shared-worker-host.ts:84-105`; `src/infra/worker-native-lifecycle.ts:397-398` | User signal: the 2026.11.10 → main scratch upgrade (the release path for every stable user). Cluster A has 57 reports of target-Doctor exit 1 rolling back updates, for example #200606 and #203211. This regression is a new, unreleased instance of the same class. ## Evidence - Red on base, green with the fix: `src/infra/shared-worker-host.test.ts` › "joins the host at terminal native close when an endpoint's owner never stops it". On the merge base it fails with `Native worker execution owners have not joined`. - `doctor --fix --non-interactive` on 2026.11.10 state, built CLI: `main` 5/5 teardown failures; this branch 0/2. - Sibling tests pass: shared-worker-host (unqualified close), worker-native-lifecycle, worker-task-host, sqlite-worker-broker (lifecycle and core), agent-local cold start, agent-cli recovery. - `agent-local-rpc-cleanup.process.test.ts` fails on the merge base too: its background command hit the overall timeout at host load 40-58. - Upgrade from the latest stable, in scratch (`env -i`, own HOME, state dir, config path and npm prefix; fresh `[email protected]` from `setup --baseline`; Gateway started and killed; `openclaw update --tag <package> --yes --no-restart --json`): | Target | Runs | Outcome | `openclaw doctor` step | |---|---|---|---| | `main` `8bd18635` (full build, packed) | 3 | 2 rolled back (2026.11.10 restored); 1 passed, with a tracer attached | exit 1 after "Doctor complete." in the 2 failed runs | | this branch `099d54f3` (full build, packed) | 3 | 3/3 `ok`, `openclaw --version` = 2026.11.10 (099d54f) | completed/0, no teardown error | - Local ClawSweeper on `099d54f3`: complete, patch correct, no findings. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit d359ea2) Later same-path commits from the pinned scan (separate behavior unless named as folded/selected below): a345fb4 fix: return the agent ID when agents add finishes offline (#207926); 13305ad fix: let readers finish cleanup before the shared worker host stops (#207068). Later PR-number mentions: none Later commit-SHA mentions: none Pinned PR grep: d359ea2 fix(infra): join the shared worker host at terminal native close (#206930) Selected follow-up: a345fb4 (offline agent-add output); 13305ad separately changes domain closer ordering. Co-authored-by: RomneyDa <[email protected]>
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.
Problem
On macOS, a stable 2026.11.10 install rolls back when it updates to current
main.update-migrated-finalize.worker.js --doctor. Doctor finishes ("Doctor complete."), then the worker exits 1 and the updater restores the previous package and databases.exit; └ Doctor complete.; Doctor: Update schema admission, plus a truncatedNative worker execution owners have not joined.[email protected](setup baseline, Gateway started and killed) runningopenclaw update --tag <main package>. 2 of 3 runs rolled back.doctorrun onmainagainst that state printsCLI cleanup failed: shared-state: Native worker execution owners have not joined(5/5).Cause (regression from #206721):
cli-oneshotdatabase role (src/infra/update-migrated-finalize.worker.ts:92). Since perf(cli): run one-shot core workers in the shared worker host #206721,claimsSharedHostSlottherefore hosts its core workers in the shared worker host. That includes the plugin model catalog reader, a plain task pool with no native close of its own.closeDefaultRetainedNativeWorkerSource(:649) finds it still alive, because the catalog reader endpoint was never stopped.source.close()throws (src/infra/worker-native-lifecycle.ts:398), and the worker's catch setsprocess.exitCode = 1(:675-677).Bisect: the teardown error appears in 0/3 Doctor runs at
afa038c1(parent of #206721), 3/3 ata6d787f1, and 5/5 at8bd18635.Fix
src/infra/shared-worker-host.ts: when the host starts, it registers with its native source. Terminal close of that source stops the endpoints that are still live (reasonshutdown), so the host joins before the source checks for live workers. No new state, flag or option.Impact
main(doctor,agent --local, …) also prints the false teardown failure. Gateway: shutdown with the lean profile, through the same native source close.src/infra/update-migrated-finalize.worker.ts:92,649,675-677;src/infra/shared-worker-host.ts:84-105;src/infra/worker-native-lifecycle.ts:397-398User signal: the 2026.11.10 → main scratch upgrade (the release path for every stable user). Cluster A has 57 reports of target-Doctor exit 1 rolling back updates, for example #200606 and #203211. This regression is a new, unreleased instance of the same class.
Evidence
Red on base, green with the fix:
src/infra/shared-worker-host.test.ts› "joins the host at terminal native close when an endpoint's owner never stops it". On the merge base it fails withNative worker execution owners have not joined.doctor --fix --non-interactiveon 2026.11.10 state, built CLI:main5/5 teardown failures; this branch 0/2.Sibling tests pass: shared-worker-host (unqualified close), worker-native-lifecycle, worker-task-host, sqlite-worker-broker (lifecycle and core), agent-local cold start, agent-cli recovery.
agent-local-rpc-cleanup.process.test.tsfails on the merge base too: its background command hit the overall timeout at host load 40-58.Upgrade from the latest stable, in scratch (
env -i, own HOME, state dir, config path and npm prefix; fresh[email protected]fromsetup --baseline; Gateway started and killed;openclaw update --tag <package> --yes --no-restart --json):openclaw doctorstepmain8bd18635(full build, packed)099d54f3(full build, packed)ok,openclaw --version= 2026.11.10 (099d54f)Local ClawSweeper on
099d54f3: complete, patch correct, no findings.