Skip to content

fix(infra): join the shared worker host at terminal native close - #206930

Merged
obviyus merged 1 commit into
mainfrom
core/update-doctor
Nov 27, 2026
Merged

obviyus merged 1 commit into
mainfrom
core/update-doctor

Conversation

@obviyus

@obviyus obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

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 perf(cli): run one-shot core workers in the shared worker host #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 perf(cli): run one-shot core workers in the shared worker host #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.

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.
@clawsweeper

clawsweeper Bot commented Nov 27, 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.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 27, 2026
@obviyus
obviyus merged commit d359ea2 into main Nov 27, 2026
128 checks passed
@obviyus
obviyus deleted the core/update-doctor branch November 27, 2026 20:14
@obviyus

obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in d359ea2.

  • Bug: since perf(cli): run one-shot core workers in the shared worker host #206721, one-shot processes (including the update finalize worker run by shipped 2026.11.10 updaters) hosted the plugin catalog reader in the shared worker host. Nothing stopped that endpoint, so terminal native close threw "Native worker execution owners have not joined", the finalize worker exited 1, and the update rolled back.
  • Fix: the shared host registers with its native source; terminal close stops its remaining endpoints so the host joins first.
  • Proof: new shared-worker-host test red on the base, green here; scratch 2026.11.10 → candidate upgrade 3/3 ok (main: 2/3 rolled back).

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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P1 High-priority user-facing bug, regression, or broken workflow. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant