Skip to content

fix(gateway): stabilize lifecycle lazy build entries - #74075

Closed
openclaw-clownfish[bot] wants to merge 1 commit into
mainfrom
clownfish/clawsweeper-openclaw-openclaw-73964-73872
Closed

openclaw-clownfish[bot] wants to merge 1 commit into
mainfrom
clownfish/clawsweeper-openclaw-openclaw-73964-73872

Conversation

@openclaw-clownfish

Copy link
Copy Markdown
Contributor

Summary

This replacement carries forward only the gateway lifecycle-loader build fix from source PR #73964. It should add a focused helper in tsdown.config.ts so lifecycle lazy modules resolve through stable dist/<entry>.js files instead of transient hashed chunks after rebuilds.

Credit: thanks @pashpashpash for the original lifecycle stability work in #73964. The private command routing commits from #73964 are intentionally excluded because that work already landed separately in #73872.

Scope

Include the first-hop lazy loaders from src/cli/gateway-cli/run-loop.ts that are used during restart/shutdown/lifecycle handling: agents/pi-embedded-runner/runs, config/config, infra/process-respawn, infra/restart, infra/restart-sentinel, infra/supervisor-markers, logging/diagnostic-stability-bundle, plugins/bundled-runtime-deps-activity, process/command-queue, and tasks/runtime-internal. Inspect current main for any additional late lifecycle first-hop dynamic imports and include only those.

Keep run-loop.ts runtime logic unchanged, including bounded restart deferral via resolveGatewayRestartDeferralTimeoutMs. Do not touch private command routing files, docs, Telegram tests, or other stale-branch files from #73964.

Tests

Extend src/infra/tsdown-config.test.ts so the lifecycle loader list, including config/config, is explicitly covered by the unified dist entry map.

Validation: pnpm test src/infra/tsdown-config.test.ts, pnpm build if feasible, and pnpm check:changed.

Clownfish replacement details:

Carried-forward contributor credit:

@greptile-apps

greptile-apps Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extracts 10 gateway lifecycle lazy-loader module paths into a dedicated buildGatewayLifecycleLazyEntries() helper in tsdown.config.ts and spreads them into buildCoreDistEntries(), ensuring they resolve to stable dist/<entry>.js filenames instead of transient hashed chunks after rebuilds. The config/config entry is cleanly removed from buildDockerE2eHarnessEntries() to avoid duplication since it now comes from core. A new focused test in tsdown-config.test.ts verifies all 10 entries are present in the unified dist graph.

Confidence Score: 5/5

This PR is safe to merge — the change is focused, all 10 lifecycle lazy imports from run-loop.ts are correctly accounted for, and the config/config deduplication is handled cleanly.

All dynamic imports in run-loop.ts are exactly matched by the new helper. The config/config entry is safely moved from buildDockerE2eHarnessEntries to buildCoreDistEntries without loss (unified dist merges both). No logic changes, no regressions, and a new test explicitly guards the full entry set.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(gateway): stabilize lifecycle lazy b..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Keep this PR open. Current main still has the gateway run-loop lifecycle lazy imports, but the stable tsdown entry map has not added the focused lifecycle entry set this PR proposes; only config/config appears today through the Docker harness entries. The related lifecycle source PR #73964 is closed unmerged, while #73872 covered separate private command routing. A maintainer has already dispatched Clownfish repair feedback on this PR, so the best next step is to review and land the repaired focused build-graph fix after validation.

Required change before merge:

Keep this PR open and review/land the focused replacement, or an equivalent patch, after validation. The fix should add stable core dist entries for the first-hop lifecycle lazy loaders from src/cli/gateway-cli/run-loop.ts, add explicit regression coverage in src/infra/tsdown-config.test.ts, keep runtime behavior unchanged, and avoid re-landing the separate private command routing work from #73872.

Best possible solution:

Keep this PR open and review/land the focused replacement, or an equivalent patch, after validation. The fix should add stable core dist entries for the first-hop lifecycle lazy loaders from src/cli/gateway-cli/run-loop.ts, add explicit regression coverage in src/infra/tsdown-config.test.ts, keep runtime behavior unchanged, and avoid re-landing the separate private command routing work from #73872.

What I checked:

  • Current lifecycle lazy imports remain in the run loop: run-loop.ts defines and caches first-hop dynamic imports for embedded runs, runtime config, process respawn, restart sentinel/restart helpers, supervisor markers, diagnostic stability bundle, bundled runtime deps activity, command queue, and runtime internal cleanup. (src/cli/gateway-cli/run-loop.ts:18, 1825f611f8c5)
  • Core stable dist entry map is still missing the proposed lifecycle list: buildCoreDistEntries() contains the existing stable-runtime-boundary comment and older stable entries, but current main has no buildGatewayLifecycleLazyEntries() helper and no entries for most run-loop lifecycle imports. (tsdown.config.ts:204, 1825f611f8c5)
  • Only config/config is currently stable through the Docker harness map: Among the requested lifecycle entries, current tsdown.config.ts only lists config/config, and it is under buildDockerE2eHarnessEntries() rather than a focused lifecycle helper in the core dist entry map. (tsdown.config.ts:241, 1825f611f8c5)
  • Current tsdown config test lacks lifecycle-entry regression coverage: The current test checks the unified dist graph for older stable runtime entries and bundled/plugin-sdk entries, but it does not assert the gateway lifecycle lazy loader list that this PR adds. (src/infra/tsdown-config.test.ts:59, 1825f611f8c5)
  • Related PR context supports keeping this open: The provided discussion links Keep gateway lifecycle loaders stable across rebuilds #73964 as the closed, unmerged lifecycle-loader stability source and Route sensitive group commands to the owner privately #73872 as the already-merged private command routing work that should remain out of scope here. Maintainer comments on this PR then dispatched Clownfish to fix CI/repair this branch.
  • Security-sensitive diff pass: The supplied PR file list is limited to tsdown.config.ts, src/infra/tsdown-config.test.ts, and CHANGELOG.md. The build-config change matches the PR purpose, and the diff does not add workflow/action refs, dependency sources, lockfiles, secrets handling, publishing metadata, lifecycle scripts, or downloaded artifact execution. (fced65e8b2e3)

Likely related people:

  • vincentkoc: The shipped changelog credits @vincentkoc for fix(runtime): stabilize dist runtime artifacts #53855, which stabilized long-lived lazy dist runtime entry paths; the current tsdown.config.ts comment and this PR’s requested lifecycle entries extend that same build-graph policy. (role: introduced related stable-runtime build policy; confidence: medium; commits: be8c24633aaa; files: CHANGELOG.md, tsdown.config.ts)
  • pashpashpash: The PR body and related context credit @pashpashpash’s closed unmerged Keep gateway lifecycle loaders stable across rebuilds #73964 as the source lifecycle-loader stability work being carried forward here, including the intended loader list and test shape. (role: source lifecycle-stability implementation context; confidence: medium; commits: 9ea4916905ef, fced65e8b2e3; files: tsdown.config.ts, src/infra/tsdown-config.test.ts, src/cli/gateway-cli/run-loop.ts)
  • steipete: Maintainer comments on this PR explicitly dispatched Clownfish repair feedback for this branch, making @steipete the clearest routing point for whether to review, land, or replace the repaired PR. (role: active maintainer follow-up owner; confidence: medium; files: tsdown.config.ts, src/infra/tsdown-config.test.ts)

Remaining risk / open question:

  • Closing this PR now would leave current main without stable dist entries for most gateway lifecycle first-hop lazy imports.
  • The change is build-graph sensitive, so merge should wait for the focused tsdown config test plus build/changed-gate or equivalent CI proof after the active repair worker updates the branch.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 1825f611f8c5.

@steipete

Copy link
Copy Markdown
Contributor

/clownfish fix ci

@steipete

Copy link
Copy Markdown
Contributor

Clownfish picked this up.

Command: fix ci
Action: dispatched cluster-worker.yml for jobs/openclaw/inbox/clawsweeper-openclaw-openclaw-73964-73872.md in autonomous mode.
Model: gpt-5.5

I will keep the change narrow and update the PR branch if the repair worker finds a safe fix.

@steipete

Copy link
Copy Markdown
Contributor

Thanks, ClawSweeper. Clownfish picked up the repair feedback.

Source: clawsweeper[bot]
Action: dispatched cluster-worker.yml for jobs/openclaw/inbox/clawsweeper-openclaw-openclaw-73964-73872.md in autonomous mode.
Model: gpt-5.5

I will update this Clownfish PR branch if the repair worker finds a safe, narrow fix.

@steipete

Copy link
Copy Markdown
Contributor

Thanks for carrying #73964 forward here. I replaced this with #74105 because we decided to simplify the design instead of keeping a per-module stable-entry list.

The replacement moves the gateway lifecycle lazy imports behind one stable runtime boundary (src/cli/gateway-cli/lifecycle.runtime.ts) and keeps the tsdown contract to a single stable entry (cli/gateway-lifecycle.runtime). It also adds a guardrail in src/infra/tsdown-config.test.ts so future run-loop.ts lifecycle imports cannot bypass that boundary and reintroduce the drift problem.

I preserved the #73964 contributor credit in CHANGELOG.md. Closing this as superseded by #74105.

@steipete steipete closed this Apr 29, 2026
@shakkernerd
shakkernerd deleted the clownfish/clawsweeper-openclaw-openclaw-73964-73872 branch October 19, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper Tracked by ClawSweeper automation size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant