Skip to content

fix: avoid Windows startup hangs with long compile-cache paths - #162841

Merged
steipete merged 2 commits into
mainfrom
upd/upd-windows-compile-cache-path
Oct 1, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/upd-windows-compile-cache-path

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #162821

What Problem This Solves

Fixes Windows CLI startup hanging at 100% CPU when a deep temporary directory makes Node's compile-cache path too long. Thanks @NickM83 for the Windows/Node reproduction.

User Impact

Packaged commands continue without the optional compile cache when its resolved Windows directory exceeds 200 characters, recording a warning. No new configuration or data migration is required. Existing affected installations can use NODE_DISABLE_COMPILE_CACHE=1 to run the updater.

Why This Change Was Made

The shared cache-directory owner hashes release build IDs to 16 hexadecimal characters while preserving stable build identity, inherited namespace flattening, and retirement of old caches. The launcher and runtime skip unsafe activation. The child-environment owner removes unsafe inherited paths and sets Node's existing disable flag before starting children and SQLite workers.

This admits the path before Node's synchronous native call, which can otherwise hang indefinitely as reported in nodejs/node#66438. An externally exported unsafe NODE_COMPILE_CACHE can still hang Node before OpenClaw JavaScript starts; NODE_DISABLE_COMPILE_CACHE=1 remains the workaround for that initial invocation.

Evidence

Final reviewed and tested head: 50fc476a196aa43c986fd30d57c34df19845130e. Fresh direct-route Codex P1 review: scoped-clean, no actionable findings. Auto-merge is off.

Proof Result
Pre-fix regression, baseline 8a2d2ff7e28cf0ec5dfeeda5c96c29fad094558b Three intended assertion failures: oversized release marker, long-TEMP activation, and unsafe 201-character child environment. No collection failure.
Same tests on candidate All 33 owner tests pass; the prior import-order collection defect is corrected.
Owner, launcher, SQLite-store and SQLite-readonly suites, three runs Each run: 192 passed, two existing Bun-only skips. Warm wall times: 48.20s and 53.96s. First run: 716.86s including cold runtime preparation; tsdown itself took 635.4s.
Cross-lane importing tests 77 passed in 43.68s.
node scripts/check-changed.mjs --base 8a2d2ff7e28cf0ec5dfeeda5c96c29fad094558b --head 50fc476a196aa43c986fd30d57c34df19845130e Passed in 2308.01s, including all selected typechecks, extension lint, source guards and zero runtime import cycles. One inherited max-lines warning in unchanged src/state/user-profile-list.ts.
Shallow-clone comparison Fetched the missing ancestry, verified the base is an ancestor, and separately passed scripts/check-env-var-count.mts --base <baseline>: 473/473.
Formatting and whitespace Passed; source worktrees clean.

Changed-file costs with pnpm test <file> --maxWorkers=1: src/entry.compile-cache.test.ts 1.51s wall (26 passed); src/infra/node-compile-cache.test.ts 2.44s wall (7 passed). Build/compiler preparation is separate from test time. No test crossed the campaign's slow-test threshold.

The three repeated runs used:

pnpm test src/infra/node-compile-cache.test.ts src/entry.compile-cache.test.ts test/openclaw-launcher.e2e.test.ts src/infra/sqlite-worker-store.compile-cache.test.ts src/infra/sqlite-readonly-worker.compile-cache.process.test.ts --maxWorkers=1

Cross-lane files: test/openclaw-launcher-version.e2e.test.ts, test/node-host-launcher.test.ts, test/scripts/run-node-lifecycle.test.ts, src/entry.respawn-diagnostics.test.ts, and src/cli/run-main.cleanup.test.ts.

Native Windows proof

On Node 24.18.0, the canonical candidate tarball explicitly composing Codex was installed into isolated home/state. With 220-character TEMP, its real packaged launcher completed:

openclaw plugins inspect codex --runtime --json
exit=0, elapsed=2.394s
plugin.id=codex, plugin.status=loaded, plugin.imported=true
[openclaw] Compile cache disabled: Windows cache path exceeds 200 characters.

Four matching warning lines were recorded; stdout remained valid JSON. A separate proof used the real openSqliteWorkerStore broker with an inherited 318-character legacy cache path, assigned after parent startup. Two native worker threads observed no cache path and NODE_DISABLE_COMPILE_CACHE=1, persisted counts 1 → 2, and both stores closed. Broker operation: 1.481s; complete process: 2.472s. These results address the exact-head ClawSweeper request for packaged startup and real-worker handoff evidence.

The Windows build completed on 24.18.0 in 1558.631s without a restart or runtime switch; its quiet period was slow declaration generation, not a confirmed scheduler hang. Packaging took 77.069s and installation 54.907s. A scratch-harness npm config-path collision was corrected before installation; successful build/package work was reused. npm's default policy reported five unapproved dependency lifecycle scripts; this proof establishes the installed commands and broker behavior, not execution of every dependency install script.

Environments and scope

  • Linux Blacksmith Testbox tbx_01m3w7e9xahsyq3225vvmbwqze, Node 24.19.0/pnpm 12.5.1: run 36898094498.
  • Native Windows Blacksmith Testbox tbx_01m3w7e9xfx3vv31cvx74g9mqm, Node 24.18.0/pnpm 12.5.1: run 36898094608.

Both fresh leases fetched the exact candidate SHA, used frozen installs, and are stopped. No local tree sync, live Gateway change, or operator-state access. Production: +50/-18 lines (net +32); tests: +49/-8 (net +41); docs: +4. Production growth covers the shared guard, optional activation handling, and safe child-environment propagation.

Hash release build identities into 16-character cache markers and skip Windows cache directories over 200 characters with a warning. Disable unsafe inherited compile-cache paths before spawning children. Preserve legacy namespace flattening and disposable cache maintenance.
@clawsweeper

clawsweeper Bot commented Oct 1, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 2:24 PM ET / 18:24 UTC (Revision 3).

ClawSweeper review

What this changes

Shortens compile-cache build identifiers and skips unsafe Windows cache paths during CLI startup and child-worker environment preparation.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix: reviewed main and the latest release still expose the Windows startup hang. The new native Windows evidence resolves the previous proof blocker, and no actionable introduced defect was found.

Priority: P1
Reviewed head: 50fc476a196aa43c986fd30d57c34df19845130e

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-level repair with native Windows boundary proof, intended baseline failures, and substantial relevant regression validation.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured exact-head Windows/Node 24.18.0 transcript exercises the packaged launcher with long TEMP and the real SQLite broker with an unsafe inherited legacy path, showing prompt completion, cache-disable warnings, successful persistence, and worker closure. This resolves the prior coverage gap; only disposable Node bytecode namespaces change, with no application data-model migration.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured exact-head Windows/Node 24.18.0 transcript exercises the packaged launcher with long TEMP and the real SQLite broker with an unsafe inherited legacy path, showing prompt completion, cache-disable warnings, successful persistence, and worker closure. This resolves the prior coverage gap; only disposable Node bytecode namespaces change, with no application data-model migration.
Evidence reviewed 9 items Pinned introduced patch: Reviewed the merge-base-to-head patch and corresponding production and test owners. Changes are confined to compile-cache admission, build identity, environment propagation, documentation, and regressions; endpoint drift was not attributed to this PR.
Still necessary on main and release: The inspected resolver on fetched main still constructs the longer build marker without Windows path admission. The same implementation is present in v2026.9.7, whose source commit is c074824.
Admission before native activation: The shared resolver hashes build identity to 16 hexadecimal characters and rejects resolved Windows paths over 200 characters. Both launcher activation and runtime activation handle an absent directory before invoking Node’s synchronous API.
Findings None None.
Security None None.

How this fits together

OpenClaw optionally caches Node’s compiled modules to speed up packaged commands. Its shared cache owner constructs build-specific directories and prepares cache settings inherited by SQLite workers.

flowchart TD
  A[Package build identity] --> C[Shared cache directory owner]
  B[Temporary or inherited directory] --> C
  C --> D{Windows path safe?}
  D -->|Yes| E[Enable optional compile cache]
  D -->|No| F[Warn and continue uncached]
  E --> G[CLI and SQLite workers]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +13, Tests +41, Docs +4, Other +19. Total +77 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 17 4 +13
Tests 2 49 8 +41
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 3 33 14 +19
Total 8 103 26 +77

Review metrics

Metric Value Why it matters
Production versus test growth production +50/-18; tests +49/-8 Production growth is justified by shared path admission and safe child propagation, while regressions cover the repaired boundaries.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #162821
Summary: This PR is the explicit candidate fix for the canonical Windows long-cache-path report, which remains open pending merge.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep cache acceleration optional through the existing shared owner so unsafe Windows paths cannot prevent packaged commands or SQLite workers from starting.

Do we have a high-confidence way to reproduce the issue?

Yes: packaged Windows startup synchronously enables a long build-scoped cache path, matching the standalone Node 24.18.0 reproduction. This review established the source path without executing the failure.

Is this the best way to solve the issue?

Yes: shortening build identity and admitting paths before native activation addresses both deep temporary directories and inherited worker settings through the existing owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1ba51273303d.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured exact-head Windows/Node 24.18.0 transcript exercises the packaged launcher with long TEMP and the real SQLite broker with an unsafe inherited legacy path, showing prompt completion, cache-disable warnings, successful persistence, and worker closure. This resolves the prior coverage gap; only disposable Node bytecode namespaces change, with no application data-model migration.
  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.

Label justifications:

  • P1: A reported supported Windows installation can hang before its maintenance command starts.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured exact-head Windows/Node 24.18.0 transcript exercises the packaged launcher with long TEMP and the real SQLite broker with an unsafe inherited legacy path, showing prompt completion, cache-disable warnings, successful persistence, and worker closure. This resolves the prior coverage gap; only disposable Node bytecode namespaces change, with no application data-model migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured exact-head Windows/Node 24.18.0 transcript exercises the packaged launcher with long TEMP and the real SQLite broker with an unsafe inherited legacy path, showing prompt completion, cache-disable warnings, successful persistence, and worker closure. This resolves the prior coverage gap; only disposable Node bytecode namespaces change, with no application data-model migration.

Evidence

What I checked:

  • Pinned introduced patch: Reviewed the merge-base-to-head patch and corresponding production and test owners. Changes are confined to compile-cache admission, build identity, environment propagation, documentation, and regressions; endpoint drift was not attributed to this PR. (node-compile-cache.mjs:17, 50fc476a196a)
  • Still necessary on main and release: The inspected resolver on fetched main still constructs the longer build marker without Windows path admission. The same implementation is present in v2026.9.7, whose source commit is c074824. (node-compile-cache.mjs:33, 1ba51273303d)
  • Admission before native activation: The shared resolver hashes build identity to 16 hexadecimal characters and rejects resolved Windows paths over 200 characters. Both launcher activation and runtime activation handle an absent directory before invoking Node’s synchronous API. (node-compile-cache.mjs:50, 50fc476a196a)
  • Production worker handoff: The environment owner preserves explicit disable settings, removes an unsafe inherited cache path from the child environment, and sets NODE_DISABLE_COMPILE_CACHE=1. Existing SQLite thread and read-only process callers consume this owner; the parent environment is preserved. (src/infra/node-compile-cache-env.ts:28, 50fc476a196a)
  • Applicable Node dependency contract: OpenClaw directly invokes module.enableCompileCache. Personally inspected Node v24.18.0’s implementation: it synchronously calls the native _enableCompileCache binding. The upstream report documents reproducible Windows hangs at selected directory lengths and the disable-flag workaround. (lib/internal/modules/helpers.js:450, 20da4aeadabc)
  • Native after-fix proof resolves prior blocker: The complete captured PR body, sourceRevision 381949b4e6775c9ead91634d54b9714c50530dd1d8065a8034b777a15e5ba0f8, records exact-head Windows/Node 24.18.0 packaged startup with 220-character TEMP: runtime plugin inspection completed in 2.394 seconds, exit zero, valid JSON, and cache-disable warnings. A real SQLite broker with a 318-character inherited legacy path started two native workers without that path, observed the disable flag, persisted counts 1 to 2, and closed both stores. These directly cover the previous review’s packaged-startup and legacy-worker handoff concerns. Codex is the inspected plugin in this scenario; the changed behavior does not depend on its harness contract. (50fc476a196a)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-01T16:42:25.874Z sha 9ac3353 :: needs changes before merge. :: none
  • reviewed 2026-10-01T17:01:43.869Z sha 50fc476 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 1, 2026
@steipete
steipete marked this pull request as ready for review October 1, 2026 18:18
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Oct 1, 2026
@steipete
steipete merged commit 6e987af into main Oct 1, 2026
219 of 225 checks passed
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed via the admin exception for inherited failures (squash 6e987af9bc9b446f3ef6f03049a611be1a005aec, head 50fc476a196a). Reds on the PR run: checks-node-changed-4 → src/flows/doctor-health.nocow.test.ts (main red from the NOCOW Doctor landings, fixed on main by 0e8782238e44 after this run) and checks-ui-e2e (4/7) → ui/src/e2e/chat-flow.stream-reconciliation.e2e.test.ts (the comment/chat UI e2e cluster owned by the CI-status session). This PR touches only the compile-cache owner, launcher and entry. Lead review scoped-clean (0.89); native Windows proof in the PR. No CI was re-spent.

@steipete
steipete deleted the upd/upd-windows-compile-cache-path branch October 1, 2026 18:29
RomneyDa pushed a commit that referenced this pull request Oct 1, 2026
…2841)

2026.9.7 lengthened the compile-cache marker from <mtime>-<size> to build-<buildId>, which pushed cache paths on Windows into the directory-length window where Node 24's module.enableCompileCache() never returns (nodejs/node#66438); every OpenClaw process start could then spin at full CPU. The shared cache owner now uses a 16-character hash of the full build id as the marker, refuses Windows cache paths over 200 characters with a recorded warning (cache off for that process), and no longer propagates an unsafe inherited cache path to children. Legacy namespace handling and POSIX behavior are unchanged; native Windows/Node 24.18 completes the packaged CLI with a 220-character TEMP in 2.4 s.

Closes #162821

(cherry picked from commit 6e987af)
RomneyDa added a commit that referenced this pull request Oct 1, 2026
* fix: preserve plugin settings through update recovery (#160344)

Keep incompatible local plugin configuration intact and complete deferred migration confirmation after unchanged package convergence. Use completion receipts to clear obsolete retry warnings without rewriting update history.

Fixes #159477. Thanks @EndeavorPioneer for the recovery report.

(cherry picked from commit 8e66b0b)

* fix: prevent duplicate Gateways during container onboarding (#160193)

* fix: prevent duplicate Gateways during container onboarding

* fix: keep QA cron controls scoped to the child

Drop inherited parent cron suppression while preserving explicit child runtime
settings. Cover the failing inheritance contract at the environment owner.

Await node-list RPC responses after acknowledged rename and reconnect events
without racing the existing RPC deadline against a separate polling timeout.

(cherry picked from commit 54b1b1b)

* fix: refuse incompatible Windows 9.4 schema upgrades (#160718)

* fix: refuse incompatible Windows 9.4 schema upgrades

Refuse shared-state migration during the shipped Windows 9.4 raw Doctor preflight while its recorded updater drivers have not positively stopped. Keep the existing delegated Doctor and 9.2 publication paths unchanged. Split manual recovery text so the shipped canary retains the reason and commands within its per-line capture limit. This contains the old callback failure; it does not complete automatic 9.4 updates.

* fix: refuse legacy Windows migration during package staging

* fix(update): load package lifecycle guard only at runtime

(cherry picked from commit 0703c21)

* fix(anthropic): prevent stuck turns after background Bash completes (#161260)

* fix(anthropic): release backgrounded Bash hold on task-notification result

* fix(anthropic): settle background replies without stalled or prematurely closed turns

Keep native Bash, agent, and workflow completions attached until consumed. Correlate queued and inline acknowledgements, preserve failure retirement, and distinguish automatic Bash timeouts from explicit background requests using authorized input. Add transport regressions; verify real Claude producer ordering and patched warm-session reuse.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
(cherry picked from commit 38dd3c2)

* fix: preserve maintenance leases during SQLite contention (#160702)

(cherry picked from commit 3328283)

* fix(gateway): preserve proxy policy in local TLS health probes (#161946)

(cherry picked from commit 649b19f)

* fix(telegram): prevent empty retired bindings from blocking updates (#161832)

* test(telegram): cover empty retired bindings migration

* test(doctor): cover empty Telegram migration receipt

* fix(telegram): archive verified empty retired bindings

Co-authored-by: ericcaiwx-star <[email protected]>
(cherry picked from commit 646ac9a)

* fix(doctor): keep session repair iterative on deep canonical owner chains (#162321)

Doctor's session-repair step overflowed the stack (RangeError: Maximum call stack size exceeded) on large but healthy agent databases during 2026.9.7 update activation: canonical-owner resolution followed canonicalOwnerSessionKey alias chains recursively, and row-count-sized spreads sat on the same path. Resolution is now iterative with the same terminal-owner, missing-owner, and cycle outcomes, and the spreads are linear reductions with unchanged empty-input behavior. A healthy 12,000-owner / 200,000-event fixture fails pre-fix and passes post-fix; the published-driver upgrade preserved transcript bytes.

Closes #161979

(cherry picked from commit 9fb7ba2)

* fix(launcher): keep the Node compile-cache path short on Windows (#162841)

2026.9.7 lengthened the compile-cache marker from <mtime>-<size> to build-<buildId>, which pushed cache paths on Windows into the directory-length window where Node 24's module.enableCompileCache() never returns (nodejs/node#66438); every OpenClaw process start could then spin at full CPU. The shared cache owner now uses a 16-character hash of the full build id as the marker, refuses Windows cache paths over 200 characters with a recorded warning (cache off for that process), and no longer propagates an unsafe inherited cache path to children. Legacy namespace handling and POSIX behavior are unchanged; native Windows/Node 24.18 completes the packaged CLI with a 220-character TEMP in 2.4 s.

Closes #162821

(cherry picked from commit 6e987af)

* fix(codex): prevent Gateway heap exhaustion with large agent fleets (#162912)

Closes #162802

## What Problem This Solves

Fixes Gateway heap exhaustion during Codex session discovery on large agent fleets. Thanks to @609NFT for the report and allocation profiles.

## User Impact

Large fleets can finish startup and retain their native Codex session catalog without retaining a whole fleet configuration for every agent/home pair. No schema, stored-data, configuration, or catalog-output changes are required.

## Why This Change Was Made

The existing config-identity cache now owns one captured configuration per generation. Agent/home entries keep their separate directories and cloned connection options, but share that captured configuration. Config reload isolation and source-specific backoff remain unchanged.

No overlap with Pash/Sarah changes.

Codex source inspection: `codex-rs/app-server/src/request_processors/thread_processor.rs:2524–2608` in the sibling Codex checkout confirms that `thread/list` consumes pagination and filter parameters; the fleet configuration capture being repaired belongs to OpenClaw, not the native listing protocol.

## Evidence

Compared baseline `7ef388bac8f607eb03510189922d1c6a4d786b52` with candidate `f0ae922f60922f2b357bc3d5af22a2142799fbe0` in isolated Linux arm64 Docker containers, Node 24.21.0. The synthetic profile contained 739 agents, eight explicit Codex homes, and three native sessions (380,439 bytes of configuration).

| Check | Baseline | Candidate |
| --- | --- | --- |
| Real Gateway, 2,560 MiB heap | Heap OOM at 100.3 s | Survived the six-minute window; clean shutdown |
| Sampled catalog allocations under `resolveRequestOptions` → `structuredClone` | 2.248 GB | 5.48 MB |
| Post-startup heap, 150–360 s | Process already terminated | Bounded at 377–566 MiB |
| Complete startup, separate 6,144 MiB control without profiling | 98.34 s | 93.83 s |
| HTTP listening, same startup control | 50.52 s | 49.56 s |

The larger-heap startup control lets the baseline complete startup rather than comparing a successful candidate against an OOM.

- Real `sessions.catalog.list` Gateway RPCs returned exactly the three expected native session IDs for agents `agent000`, `agent001`, and `agent738`.
- Exact-head live gate: a real OpenAI `gpt-5.4-mini` turn through the candidate Gateway's Codex harness returned `CATALOG_LIVE_OK` on the 739-agent profile (5.449 s). Its temporary read-only credential file and container were removed.
- Regression failed on baseline: four fleet config clones instead of one across multiple agents/homes. It passes on the candidate and also checks reload allocation isolation; the regression itself took 5 ms.
- All 38 focused tests passed across `session-catalog-listing-cache.test.ts`, `session-catalog-request-lifetime.test.ts`, `session-catalog-homes.test.ts`, and `session-catalog-backoff.test.ts` (38.67 s wall).
- Standalone `pnpm test extensions/codex/src/session-catalog-listing-cache.test.ts --maxWorkers=1` passed (32.61 s wall, including runner preparation).
- Built and exercised the real candidate runtime with `pnpm build`. Broader static and project-wide validation is left to CI.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit fd01246)

* fix(telegram): preserve queued preview writer authority (#160137)

* fix(telegram): preserve queued preview writer authority

Forward-port the Telegram preview correction from f488a8c. Both preview paths retain current-writer authority through the account scheduler and network admission.

WIP: the regression failed before the repair and all 86 focused tests pass. Full changed-check completion and independent review remain pending under the work-order time budget.

Co-authored-by: Ayaan Zaidi <[email protected]>

* docs(telegram): scope the preview authority note to guarded updates

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit a8907e3)

* fix(telegram): keep empty binding archive failures from blocking updates (#162290)

Follow-up to #161832: when archiving a verified-empty retired Telegram bindings file fails (for example the .migrated target already exists), the migration records a recoverable warning instead of refusing the update; non-empty or uncertain sources keep the preservation refusal. Sanitized refusal messages keep their diagnostic text.

Refs #161795

Thanks @ericcaiwx-star for the base fix in #161832.

(cherry picked from commit 1b9d7e7)

* fix(sandbox): sessions fail with EACCES after skills refresh on read-only installs (#162304)

* fix(sandbox): keep synced skill copies removable on read-only installs

Sandbox skill sync copied bundled skills with fs.cp, which keeps source
modes. From a read-only install every copied directory became 0555, so the
next full re-sync (skills version bump or Gateway restart) failed with
EACCES unlinking skills/<skill>/SKILL.md, and library-pinned sessions
failed every turn.

Copied directories are now made owner-writable (file modes unchanged), and
removal repairs legacy read-only trees inside the synced child before one
retry. The repair stays inside the skills root and never follows symlinks.
The Claude CLI skills-plugin copy fallback uses the same helper.

* fix(sandbox): classify skill removal errors without a type assertion

(cherry picked from commit be93e85)

* fix(doctor): share plugin registries across agents in the tool-schema check (#162394)

doctor --fix heap-OOMed on a 739-agent state: the runtime tool-schema check resolved a model per agent workspace, and every plugin-load cache context cloned the full runtime config and retained a registry per workspace (516 MB of config clones at 2.4 GB heap). The loader now defers config capture until a cache miss and shares prepared provider registrations within a captured config generation for agents with matching configuration and plugin sources; a reentrant load during capture joins the in-flight load instead of registering twice. 300 synthetic agents: config clones 1,802 -> 3, registries 300 -> 1, peak RSS 1.25 GB -> 0.88 GB.

Closes #161869

(cherry picked from commit e304e4f)

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vito Cappello <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Eric Cai <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 1, 2026
* fix: preserve plugin settings through update recovery (#160344)

Keep incompatible local plugin configuration intact and complete deferred migration confirmation after unchanged package convergence. Use completion receipts to clear obsolete retry warnings without rewriting update history.

Fixes #159477. Thanks @EndeavorPioneer for the recovery report.

(cherry picked from commit 8e66b0b)

* fix: prevent duplicate Gateways during container onboarding (#160193)

* fix: prevent duplicate Gateways during container onboarding

* fix: keep QA cron controls scoped to the child

Drop inherited parent cron suppression while preserving explicit child runtime
settings. Cover the failing inheritance contract at the environment owner.

Await node-list RPC responses after acknowledged rename and reconnect events
without racing the existing RPC deadline against a separate polling timeout.

(cherry picked from commit 54b1b1b)

* fix: refuse incompatible Windows 9.4 schema upgrades (#160718)

* fix: refuse incompatible Windows 9.4 schema upgrades

Refuse shared-state migration during the shipped Windows 9.4 raw Doctor preflight while its recorded updater drivers have not positively stopped. Keep the existing delegated Doctor and 9.2 publication paths unchanged. Split manual recovery text so the shipped canary retains the reason and commands within its per-line capture limit. This contains the old callback failure; it does not complete automatic 9.4 updates.

* fix: refuse legacy Windows migration during package staging

* fix(update): load package lifecycle guard only at runtime

(cherry picked from commit 0703c21)

* fix(anthropic): prevent stuck turns after background Bash completes (#161260)

* fix(anthropic): release backgrounded Bash hold on task-notification result

* fix(anthropic): settle background replies without stalled or prematurely closed turns

Keep native Bash, agent, and workflow completions attached until consumed. Correlate queued and inline acknowledgements, preserve failure retirement, and distinguish automatic Bash timeouts from explicit background requests using authorized input. Add transport regressions; verify real Claude producer ordering and patched warm-session reuse.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
(cherry picked from commit 38dd3c2)

* fix: preserve maintenance leases during SQLite contention (#160702)

(cherry picked from commit 3328283)

* fix(gateway): preserve proxy policy in local TLS health probes (#161946)

(cherry picked from commit 649b19f)

* fix(telegram): prevent empty retired bindings from blocking updates (#161832)

* test(telegram): cover empty retired bindings migration

* test(doctor): cover empty Telegram migration receipt

* fix(telegram): archive verified empty retired bindings

Co-authored-by: ericcaiwx-star <[email protected]>
(cherry picked from commit 646ac9a)

* fix(doctor): keep session repair iterative on deep canonical owner chains (#162321)

Doctor's session-repair step overflowed the stack (RangeError: Maximum call stack size exceeded) on large but healthy agent databases during 2026.9.7 update activation: canonical-owner resolution followed canonicalOwnerSessionKey alias chains recursively, and row-count-sized spreads sat on the same path. Resolution is now iterative with the same terminal-owner, missing-owner, and cycle outcomes, and the spreads are linear reductions with unchanged empty-input behavior. A healthy 12,000-owner / 200,000-event fixture fails pre-fix and passes post-fix; the published-driver upgrade preserved transcript bytes.

Closes #161979

(cherry picked from commit 9fb7ba2)

* fix(launcher): keep the Node compile-cache path short on Windows (#162841)

2026.9.7 lengthened the compile-cache marker from <mtime>-<size> to build-<buildId>, which pushed cache paths on Windows into the directory-length window where Node 24's module.enableCompileCache() never returns (nodejs/node#66438); every OpenClaw process start could then spin at full CPU. The shared cache owner now uses a 16-character hash of the full build id as the marker, refuses Windows cache paths over 200 characters with a recorded warning (cache off for that process), and no longer propagates an unsafe inherited cache path to children. Legacy namespace handling and POSIX behavior are unchanged; native Windows/Node 24.18 completes the packaged CLI with a 220-character TEMP in 2.4 s.

Closes #162821

(cherry picked from commit 6e987af)

* fix(codex): prevent Gateway heap exhaustion with large agent fleets (#162912)

Closes #162802

## What Problem This Solves

Fixes Gateway heap exhaustion during Codex session discovery on large agent fleets. Thanks to @609NFT for the report and allocation profiles.

## User Impact

Large fleets can finish startup and retain their native Codex session catalog without retaining a whole fleet configuration for every agent/home pair. No schema, stored-data, configuration, or catalog-output changes are required.

## Why This Change Was Made

The existing config-identity cache now owns one captured configuration per generation. Agent/home entries keep their separate directories and cloned connection options, but share that captured configuration. Config reload isolation and source-specific backoff remain unchanged.

No overlap with Pash/Sarah changes.

Codex source inspection: `codex-rs/app-server/src/request_processors/thread_processor.rs:2524–2608` in the sibling Codex checkout confirms that `thread/list` consumes pagination and filter parameters; the fleet configuration capture being repaired belongs to OpenClaw, not the native listing protocol.

## Evidence

Compared baseline `7ef388bac8f607eb03510189922d1c6a4d786b52` with candidate `f0ae922f60922f2b357bc3d5af22a2142799fbe0` in isolated Linux arm64 Docker containers, Node 24.21.0. The synthetic profile contained 739 agents, eight explicit Codex homes, and three native sessions (380,439 bytes of configuration).

| Check | Baseline | Candidate |
| --- | --- | --- |
| Real Gateway, 2,560 MiB heap | Heap OOM at 100.3 s | Survived the six-minute window; clean shutdown |
| Sampled catalog allocations under `resolveRequestOptions` → `structuredClone` | 2.248 GB | 5.48 MB |
| Post-startup heap, 150–360 s | Process already terminated | Bounded at 377–566 MiB |
| Complete startup, separate 6,144 MiB control without profiling | 98.34 s | 93.83 s |
| HTTP listening, same startup control | 50.52 s | 49.56 s |

The larger-heap startup control lets the baseline complete startup rather than comparing a successful candidate against an OOM.

- Real `sessions.catalog.list` Gateway RPCs returned exactly the three expected native session IDs for agents `agent000`, `agent001`, and `agent738`.
- Exact-head live gate: a real OpenAI `gpt-5.4-mini` turn through the candidate Gateway's Codex harness returned `CATALOG_LIVE_OK` on the 739-agent profile (5.449 s). Its temporary read-only credential file and container were removed.
- Regression failed on baseline: four fleet config clones instead of one across multiple agents/homes. It passes on the candidate and also checks reload allocation isolation; the regression itself took 5 ms.
- All 38 focused tests passed across `session-catalog-listing-cache.test.ts`, `session-catalog-request-lifetime.test.ts`, `session-catalog-homes.test.ts`, and `session-catalog-backoff.test.ts` (38.67 s wall).
- Standalone `pnpm test extensions/codex/src/session-catalog-listing-cache.test.ts --maxWorkers=1` passed (32.61 s wall, including runner preparation).
- Built and exercised the real candidate runtime with `pnpm build`. Broader static and project-wide validation is left to CI.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit fd01246)

* fix(telegram): preserve queued preview writer authority (#160137)

* fix(telegram): preserve queued preview writer authority

Forward-port the Telegram preview correction from f488a8c. Both preview paths retain current-writer authority through the account scheduler and network admission.

WIP: the regression failed before the repair and all 86 focused tests pass. Full changed-check completion and independent review remain pending under the work-order time budget.

Co-authored-by: Ayaan Zaidi <[email protected]>

* docs(telegram): scope the preview authority note to guarded updates

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit a8907e3)

* fix(telegram): keep empty binding archive failures from blocking updates (#162290)

Follow-up to #161832: when archiving a verified-empty retired Telegram bindings file fails (for example the .migrated target already exists), the migration records a recoverable warning instead of refusing the update; non-empty or uncertain sources keep the preservation refusal. Sanitized refusal messages keep their diagnostic text.

Refs #161795

Thanks @ericcaiwx-star for the base fix in #161832.

(cherry picked from commit 1b9d7e7)

* fix(sandbox): sessions fail with EACCES after skills refresh on read-only installs (#162304)

* fix(sandbox): keep synced skill copies removable on read-only installs

Sandbox skill sync copied bundled skills with fs.cp, which keeps source
modes. From a read-only install every copied directory became 0555, so the
next full re-sync (skills version bump or Gateway restart) failed with
EACCES unlinking skills/<skill>/SKILL.md, and library-pinned sessions
failed every turn.

Copied directories are now made owner-writable (file modes unchanged), and
removal repairs legacy read-only trees inside the synced child before one
retry. The repair stays inside the skills root and never follows symlinks.
The Claude CLI skills-plugin copy fallback uses the same helper.

* fix(sandbox): classify skill removal errors without a type assertion

(cherry picked from commit be93e85)

* fix(doctor): share plugin registries across agents in the tool-schema check (#162394)

doctor --fix heap-OOMed on a 739-agent state: the runtime tool-schema check resolved a model per agent workspace, and every plugin-load cache context cloned the full runtime config and retained a registry per workspace (516 MB of config clones at 2.4 GB heap). The loader now defers config capture until a cache miss and shares prepared provider registrations within a captured config generation for agents with matching configuration and plugin sources; a reentrant load during capture joins the in-flight load instead of registering twice. 300 synthetic agents: config clones 1,802 -> 3, registries 300 -> 1, peak RSS 1.25 GB -> 0.88 GB.

Closes #161869

(cherry picked from commit e304e4f)

* fix(release): carry 2026.9.8 CI exceptions

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vito Cappello <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Eric Cai <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…nclaw#162841)

2026.9.7 lengthened the compile-cache marker from <mtime>-<size> to build-<buildId>, which pushed cache paths on Windows into the directory-length window where Node 24's module.enableCompileCache() never returns (nodejs/node#66438); every OpenClaw process start could then spin at full CPU. The shared cache owner now uses a 16-character hash of the full build id as the marker, refuses Windows cache paths over 200 characters with a recorded warning (cache off for that process), and no longer propagates an unsafe inherited cache path to children. Legacy namespace handling and POSIX behavior are unchanged; native Windows/Node 24.18 completes the packaged CLI with a 220-character TEMP in 2.4 s.

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

Labels

docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: 9.7's longer compile-cache folder can hang start-up in Node's enableCompileCache (nodejs/node#66438)

1 participant