Skip to content

fix(workers): load idle GC diagnostics lazily - #198895

Merged
steipete merged 2 commits into
mainfrom
fix/idle-gc-lazy-logger
Nov 14, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/idle-gc-lazy-logger

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Main fails the worker module budget check: agents/identity-file.worker.js: 240 evaluated modules exceeds budget 220 (UI E2E build bootstrap, job 132459904267).

#198857 added an eager createSubsystemLogger import to src/infra/worker-idle-gc.ts, and every pool worker loads that module through worker-task-server.ts. That pulled the logging graph into small workers. Lane 2491 attributed it on the exact parent: the check showed 203 evaluated modules before #198857 and 240 after.

Why This Change Was Made

The logger is now loaded with a dynamic import(), and only when an idle collection takes at least 1 s. The warning text and fields are unchanged. Workers that never hit a slow collection don't evaluate the logging graph at startup.

User Impact

None at runtime. The slow idle worker garbage collection warning still appears with the same fields, and main's worker module budget check passes again.

Evidence

  • worker-idle-gc.test.ts (2) and worker-idle-gc.runtime.test.ts (1) pass. The slow-collection test now waits for the dynamic import before asserting on the warning.
  • pnpm tsgo:core, oxfmt and oxlint are clean.
  • Worker module budget on a fresh frozen install: see the comment below.

#198857 imported the subsystem logger eagerly from worker-idle-gc.ts, which
every pool worker loads through worker-task-server. That pulled the logging
graph into agents/identity-file.worker.js: 203 -> 240 evaluated modules,
over its 220 budget (scripts/check-worker-module-budget.mjs).

Load the logger with a dynamic import only on the slow (>= 1 s) collection
path. The warning and its fields are unchanged.
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T14:07:36.109258Z 39c80f8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

logging/subsystem is statically imported elsewhere, so importing it dynamically from worker-idle-gc is ineffective and fails the build guard. Import a report module that only this path loads.
@steipete

Copy link
Copy Markdown
Contributor Author

Worker module budget on a fresh frozen install at exact head 88fae2d53f84:

  • Rebuilt dist with OPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1 node --import ./scripts/tsx.mjs scripts/tsdown-build.mts. It exits 0 with no [INEFFECTIVE_DYNAMIC_IMPORT].
  • node --import ./scripts/tsx.mjs scripts/check-worker-module-budget.mjs reports agents/identity-file.worker.js: 203 evaluated modules (budget 220). Main reports 240 (lane 2491 attribution).

The first commit imported logging/subsystem dynamically. The budget still came back to 203, but the build guard rejected the ineffective dynamic import, because that module is statically imported elsewhere. The second commit routes the import through worker-idle-gc-report.runtime.ts, which nothing else imports, so the bundler can split it into its own chunk.

@steipete
steipete merged commit d43de8d into main Nov 14, 2026
93 of 94 checks passed
@steipete
steipete deleted the fix/idle-gc-lazy-logger branch November 14, 2026 14:10
Likhith-BlueLotus added a commit to Likhith-BlueLotus/openclaw that referenced this pull request Nov 14, 2026
Brings in openclaw#198895, which fixes the identity-file worker module budget guard
that blocks building this head.
RomneyDa added a commit that referenced this pull request Nov 14, 2026
Resolve the idle-GC conflict using the landed runtime report boundary from #198895. Remove the superseded worker-idle-gc-log implementation; preserve the concurrency and floor-retention repairs. Main advanced after the prior complete build proof.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
* fix(workers): load idle GC diagnostics lazily

openclaw#198857 imported the subsystem logger eagerly from worker-idle-gc.ts, which
every pool worker loads through worker-task-server. That pulled the logging
graph into agents/identity-file.worker.js: 203 -> 240 evaluated modules,
over its 220 budget (scripts/check-worker-module-budget.mjs).

Load the logger with a dynamic import only on the slow (>= 1 s) collection
path. The warning and its fields are unchanged.

* fix(workers): split idle GC report into a runtime boundary

logging/subsystem is statically imported elsewhere, so importing it dynamically from worker-idle-gc is ineffective and fails the build guard. Import a report module that only this path loads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant