mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-26 10:13:27 +08:00
One-shot Node and Bun CLI commands no longer enable the automatic module compile cache, avoiding seconds of bytecode persistence after output. The shared cache-directory owner admits automatic caching for foreground Gateway runs and explicit prewarming; NODE_COMPILE_CACHE still opts one-shots in, and NODE_DISABLE_COMPILE_CACHE retains precedence. Windows Gateway supervision keeps caching and full CLI parsing. Fixes the exit-tail regression introduced by #170514 (e517de8ca2). No disposer timeout, persisted configuration, schema, or update migration changes. Lead warm-cache A/B, four interleaved samples with reused state: config get took 2.00s cache-off vs 6.54s cache-on on Bun, and 3.63s vs 5.55s on Node. The reviewed patch remains unchanged after integrating main's session-recovery type-fixture repair and offscreen message-reveal repair. Validation: full build and focused owner/entrypoint/prewarm/wrapper checks passed. Exact-head CI run 38366283226 at606b674016completed successfully: 53 passed, 24 skipped, zero failures. Earlier inherited reds are documented in the PR; their admin attempt stopped before dispatch, and this refreshed head uses normal green-CI admission. Co-authored-by: Peter Steinberger <steipete@gmail.com>
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
// Startup-safe Gateway command-role parsing, shared with the CLI.
|
|
import { getCommandPositionalsWithRootOptions } from "./cli-root-options.mjs";
|
|
|
|
export const GATEWAY_RUN_VALUE_FLAGS = new Set([
|
|
"--port",
|
|
"--bind",
|
|
"--token",
|
|
"--token-file",
|
|
"--auth",
|
|
"--password",
|
|
"--password-file",
|
|
"--tailscale",
|
|
"--ws-log",
|
|
"--raw-stream-path",
|
|
]);
|
|
|
|
export const GATEWAY_RUN_BOOLEAN_FLAGS = new Set([
|
|
"--tailscale-reset-on-exit",
|
|
"--allow-unconfigured",
|
|
"--dev",
|
|
"--ambient-channels",
|
|
"--dev-ambient-channels",
|
|
"--reset",
|
|
"--update-canary",
|
|
"--force",
|
|
"--verbose",
|
|
"--cli-backend-logs",
|
|
"--claude-cli-logs",
|
|
"--compact",
|
|
"--raw-stream",
|
|
]);
|
|
|
|
export function isForegroundGatewayRunArgv(argv) {
|
|
const positionals = getCommandPositionalsWithRootOptions(argv, {
|
|
commandPath: ["gateway"],
|
|
// Service supervision still owns a long-lived Gateway. Keep these flags out
|
|
// of the fast-path option sets: supervisor commands need full CLI parsing.
|
|
booleanFlags: [...GATEWAY_RUN_BOOLEAN_FLAGS, "--task-supervisor"],
|
|
valueFlags: [...GATEWAY_RUN_VALUE_FLAGS, "--task-supervisor-child"],
|
|
mode: "command-path",
|
|
});
|
|
if (!positionals) {
|
|
return false;
|
|
}
|
|
// Foreground gateway owns the terminal/process environment itself; respawning would
|
|
// add an extra parent process around the long-lived server.
|
|
return positionals.length === 0 || (positionals.length === 1 && positionals[0] === "run");
|
|
}
|