agent-orchestrator/.changeset
Ashish Huddar f330a1ea69
feat(cli): filter terminated sessions from ao session ls / ao status by default (#1340)
* feat(cli): filter terminated sessions from ao session ls / ao status by default

Closes #1310. Terminated sessions (killed/terminated/done/merged/errored/cleanup,
plus lifecycle-driven terminal states) are now hidden from `ao session ls` and
`ao status` by default. A dim footer reports how many were hidden and how to
surface them. Pass `--include-terminated` to restore the full list.

JSON output wraps into `{ data: [...], meta: { hiddenTerminatedCount } }` on
both commands so text and machine-readable views tell the same story. This is a
breaking change for script consumers of `--json`; `--include-terminated` is the
escape hatch.

Orthogonal to `-a, --all` (orchestrator visibility, unchanged). Restore of
terminated sessions by id is unaffected — that path goes through `sm.get`, not
`sm.list`.

Docs (`SETUP.md`, `docs/CLI.md`) updated to match. Tests cover both the legacy
status branch and the canonical lifecycle branch of `isTerminalSession`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(cli): drop unused `lc` param in lifecycle-alive test case

ESLint's no-unused-vars rejects unprefixed unused args. The "alive — should
remain visible" branch of the new lifecycle-driven filter test in
`session.test.ts` took `lc` but never touched it. Switch to `()`. Matches the
equivalent case in `status.test.ts`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(core): preserve pr.state=merged when legacy metadata lacks pr= URL

Review blocker on PR #1340: a metadata file with `status=merged` but no `pr=`
URL was still showing as active in `ao session ls` / `ao status` by default.

Root cause: `synthesizePRState()` in lifecycle-state.ts short-circuited to
`{ state: "none" }` whenever no PR URL was present, ignoring the fact that the
legacy `status` column already encodes terminal truth. Once lifecycle was
synthesized as `session.state="idle"` + `pr.state="none"`, `deriveLegacyStatus`
returned `"idle"` and `isTerminalSession()` (lifecycle branch) returned false.
The new CLI filter then let the session through.

Fix: when legacy `status === "merged"` and no URL is available, synthesize
`pr.state="merged", reason="merged"` with `number: null, url: null`. The
terminal signal survives the flat-metadata → canonical-lifecycle round trip.

Also:
- Export `sessionFromMetadata` from the core barrel. CLI tests and external
  consumers need it to round-trip metadata through the canonical lifecycle.
- Update CLI `buildSessionsFromDir` helpers to route through `sessionFromMetadata`
  so mocked `sm.list()` reflects production reconstruction (the old shortcut
  bypassed synthesis entirely and was the reason the bug slipped past the
  original test suite).
- Add regression tests: one at the core level (`parseCanonicalLifecycle` for
  merged-without-URL) and one integration-style test per CLI command asserting
  the reviewer's exact repro produces the expected filtered output.
- One pre-existing test expectation updated: when metadata has `status=working`
  and `pr=<url>`, the reconstructed status is `pr_open`, not `working`. That's
  what production `sm.list()` has always returned; the test was previously
  hiding behind the reconstruction shortcut.

Changeset bumped to include ao-core (patch).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(cli): route review-check helper through sessionFromMetadata

Last remaining test-fidelity shortcut flagged by codex on PR #1340. The
`buildSessionsFromDir` helper in review-check.test.ts fabricated Session
objects by hand, bypassing the canonical lifecycle reconstruction that
production `sm.list()` runs. Doesn't affect review-check's actual behavior
(which reads `session.metadata["pr"]` directly), but aligns this test with
the equivalent helpers in session.test.ts and status.test.ts so future
lifecycle changes don't silently skip this surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 13:05:34 +05:30
..
README.md feat: publish to npm under @composio scope (#32) 2026-02-15 04:28:57 +05:30
agent-plugin-safety-costs.md fix: register codex web activity plugin 2026-04-18 14:15:29 +05:30
auto-cleanup-on-merge.md feat(core): auto-terminate sessions on PR merge (#1309) (#1311) 2026-04-20 12:56:07 +05:30
collapsible-agent-reports.md feat: make agent reports collapsible (#132) 2026-04-17 21:39:37 +05:30
config.json chore: rename @composio scope to @aoagents across all packages 2026-04-09 15:59:33 +00:00
filter-terminated-sessions-from-ls.md feat(cli): filter terminated sessions from ao session ls / ao status by default (#1340) 2026-04-20 13:05:34 +05:30
fix-activity-unavailable-stuck.md fix: avoid stuck probe failures for unavailable activity (#129) 2026-04-17 21:22:44 +05:30
fix-web-lifecycle-restore-affordances.md fix(web): keep closed-unmerged sessions actionable 2026-04-17 14:42:25 +05:30
isolate-lifecycle-terminal-logs.md chore: replace changelog entry with changeset (#121) 2026-04-17 16:36:37 +05:30
late-lions-share.md fix: finish PR #1300 major follow-up fixes 2026-04-18 12:35:15 +05:30
lifecycle-activity-signal-contract.md fix(core): address PR #1300 review feedback 2026-04-18 01:54:38 +05:30
lifecycle-transitions-report-watcher.md fix: address PR review comments for lifecycle transitions 2026-04-18 00:39:35 +05:30
optional-repo-field.md fix: address all 9 review comments from @illegalcall 2026-04-15 03:04:12 +05:30
pr1300-review-followups.md fix: close remaining pr1300 follow-ups 2026-04-18 15:18:24 +05:30
session-ui-audit-oscillation.md fix: address PR review feedback for session audit trail 2026-04-17 21:06:08 +05:30
stage2-evidence-recovery.md fix: address stage 2 PR review feedback (#95) 2026-04-16 22:46:12 +05:30
stage4-pr-policy.md fix: decouple PR truth from worker session policy 2026-04-17 10:44:35 +05:30
stage5-ui-api-rollout.md feat: expose split lifecycle truth in dashboard 2026-04-17 13:00:26 +05:30

README.md

Changesets

Hello and welcome! This folder has been automatically generated by @changesets/cli, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it in our repository

We have a quick list of common questions to get you started engaging with this project in
our documentation