openclaw/src/daemon
norunners d799a3994f fix(doctor): reconcile gateway service token drift after re-pair
`openclaw doctor` audited gateway service runtime/path settings but did not
check whether the daemon's `OPENCLAW_GATEWAY_TOKEN` matched
`gateway.auth.token` in `openclaw.json`.

After re-pairing or token rotation, the config token and service env token can
drift. The daemon may keep running with a stale service token, leading to
unauthorized handshake failures for cron/tool clients.

Add a gateway service audit check for token drift and pass
`cfg.gateway.auth.token` into service audits so doctor treats config as the
source of truth when deciding whether to reinstall the service.

Key design decisions:
- Use `gateway.auth.token` from `openclaw.json` as the authority for service
  token drift detection
- Only flag mismatch when an authoritative config token exists
- Keep fix in existing doctor service-repair flow (no separate migration step)
- Add focused tests for both audit mismatch behavior and doctor wiring

Fixes #18175
2026-02-16 23:51:16 +01:00
..
arg-split.ts refactor(daemon): share quoted arg splitter 2026-02-15 12:49:30 +00:00
constants.test.ts test: remove duplicate daemon profile trim wrappers 2026-02-16 06:53:13 +00:00
constants.ts refactor(daemon): share service description resolve 2026-02-16 00:36:43 +00:00
diagnostics.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
exec-file.ts refactor: dedupe daemon exec wrappers 2026-02-15 03:53:53 +00:00
inspect.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
launchd-plist.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
launchd.test.ts test: drop redundant daemon profile normalization wrappers 2026-02-16 06:36:15 +00:00
launchd.ts refactor(daemon): share service description resolve 2026-02-16 00:36:43 +00:00
node-service.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
output.ts refactor: dedupe chat envelope + daemon output + skills UI 2026-02-15 03:41:11 +00:00
paths.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
program-args.test.ts revert: Switch back to `tsc` for compiling. 2026-01-31 18:31:49 +09:00
program-args.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
runtime-format.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
runtime-parse.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
runtime-paths.test.ts fix(runtime): bump minimum Node.js version to 22.12.0 (#5370) 2026-02-05 13:42:52 -08:00
runtime-paths.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
schtasks-exec.ts refactor: dedupe daemon exec wrappers 2026-02-15 03:53:53 +00:00
schtasks.test.ts test: drop redundant daemon profile normalization wrappers 2026-02-16 06:36:15 +00:00
schtasks.ts refactor(daemon): share service description resolve 2026-02-16 00:36:43 +00:00
service-audit.test.ts fix(doctor): reconcile gateway service token drift after re-pair 2026-02-16 23:51:16 +01:00
service-audit.ts fix(doctor): reconcile gateway service token drift after re-pair 2026-02-16 23:51:16 +01:00
service-env.test.ts perf(test): consolidate daemon test entrypoints 2026-02-16 02:45:00 +00:00
service-env.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
service-runtime.ts fix: improve gateway diagnostics 2026-01-08 02:29:32 +01:00
service.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
systemd-hints.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
systemd-linger.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
systemd-unit.ts refactor(daemon): share quoted arg splitter 2026-02-15 12:49:30 +00:00
systemd.test.ts test: drop redundant daemon profile normalization wrappers 2026-02-16 06:36:15 +00:00
systemd.ts fix(daemon): drop unused formatGatewayServiceDescription import 2026-02-16 00:37:19 +00:00