fix(cli): exclude terminated sessions from ao status active count with --include-terminated#2118
Open
Bdandc wants to merge 1 commit into
Open
Conversation
…h --include-terminated The footer summary in 'ao status' counted every displayed session as active, so '--include-terminated' inflated the 'N active sessions across M projects' line with terminated/exited sessions. The flag should only affect visibility, never the active count. Summary totals (workers and orchestrators) now skip sessions where isTerminalSession() is true, regardless of the display flag. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes a session-count bug in the
ao statusfooter summary: with terminated sessions present,ao status --include-terminatedcounted them as active (e.g.5 active sessions across 2 projectswhen all 5 were terminated), while plainao statuscorrectly showed0 active sessions.Why
The summary totals in
packages/cli/src/commands/status.tscounted every displayed session (totalWorkers += workers.length). Since--include-terminatedadds terminal sessions to the displayed list, they leaked into the "active" count. The flag should only affect visibility, never what counts as active.How
isTerminalSession()is true, pairing eachSessionInfowith its sourceSession(the arrays are parallel by construction).N terminated sessions hiddenfooter still appears when it isn't.Tests
Added three tests in
packages/cli/__tests__/commands/status.test.ts:--include-terminated: terminated sessions are displayed but not counted as active--include-terminated: terminated orchestrators don't produce a· 1 orchestratorsuffixVerified tests 2–3 fail without the fix and pass with it.
Verification
pnpm --filter @aoagents/ao-cli typecheck✅eslinton changed files ✅pnpm --filter @aoagents/ao-cli test: 907 passed, 1 failed — the failure (canonicalCompareKey > expands ~ to HOMEinpath-equality.test.ts) is pre-existing and environment-specific (macOS/tmp→/private/tmpsymlink); it fails identically on a clean tree without this change.🤖 Generated with Claude Code