agent-orchestrator/backend/internal
itrytoohard 2d00e4675d fix(cli): harden daemon control surface and stop CLI from writing the store
Addresses review findings on PR #53 (on top of the rebase onto main).

- doctor: stop opening/migrating SQLite. The daemon is the sole store
  writer/migrator (architecture.md §7); the CLI must not run migrations or
  open a second writer against a DB a live daemon owns. doctor now reports
  database-file presence and gains --json.
- stop: only remove running.json when it still belongs to the PID we
  stopped, so a concurrent `ao start` that wrote a new run-file is not
  clobbered into looking stopped.
- httpd: gate POST /shutdown to loopback callers with no Origin header,
  closing the CSRF / DNS-rebinding vector against an unauthenticated,
  state-changing endpoint.
- start: detach the spawned daemon into its own session/process group so a
  Ctrl-C while `ao start` waits for readiness doesn't also kill it.
- cli: exit 2 for usage errors (bad flag / arg count) vs 1 for runtime
  failures.
- daemon: unexport newLogger (only used in-package).
- tests: /shutdown guard (cross-origin + rebinding) and stop run-file
  ownership guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 01:55:14 +05:30
..
adapters refactor(tracker): address code-review findings 2026-05-30 22:32:45 +05:30
cdc feat: add durable notification foundation 2026-06-01 00:07:55 +05:30
cli fix(cli): harden daemon control surface and stop CLI from writing the store 2026-06-01 01:55:14 +05:30
config docs(config): drop stale CDC-JSONL mention in resolveDataDir 2026-05-31 07:18:22 +05:30
daemon fix(cli): harden daemon control surface and stop CLI from writing the store 2026-06-01 01:55:14 +05:30
daemonmeta fix(cli): verify daemon ownership before stop signal 2026-06-01 01:45:04 +05:30
domain feat: add durable notification foundation 2026-06-01 00:07:55 +05:30
httpd fix(cli): harden daemon control surface and stop CLI from writing the store 2026-06-01 01:55:14 +05:30
integration feat: add durable notification foundation 2026-06-01 00:07:55 +05:30
lifecycle feat: add durable notification foundation 2026-06-01 00:07:55 +05:30
notification feat: add durable notification foundation 2026-06-01 00:07:55 +05:30
observe/reaper feat(backend): port lifecycle lane onto the new storage+CDC model 2026-05-31 07:16:06 +05:30
ports feat: add durable notification foundation 2026-06-01 00:07:55 +05:30
project feat(api): implement project routes with mock manager/store (#47) 2026-05-31 20:31:22 +05:30
runfile feat(api): implement project routes with mock manager/store (#47) 2026-05-31 20:31:22 +05:30
session feat(backend): port lifecycle lane onto the new storage+CDC model 2026-05-31 07:16:06 +05:30
storage/sqlite feat: add durable notification foundation 2026-06-01 00:07:55 +05:30
terminal fix(terminal): guard subscribe-to-assign window in openTerminal 2026-05-31 23:42:59 +05:30