openclaw/src/cli
merlin eea925b12b fix(gateway): validate config before restart to prevent crash + macOS permission loss (#35862)
When 'openclaw gateway restart' is run with an invalid config, the new
process crashes on startup due to config validation failure. On macOS,
this causes Full Disk Access (TCC) permissions to be lost because the
respawned process has a different PID.

Add getConfigValidationError() helper and pre-flight config validation
in both runServiceRestart() and runServiceStart(). If config is invalid,
abort with a clear error message instead of crashing.

The config watcher's hot-reload path already had this guard
(handleInvalidSnapshot), but the CLI restart/start commands did not.

AI-assisted (OpenClaw agent, fully tested)
2026-03-09 05:53:52 +00:00
..
browser-cli-actions-input refactor(browser): dedupe browser and cli command wiring 2026-03-02 21:31:36 +00:00
cron-cli fix(cron): consolidate announce delivery, fire-and-forget trigger, and minimal prompt mode (#40204) 2026-03-08 14:46:33 -07:00
daemon-cli fix(gateway): validate config before restart to prevent crash + macOS permission loss (#35862) 2026-03-09 05:53:52 +00:00
gateway-cli fix(gateway): exit non-zero on restart shutdown timeout 2026-03-09 05:38:54 +00:00
node-cli refactor: consolidate daemon runtime and start hints 2026-03-07 21:09:26 +00:00
nodes-cli fix(exec): inherit ask from exec-approvals.json when tools.exec.ask unset 2026-03-08 00:35:50 +00:00
program feat: add local backup CLI (#40163) 2026-03-08 16:21:20 -04:00
shared refactor: centralize strict numeric parsing 2026-03-08 03:02:25 +00:00
update-cli fix: restart Windows gateway via Scheduled Task (#38825) (#38825) 2026-03-07 18:00:38 +05:30
acp-cli.option-collisions.test.ts test: accept ACP token-file inspect errors 2026-03-08 02:27:18 +00:00
acp-cli.ts ACP: add optional ingress provenance receipts (#40473) 2026-03-09 04:19:03 +01:00
argv.test.ts CLI: unify routed config positional parsing 2026-03-02 21:11:53 -05:00
argv.ts CLI: unify routed config positional parsing 2026-03-02 21:11:53 -05:00
banner.test.ts chore: bump version to 2026.3.7 2026-03-07 10:09:02 +00:00
banner.ts CLI: include commit hash in --version output (#39712) 2026-03-08 19:10:48 +03:00
browser-cli-actions-input.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
browser-cli-actions-observe.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
browser-cli-debug.ts refactor: dedupe agent and browser cli helpers 2026-03-03 00:15:00 +00:00
browser-cli-examples.ts fix(security): harden archive extraction (#16203) 2026-02-14 14:42:08 +01:00
browser-cli-extension.test.ts test(cli): seed stable defaults while replacing setup resets 2026-02-22 07:35:54 +00:00
browser-cli-extension.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
browser-cli-inspect.test.ts test(cli): dedupe inspect runner and cover snapshot/screenshot mode defaults 2026-02-21 21:40:39 +00:00
browser-cli-inspect.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
browser-cli-manage.timeout-option.test.ts refactor: dedupe agent and browser cli helpers 2026-03-03 00:15:00 +00:00
browser-cli-manage.ts refactor: dedupe agent and browser cli helpers 2026-03-03 00:15:00 +00:00
browser-cli-resize.ts refactor(cli): share browser resize output helper 2026-02-15 18:25:47 +00:00
browser-cli-shared.ts refactor(cli): share browser resize request 2026-02-15 05:08:08 +00:00
browser-cli-state.cookies-storage.ts refactor(browser): dedupe browser and cli command wiring 2026-03-02 21:31:36 +00:00
browser-cli-state.option-collisions.test.ts refactor(browser): dedupe browser and cli command wiring 2026-03-02 21:31:36 +00:00
browser-cli-state.ts CLI: resolve parent/subcommand option collisions (#18725) 2026-02-17 20:57:09 -05:00
browser-cli-test-helpers.ts refactor(browser): dedupe browser and cli command wiring 2026-03-02 21:31:36 +00:00
browser-cli.test.ts test: dedupe and optimize test suites 2026-02-19 15:19:38 +00:00
browser-cli.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
channel-auth.test.ts fix: stop hardcoded channel fallback and auto-pick sole configured channel (#23357) (thanks @lbo728) 2026-02-22 11:21:43 +01:00
channel-auth.ts fix: stop hardcoded channel fallback and auto-pick sole configured channel (#23357) (thanks @lbo728) 2026-02-22 11:21:43 +01:00
channel-options.test.ts CLI: add root --help fast path and lazy channel option resolution (#30975) 2026-03-01 14:23:46 -08:00
channel-options.ts CLI: add root --help fast path and lazy channel option resolution (#30975) 2026-03-01 14:23:46 -08:00
channels-cli.ts fix: stop hardcoded channel fallback and auto-pick sole configured channel (#23357) (thanks @lbo728) 2026-02-22 11:21:43 +01:00
clawbot-cli.ts docs: align CLI docs and help surface 2026-02-22 20:05:01 +01:00
cli-name.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
cli-utils.test.ts Session/Cron maintenance hardening and cleanup UX (#24753) 2026-02-23 22:39:48 +00:00
cli-utils.ts refactor: consolidate duplicate utility functions (#12439) 2026-02-08 23:59:43 -08:00
command-format.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
command-options.test.ts test(cli): extend command option inheritance edge coverage 2026-02-21 21:40:39 +00:00
command-options.ts CLI: resolve parent/subcommand option collisions (#18725) 2026-02-17 20:57:09 -05:00
command-secret-gateway.test.ts feat: add local backup CLI (#40163) 2026-03-08 16:21:20 -04:00
command-secret-gateway.ts Config: fail closed invalid config loads (#39071) 2026-03-07 17:48:13 -08:00
command-secret-resolution.coverage.test.ts feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
command-secret-targets.test.ts feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
command-secret-targets.ts feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
completion-cli.ts docs: align CLI docs and help surface 2026-02-22 20:05:01 +01:00
completion-fish.test.ts refactor(cli): extract fish completion line builders 2026-02-22 07:44:56 +00:00
completion-fish.ts refactor(cli): extract fish completion line builders 2026-02-22 07:44:56 +00:00
config-cli.test.ts CI: restore main detect-secrets scan (#38438) 2026-03-07 10:06:35 -08:00
config-cli.ts CLI: dedupe config validate errors and expose allowed values 2026-03-02 20:05:12 -05:00
cron-cli.test.ts fix(cron): consolidate announce delivery, fire-and-forget trigger, and minimal prompt mode (#40204) 2026-03-08 14:46:33 -07:00
cron-cli.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
daemon-cli-compat.test.ts fix (cli): harden daemon compat shim for minimal bundle exports 2026-02-14 20:53:32 -08:00
daemon-cli-compat.ts fix (cli): harden daemon compat shim for minimal bundle exports 2026-02-14 20:53:32 -08:00
daemon-cli.coverage.test.ts test: cover daemon probe auth seam 2026-03-08 03:02:25 +00:00
daemon-cli.ts refactor(cli): share gateway service subcommands 2026-02-15 04:44:23 +00:00
deps-send-discord.runtime.ts build: fix ineffective dynamic imports with lazy boundaries (#33690) 2026-03-03 20:14:41 -05:00
deps-send-imessage.runtime.ts build: fix ineffective dynamic imports with lazy boundaries (#33690) 2026-03-03 20:14:41 -05:00
deps-send-signal.runtime.ts build: fix ineffective dynamic imports with lazy boundaries (#33690) 2026-03-03 20:14:41 -05:00
deps-send-slack.runtime.ts build: fix ineffective dynamic imports with lazy boundaries (#33690) 2026-03-03 20:14:41 -05:00
deps-send-telegram.runtime.ts build: fix ineffective dynamic imports with lazy boundaries (#33690) 2026-03-03 20:14:41 -05:00
deps-send-whatsapp.runtime.ts build: fix ineffective dynamic imports with lazy boundaries (#33690) 2026-03-03 20:14:41 -05:00
deps.test.ts test: dedupe repeated test fixtures and assertions 2026-02-22 18:37:25 +00:00
deps.ts build: fix ineffective dynamic imports with lazy boundaries (#33690) 2026-03-03 20:14:41 -05:00
devices-cli.test.ts test(core): reduce mock reset overhead in targeted suites 2026-02-22 08:40:29 +00:00
devices-cli.ts CLI: recover devices commands via local pairing fallback 2026-02-20 05:12:05 +00:00
directory-cli.ts refactor(cli): share directory list command flow 2026-02-18 18:38:58 +00:00
dns-cli.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
docs-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
exec-approvals-cli.test.ts test: dedupe and optimize test suites 2026-02-19 15:19:38 +00:00
exec-approvals-cli.ts refactor(cli): dedupe allowlist command wiring 2026-02-22 07:44:56 +00:00
gateway-cli.coverage.test.ts test(cli): fix gateway coverage mock signature 2026-03-02 13:00:21 +00:00
gateway-cli.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
gateway-rpc.ts fix(cron): fix timeout, add timestamp validation, enable file sync 2026-02-04 01:03:59 -08:00
help-format.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
hooks-cli.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
hooks-cli.ts refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
install-spec.ts refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
log-level-option.test.ts Feat/logger support log level validation0222 (#23436) 2026-02-22 11:15:13 +01:00
log-level-option.ts Feat/logger support log level validation0222 (#23436) 2026-02-22 11:15:13 +01:00
logs-cli.test.ts test(cli): use lightweight clear for logs gateway mock 2026-02-22 07:35:54 +00:00
logs-cli.ts fix(logs): respect TZ env var for timestamp display, fix Windows timezone (#21859) 2026-03-02 08:44:37 -06:00
memory-cli.test.ts docs(cli): improve memory command examples (#31803) 2026-03-07 19:03:23 +03:00
memory-cli.ts docs(cli): improve memory command examples (#31803) 2026-03-07 19:03:23 +03:00
models-cli.test.ts test: dedupe and optimize test suites 2026-02-19 15:19:38 +00:00
models-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
node-cli.ts fix: resolve ci failures 2026-01-18 08:45:29 +00:00
nodes-camera.test.ts refactor(nodes): dedupe camera payload and node resolve helpers 2026-03-02 23:32:41 +00:00
nodes-camera.ts refactor(nodes): dedupe camera payload and node resolve helpers 2026-03-02 23:32:41 +00:00
nodes-canvas.ts refactor(cli): extract shared node media helpers 2026-02-18 23:34:15 +00:00
nodes-cli.coverage.test.ts fix(exec): inherit ask from exec-approvals.json when tools.exec.ask unset 2026-03-08 00:35:50 +00:00
nodes-cli.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
nodes-media-utils.test.ts refactor(cli): extract shared node media helpers 2026-02-18 23:34:15 +00:00
nodes-media-utils.ts Security: harden tool media paths 2026-02-20 13:32:49 -06:00
nodes-run.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
nodes-screen.ts refactor(cli): extract shared node media helpers 2026-02-18 23:34:15 +00:00
npm-resolution.test.ts refactor(cli): share pinned npm install record helper 2026-02-22 07:44:56 +00:00
npm-resolution.ts refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
outbound-send-deps.ts refactor(cli): share outbound send dependency mapping 2026-02-21 21:40:39 +00:00
outbound-send-mapping.test.ts refactor(cli): share outbound send dependency mapping 2026-02-21 21:40:39 +00:00
outbound-send-mapping.ts refactor(cli): share outbound send dependency mapping 2026-02-21 21:40:39 +00:00
pairing-cli.test.ts test(cli): seed stable defaults while replacing setup resets 2026-02-22 07:35:54 +00:00
pairing-cli.ts CLI: default pairing channel for pairing commands 2026-02-20 19:59:54 -08:00
parse-bytes.ts fix: unify session maintenance and cron run pruning (#13083) 2026-02-09 20:42:35 -08:00
parse-duration.ts Session/Cron maintenance hardening and cleanup UX (#24753) 2026-02-23 22:39:48 +00:00
parse-timeout.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
plugin-install-plan.test.ts fix: prefer bundled channel plugins over npm duplicates (#40094) 2026-03-08 13:00:24 -05:00
plugin-install-plan.ts fix: prefer bundled channel plugins over npm duplicates (#40094) 2026-03-08 13:00:24 -05:00
plugin-registry.ts style: align formatting with oxfmt 0.33 2026-02-18 01:34:35 +00:00
plugins-cli.ts refactor(cli): extract plugin install plan helper 2026-03-03 02:51:11 +00:00
plugins-config.test.ts fix: sync built-in channel enablement across config paths 2026-02-23 19:40:42 +00:00
plugins-config.ts fix: sync built-in channel enablement across config paths 2026-02-23 19:40:42 +00:00
ports.test.ts fix(gateway): synthesize lifecycle robustness for restart and startup probes (#33831) 2026-03-03 21:31:12 -06:00
ports.ts fix(gateway): synthesize lifecycle robustness for restart and startup probes (#33831) 2026-03-03 21:31:12 -06:00
profile-utils.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
profile.test.ts test: dedupe and optimize test suites 2026-02-19 15:19:38 +00:00
profile.ts fix(paths): respect OPENCLAW_HOME for all internal path resolution (#12091) 2026-02-08 16:20:13 -05:00
program.force.test.ts fix(gateway): add Windows-compatible port detection using netstat fallback (openclaw#29239) thanks @ajay99511 2026-03-02 08:33:59 -06:00
program.nodes-basic.e2e.test.ts test: move integration-heavy suites to e2e lane 2026-03-02 05:33:07 +00:00
program.nodes-media.e2e.test.ts fix(security): fail-close node camera URL downloads 2026-03-02 23:23:39 +00:00
program.nodes-test-helpers.test.ts test(cli): share nodes ios fixture helpers 2026-02-22 07:44:56 +00:00
program.nodes-test-helpers.ts test(cli): share nodes ios fixture helpers 2026-02-22 07:44:56 +00:00
program.smoke.test.ts test(perf): reduce repeated cli program setup overhead 2026-03-02 14:02:47 +00:00
program.test-mocks.ts fix(ci): repair e2e mocks and tool schemas 2026-02-15 23:14:42 +00:00
program.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
progress.test.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
progress.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
prompt.test.ts chore: Fix types in tests 30/N. 2026-02-17 14:32:57 +09:00
prompt.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
qr-cli.test.ts CI: restore main detect-secrets scan (#38438) 2026-03-07 10:06:35 -08:00
qr-cli.ts refactor: unify gateway SecretRef auth resolution paths 2026-03-07 23:27:50 +00:00
qr-dashboard.integration.test.ts Gateway: add SecretRef support for gateway.auth.token with auth-mode guardrails (#35094) 2026-03-05 12:53:56 -06:00
requirements-test-fixtures.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
respawn-policy.ts perf(cli): speed up help/config paths and route config get/unset 2026-02-14 00:27:35 +00:00
route.test.ts CLI: dedupe config validate errors and expose allowed values 2026-03-02 20:05:12 -05:00
route.ts CLI: dedupe config validate errors and expose allowed values 2026-03-02 20:05:12 -05:00
run-main.exit.test.ts fix: ensure CLI exits after command completion (#12906) 2026-02-14 00:34:33 +01:00
run-main.profile-env.test.ts fix(cli): apply --profile before dotenv bootstrap in runCli (#31950) 2026-03-02 18:09:45 +00:00
run-main.test.ts CLI: dedupe config validate errors and expose allowed values 2026-03-02 20:05:12 -05:00
run-main.ts Config: fail closed invalid config loads (#39071) 2026-03-07 17:48:13 -08:00
sandbox-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
secrets-cli.test.ts feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
secrets-cli.ts feat(secrets): expand SecretRef coverage across user-supplied credentials (#29580) 2026-03-03 02:58:20 +00:00
security-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
skills-cli.commands.test.ts refactor(cli): dedupe skills command report loading 2026-02-22 07:44:56 +00:00
skills-cli.format.ts refactor(cli): reuse skill missing summary 2026-02-15 16:46:04 +00:00
skills-cli.formatting.test.ts test: move local cli and config scenario suites out of e2e 2026-02-22 10:58:04 +00:00
skills-cli.test.ts test: drop duplicate skills-cli integration coverage 2026-02-19 07:33:37 +00:00
skills-cli.ts refactor(cli): dedupe skills command report loading 2026-02-22 07:44:56 +00:00
system-cli.test.ts refactor(cli): dedupe system gateway action handling 2026-02-21 21:40:39 +00:00
system-cli.ts refactor(cli): dedupe system gateway action handling 2026-02-21 21:40:39 +00:00
tagline.test.ts feat(cli): add configurable banner tagline mode 2026-03-03 00:31:51 +00:00
tagline.ts feat(cli): add configurable banner tagline mode 2026-03-03 00:31:51 +00:00
test-runtime-capture.ts fix(cli): align runtime capture helper with RuntimeEnv signature 2026-02-18 13:34:03 +00:00
tui-cli.ts refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
update-cli.option-collisions.test.ts test: dedupe and optimize test suites 2026-02-19 15:19:38 +00:00
update-cli.test.ts test(cli): reduce update/program suite overhead 2026-03-02 09:46:27 +00:00
update-cli.ts feat(update): add core auto-updater and dry-run preview 2026-02-22 17:11:36 +01:00
wait.ts
webhooks-cli.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
windows-argv.ts refactor(cli): share windows argv normalization 2026-02-14 15:39:46 +00:00