Skip to content

Commit fced65e

Browse files
fix(gateway): stabilize lifecycle lazy build entries
Co-authored-by: pashpashpash <[email protected]>
1 parent 9e34fb9 commit fced65e

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Docs: https://docs.openclaw.ai
1616
- Plugin SDK: add tracked Discord component-message helpers and a Telegram account-resolution compatibility facade, so existing plugins using those subpaths resolve while new plugins stay on generic channel SDK contracts. Thanks @vincentkoc.
1717
- Docs/Hetzner: clarify that SSH tunnel access requires `AllowTcpForwarding local` before running `ssh -L`, so hardened VPS sshd configs do not block loopback Gateway access. Fixes #54557; carries forward #54564; refs #54954. Thanks @satishkc7, @blackstrype, and @Aftabbs.
1818
- Gateway/shutdown: report structured shutdown warnings and HTTP close timeout warnings through `ShutdownResult` while preserving lifecycle hook hardening. Carries forward #41296. Thanks @edenfunf.
19+
- Build/Gateway: keep restart, shutdown, respawn, diagnostics, command-queue cleanup, and runtime cleanup lazy loaders on stable dist entries so rebuilt packages do not strand long-running gateways on stale hashed chunks. Carries forward #73964. Thanks @pashpashpash.
1920
- Plugins/QA: prebuild the private QA channel runtime before plugin gauntlet source runs so wrapper CPU/RSS measurements are not polluted by private QA dist rebuild work. Thanks @vincentkoc.
2021
- Gateway/reload: bound default restart deferral and SIGUSR1 restart drain to five minutes while preserving explicit `deferralTimeoutMs: 0` indefinite waits, so stale active work accounting cannot block config reloads forever. Thanks @vincentkoc.
2122
- Active Memory: register the prompt-build hook with the configured recall timeout plus setup grace instead of the 150s maximum budget, so default memory recall cannot delay turn startup for multiple minutes. Thanks @vincentkoc.

‎src/infra/tsdown-config.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ function entryKeys(config: TsdownConfigEntry): string[] {
4141
return Object.keys(config.entry);
4242
}
4343

44+
function entrySources(config: TsdownConfigEntry): Record<string, string> {
45+
if (!config.entry || Array.isArray(config.entry)) {
46+
return {};
47+
}
48+
return config.entry;
49+
}
50+
4451
function hasBundledPluginRuntimeEntry(config: TsdownConfigEntry): boolean {
4552
const keys = entryKeys(config);
4653
return keys.includes("index") || keys.includes("runtime-api");
@@ -85,6 +92,26 @@ describe("tsdown config", () => {
8592
);
8693
});
8794

95+
it("keeps gateway lifecycle lazy loaders on stable dist entries", () => {
96+
const distGraph = unifiedDistGraph();
97+
98+
expect(distGraph).toBeDefined();
99+
expect(entrySources(distGraph as TsdownConfigEntry)).toEqual(
100+
expect.objectContaining({
101+
"agents/pi-embedded-runner/runs": "src/agents/pi-embedded-runner/runs.ts",
102+
"config/config": "src/config/config.ts",
103+
"infra/process-respawn": "src/infra/process-respawn.ts",
104+
"infra/restart": "src/infra/restart.ts",
105+
"infra/restart-sentinel": "src/infra/restart-sentinel.ts",
106+
"infra/supervisor-markers": "src/infra/supervisor-markers.ts",
107+
"logging/diagnostic-stability-bundle": "src/logging/diagnostic-stability-bundle.ts",
108+
"plugins/bundled-runtime-deps-activity": "src/plugins/bundled-runtime-deps-activity.ts",
109+
"process/command-queue": "src/process/command-queue.ts",
110+
"tasks/runtime-internal": "src/tasks/runtime-internal.ts",
111+
}),
112+
);
113+
});
114+
88115
it("emits staged bundled plugins as separate extension graphs", () => {
89116
const stagedGraphs = asConfigArray(tsdownConfig).filter(
90117
(config) => typeof config.outDir === "string" && config.outDir.startsWith("dist/extensions/"),

‎tsdown.config.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,21 @@ function buildBundledPluginNeverBundlePredicate(packageJson: {
201201
};
202202
}
203203

204+
function buildGatewayLifecycleLazyEntries(): Record<string, string> {
205+
return {
206+
"agents/pi-embedded-runner/runs": "src/agents/pi-embedded-runner/runs.ts",
207+
"config/config": "src/config/config.ts",
208+
"infra/process-respawn": "src/infra/process-respawn.ts",
209+
"infra/restart": "src/infra/restart.ts",
210+
"infra/restart-sentinel": "src/infra/restart-sentinel.ts",
211+
"infra/supervisor-markers": "src/infra/supervisor-markers.ts",
212+
"logging/diagnostic-stability-bundle": "src/logging/diagnostic-stability-bundle.ts",
213+
"plugins/bundled-runtime-deps-activity": "src/plugins/bundled-runtime-deps-activity.ts",
214+
"process/command-queue": "src/process/command-queue.ts",
215+
"tasks/runtime-internal": "src/tasks/runtime-internal.ts",
216+
};
217+
}
218+
204219
function buildCoreDistEntries(): Record<string, string> {
205220
return {
206221
index: "src/index.ts",
@@ -209,6 +224,7 @@ function buildCoreDistEntries(): Record<string, string> {
209224
"cli/daemon-cli": "src/cli/daemon-cli.ts",
210225
// Keep long-lived lazy runtime boundaries on stable filenames so rebuilt
211226
// dist/ trees do not strand already-running gateways on stale hashed chunks.
227+
...buildGatewayLifecycleLazyEntries(),
212228
"agents/auth-profiles.runtime": "src/agents/auth-profiles.runtime.ts",
213229
"agents/model-catalog.runtime": "src/agents/model-catalog.runtime.ts",
214230
"agents/models-config.runtime": "src/agents/models-config.runtime.ts",
@@ -250,7 +266,6 @@ function buildDockerE2eHarnessEntries(): Record<string, string> {
250266
"src/agents/pi-embedded-runner/run/runtime-context-prompt.ts",
251267
"auto-reply/reply/commands-crestodian": "src/auto-reply/reply/commands-crestodian.ts",
252268
"cli/run-main": "src/cli/run-main.ts",
253-
"config/config": "src/config/config.ts",
254269
"crestodian/crestodian": "src/crestodian/crestodian.ts",
255270
"crestodian/rescue-message": "src/crestodian/rescue-message.ts",
256271
"gateway/protocol/index": "src/gateway/protocol/index.ts",

0 commit comments

Comments
 (0)