agent-orchestrator/packages/cli/__tests__/commands
Dhruv Sharma fcedb25031
feat(core): activity events for recovery, metadata corruption, agent-report (#1692)
* feat(core): activity events for recovery, metadata corruption, agent-report

Wires activity events into three forensic-critical paths so RCA can
reconstruct what happened after the fact:

1. recovery subsystem
   - recovery.session_failed (MUST) per failed session in runRecovery
   - recovery.action_failed (SHOULD) on recoverSession outer catch
   Adds "recovery" to ActivityEventSource so `ao events list --source
   recovery` reconstructs an `ao recover` invocation timeline.

2. metadata corruption
   - metadata.corrupt_detected (MUST) when mutateMetadata renames a
     corrupt session-metadata file to .corrupt-{ts}. Includes
     data.renamedTo and a 200-char data.contentSample (B11) for forensic
     recovery. Previously only console.warn — silent overwrites had no
     queryable signal.

3. agent-report apply path
   - api.agent_report.transition_rejected (SHOULD)
   - api.agent_report.session_not_found (COULD)

Per B22, recovery events fire per session, not per probe step. Per B11,
metadata.corrupt_detected truncates contentSample to 200 chars (full
file would exceed the 16KB sanitizer cap).

Closes #1660

* fix(core): align forensic activity event metadata

* fix(core): cover single-session recovery failures

* fix(core): improve corrupt metadata event attribution

* fix(cli): expose activity event source filter

---------

Co-authored-by: whoisasx <adil.business4064@gmail.com>
2026-05-18 17:27:36 +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
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 fix(cli): register project command (#1576) 2026-04-30 20:34:30 +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: add $schema support to agent-orchestrator.yaml (#1373) 2026-04-26 19:42:45 +05:30
spawn.test.ts fix(cli): refuse to spawn when daemon is not polling the project (#1460) 2026-05-08 18:13:42 +05:30
start.test.ts fix(cli): reap daemon children on stop+SIGINT, sweep orphans on start (closes #1848) (#1849) 2026-05-15 03:38:09 +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.test.ts feat(release): weekly release train — channels, onboarding, dashboard banner, cron (#1781) 2026-05-12 23:11:09 +05:30