fix(sidebar): keep repos with only finished agents out of "With agents"#709
Merged
Merged
Conversation
The repo-list sections counted every standalone session toward "With agents" membership, including terminal (done/error) ones. A repo whose agents had all finished therefore lingered in "With agents" looking agentless, and its only affordance was the active card's destructive repo-remove "x" — making cleanup behave like full removal (#708). Compute section membership from active agents only via a new filterActiveStandaloneProjectSessions helper, mirroring the predicate the collapsed mini-dots already use (status not in {done, error}). Repos with only finished agents now fall back to "Repositories" (or pin above the sections when active), so the destructive "x" only applies to a genuinely agentless repo where removal is the intended action. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 tasks
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.
Summary
When all of a repo's agents finished, the repo stayed listed under With agents instead of dropping back to Repositories, and its only affordance — the active card's
×— removed the repo entirely. So the one available "cleanup" action behaved like destructive removal (the user had to re-add the repo).Root cause: section membership in
ProjectList.tsxcounted every standalone session viafilterStandaloneProjectSessions(...).length > 0, including terminal (done/error) ones. The collapsed mini-dots already hide terminal agents (status !== 'done' && status !== 'error'), so a finished-agent repo appeared in With agents with no dots — looking agentless while still being grouped there.Fix: compute the three section-membership values (
withAgentsProjects,inactiveProjects,activeHasAgents) from active agents only, via a newfilterActiveStandaloneProjectSessionshelper that mirrors the mini-dot predicate. A repo with only finished agents now falls into Repositories (or pins above the sections when it is the active repo), so the destructive×only applies to a genuinely agentless repo where removal is the intended action. The active card still renders its terminal agents (rendering usesfilterStandaloneProjectSessions, unchanged), so finished agents stay visible/deletable.Scope note: deleting an agent already removed its session, so that path was never the bug; this only changes how terminal-but-not-deleted sessions are grouped.
useAutoSelectActiveProject(a separate feature) intentionally keeps the all-sessions filter.Testing
npm test -- src/renderer/session-selection.test.ts src/renderer/components/sidebar/ProjectSidebar.test.tsx→ 47 passed (2 new sidebar reproduction tests + 3 new helper unit tests; both reproductions fail onmain, pass with the fix).npm test(full suite) → 2214 tests passed. The 4 failing suites are the known local worktree artifact (Denied ID … pdf.worker.min.mjs?urlfrom symlinkednode_modules; green on CI) and are unrelated to this change.npm run typecheck:web→ clean.Verification is via component tests that render the real
ProjectSidebar→ProjectListtree withdone/errorsessions, exercising the exact membership code path. Live-app before/after screenshots were not captured because driving a runtime to a terminal (done) state deterministically is impractical in the autonomous run; the deterministic component tests cover the same path.Fixes #708