agent-orchestrator/packages/cli/__tests__/commands
Dhruv Sharma 6d48022c87
feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698)
* feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1654)

Adds "cli" to ActivityEventSource and emits ~30 activity events across the CLI
surface so `ao events list --source cli` can answer RCA questions like:

- Did AO start cleanly? When? (cli.start_invoked / cli.start_failed)
- Was AO shut down gracefully or did it crash? (cli.shutdown_signal /
  cli.shutdown_completed / cli.shutdown_force_exit / cli.stale_running_pruned)
- Did ao spawn / ao update / ao stop / ao migrate-storage fail and why?
- Did the auto-restore prompt actually restore sessions?

Instrumented files:
- packages/core/src/activity-events.ts (cli source)
- packages/cli/src/lib/shutdown.ts (signal/completed/failed/force_exit/session_kill_failed)
- packages/cli/src/commands/start.ts (start_invoked/start_failed/restore_*/stop_*/daemon_*/last_stop_* /config_migrated)
- packages/cli/src/commands/spawn.ts (spawn_invoked/spawn_failed)
- packages/cli/src/commands/update.ts (update_invoked/update_failed)
- packages/cli/src/commands/setup.ts (setup_failed)
- packages/cli/src/commands/migrate-storage.ts (migration_completed/migration_failed)
- packages/cli/src/commands/project.ts (project_register_failed)
- packages/cli/src/lib/resolve-project.ts (project_resolve_failed/config_recovered/config_recovery_failed)
- packages/cli/src/lib/running-state.ts (lock_timeout/stale_running_pruned)
- packages/cli/src/lib/credential-resolver.ts (credential_load_failed)

All emits are sync, never wrapped in try/catch (recordActivityEvent never
throws), and put raw error text in data.errorMessage (not summary, which is
FTS-indexed and not credential-sanitized).

Tests:
- 16 new instrumentation tests across shutdown, migrate-storage, update,
  resolve-project, and start/stop action paths covering MUST emits.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix: correct CLI activity event semantics

* fix(cli): emit migrate-storage invocation event

* fix(cli): record last-stop write failures

* fix(linear): retry transient API failures

* fix(cli): stabilize update instrumentation test

* fix(cli): stub process probes in stop instrumentation tests

* chore(ci): retrigger checks

* Fix CLI failure event review issues

* fix: bound linear integration cleanup

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: whoisasx <adil.business4064@gmail.com>
Co-authored-by: Adil Shaikh <106678504+whoisasx@users.noreply.github.com>
2026-05-18 21:04:25 +05:30
..
completion.test.ts refactor(core): storage redesign — projectId-based paths, JSON metadata (#1466) 2026-04-28 17:55:53 +05:30
dashboard.test.ts feat(windows): complete Windows support (#1025) 2026-05-09 00:10:53 +05:30
doctor.test.ts fix: make update checks install-method aware (#1595) 2026-05-10 22:20:59 +05:30
events.test.ts feat(core): activity events for recovery, metadata corruption, agent-report (#1692) 2026-05-18 17:27:36 +05:30
migrate-storage.test.ts feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698) 2026-05-18 21:04:25 +05:30
open.test.ts feat(windows): complete Windows support (#1025) 2026-05-09 00:10:53 +05:30
plugin.test.ts feat: add $schema support to agent-orchestrator.yaml (#1373) 2026-04-26 19:42:45 +05:30
project.test.ts feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698) 2026-05-18 21:04:25 +05:30
report.test.ts refactor(core): storage redesign — projectId-based paths, JSON metadata (#1466) 2026-04-28 17:55:53 +05:30
review-check.test.ts Add multi-project storage, resolution, and project settings support (#1343) 2026-04-21 17:45:55 +05:30
send.test.ts feat: enable worker→orchestrator dialogue via `ao send` with auto-sender prefix (#1787) 2026-05-10 21:50:43 +05:30
session.test.ts feat(windows): complete Windows support (#1025) 2026-05-09 00:10:53 +05:30
setup.test.ts feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698) 2026-05-18 21:04:25 +05:30
spawn.test.ts feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698) 2026-05-18 21:04:25 +05:30
start-stop-instrumentation.test.ts feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698) 2026-05-18 21:04:25 +05:30
start.test.ts feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698) 2026-05-18 21:04:25 +05:30
status.test.ts feat(cli): filter terminated sessions from ao session ls / ao status by default (#1340) 2026-04-20 13:05:34 +05:30
update-instrumentation.test.ts feat(cli): wire activity events into CLI commands and supervisor lifecycle (#1698) 2026-05-18 21:04:25 +05:30
update.test.ts feat(release): weekly release train — channels, onboarding, dashboard banner, cron (#1781) 2026-05-12 23:11:09 +05:30