* 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> |
||
|---|---|---|
| .. | ||
| README.md | ||
| agent-plugin-safety-costs.md | ||
| auto-cleanup-on-merge.md | ||
| collapsible-agent-reports.md | ||
| config.json | ||
| filter-terminated-sessions-from-ls.md | ||
| fix-activity-unavailable-stuck.md | ||
| fix-web-lifecycle-restore-affordances.md | ||
| isolate-lifecycle-terminal-logs.md | ||
| late-lions-share.md | ||
| lifecycle-activity-signal-contract.md | ||
| lifecycle-transitions-report-watcher.md | ||
| optional-repo-field.md | ||
| pr1300-review-followups.md | ||
| session-ui-audit-oscillation.md | ||
| stage2-evidence-recovery.md | ||
| stage4-pr-policy.md | ||
| stage5-ui-api-rollout.md | ||
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