Repository navigation
Conversation
There was a problem hiding this comment.
ℹ️ No blocking issues — one doc/naming drift and one scope question.
Reviewed changes
- Augment the repo filter instead of clearing it on reveal —
activateAndRevealWorktreestep 5 now appendswt.repoIdtofilterRepoIdswhen the target repo is filtered out, rather than resetting the array. - Same append in skip-finalization —
finalizeImportedRepoAfterSkipappends the imported repo id under the samelength > 0 && !includesguard, so both add-project branches (with and without a default checkout) preserve the existing selection. - Tests updated and extended — the three touched test files were updated to the append expectation, plus a new
#20796regression test in each of the two code paths.
ℹ️ This edit lives in the shared reveal helper, not just the add-project flow
The issue is scoped to adding projects, but activateAndRevealWorktree is the reveal path for every activation. With clearSidebarFilters defaulting to true, any activation whose target repo is filtered out now appends that repo to the user's persisted filterRepoIds, not only adds.
Technical details
# Reveal-helper scope
## Affected sites
- `src/renderer/src/lib/worktree-activation.ts:298` — `clearSidebarFilters` defaults to true, so callers that omit it append the target repo whenever the repo was filtered out.
- `src/renderer/src/hooks/ipc-events/worktree-event-runtime.ts:154` — host-runtime `activateWorktree` stream events.
- `src/renderer/src/components/sidebar/active-worktree-focus-after-delete.ts:90` — post-delete focus handoff (`revealInSidebar: false`, so the filter mutates without a reveal).
- `src/renderer/src/lib/sidebar-worktree-activation.ts:26` — sidebar row click (`revealInSidebar: false`).
`jumpToWorktreeFromSidebar` already passes `clearSidebarFilters: false` for targets it detected as filter-hidden, so the common Cmd+J / palette jump case does not grow the filter.
## Required outcome
- Confirm that appending the target repo on non-add activations is intended, or scope the append to the add-project call sites / an explicit option.
## Open questions for the human
- Should an automatic (host-runtime / post-delete) activation silently expand the user's persisted project filter?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| if (opts?.clearSidebarFilters !== false) { | ||
| if (state.filterRepoIds.length > 0 && !state.filterRepoIds.includes(wt.repoId)) { | ||
| state.setFilterRepoIds([]) | ||
| state.setFilterRepoIds([...state.filterRepoIds, wt.repoId]) |
There was a problem hiding this comment.
Now that this augments the repo filter instead of clearing it, the step-5 comment above (// 5. Clear sidebar filters hiding the target) and the clearSidebarFilters option name/JSDoc no longer describe the behavior. Rewording them (e.g. "Extend the repo filter to include the target") would keep the next reader from expecting a full clear.
📝 WalkthroughWalkthroughThe change preserves existing repository filters when imported repositories or worktrees are revealed. Priority: ⬇️ Low Severity of issue fixed: Low Merge Risk: 🔵 Low · up to A repository added while a catalog refresh is already in flight can remain hidden behind the user's previous filters. The narrow race should be fixed before relying on this reveal behavior. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, affected call sites, solution, issue number, and test results. However, it omits several required template sections, including ELI5, What Changed, Visual Proof or N/A, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist details. Resolution Complete the required template sections. Add ELI5, What Changed, Visual Proof or an explicit N/A with a reason, AI Disclosure if applicable, Review, Agent skill upstream boundary, Notes, and the required checklist items, including platform testing and validation commands.
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 332c447f-2ade-4468-b497-856160664893
📒 Files selected for processing (5)
src/renderer/src/components/sidebar/add-repo-skip-finalization.test.tssrc/renderer/src/components/sidebar/add-repo-skip-finalization.tssrc/renderer/src/components/sidebar/project-added-default-checkout.test.tssrc/renderer/src/lib/worktree-activation-reveal.test.tssrc/renderer/src/lib/worktree-activation.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| } | ||
| if (state.filterRepoIds.length > 0 && !state.filterRepoIds.includes(importedRepoId)) { | ||
| state.setFilterRepoIds([]) | ||
| state.setFilterRepoIds([...state.filterRepoIds, importedRepoId]) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- target outline ---'
ast-grep outline src/renderer/src/components/sidebar/add-repo-skip-finalization.ts
printf '%s\n' '--- target source ---'
cat -n src/renderer/src/components/sidebar/add-repo-skip-finalization.ts
printf '%s\n' '--- worktree source ---'
sed -n '240,330p' src/renderer/src/lib/worktree-activation.ts
printf '%s\n' '--- relevant symbols ---'
rg -n --glob '!node_modules' 'retainValidFilterRepoIds|addRepoPath|filterRepoIds|catalog' src/renderer/src | head -240Repository: stablyai/orca
Length of output: 37691
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- retain helper ---'
cat -n src/renderer/src/store/slices/repo-filter-selection.ts
printf '%s\n' '--- fencing ---'
cat -n src/renderer/src/store/repos/repo-catalog-fencing.ts
printf '%s\n' '--- repo state/add ---'
sed -n '120,205p' src/renderer/src/store/repos/repo-state.ts
sed -n '1,215p' src/renderer/src/store/repos/repo-add-actions.ts
printf '%s\n' '--- catalog action apply paths ---'
sed -n '1,190p' src/renderer/src/store/repos/repo-catalog-actions.ts
sed -n '1,210p' src/renderer/src/store/repos/runtime-repo-catalog-actions.ts
sed -n '1,215p' src/renderer/src/store/repos/all-host-repo-catalog-actions.ts
printf '%s\n' '--- relevant tests ---'
sed -n '330,410p' src/renderer/src/store/slices/repos-refresh-identity.test.ts
rg -n 'stale|generation|addRepoPath|fetchRepos|retainValidFilterRepoIds|filterRepoIds' src/renderer/src/store/repos src/renderer/src/components/sidebar src/renderer/src/lib/*test* | headRepository: stablyai/orca
Length of output: 45676
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- fetched catalog merge ---'
sed -n '1,180p' src/renderer/src/store/repos/repo-catalog-merge.ts
printf '%s\n' '--- generation mutations and add/import callers ---'
rg -n 'reposFetchGeneration|claimRepoCatalogGeneration|latestRepoCatalogGeneration|addRepoPath\\(|finalizeImportedRepoAfterSkip|activateAndRevealWorktree' src/renderer/src | head -220
printf '%s\n' '--- add/import tests ---'
rg -l 'addRepoPath|finalizeImportedRepoAfterSkip|activateAndRevealWorktree' src/renderer/src --glob '*test*' | head -80Repository: stablyai/orca
Length of output: 11498
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- host merge ---'
rg -n -A100 -B20 'function mergeFetchedReposForHost|mergeFetchedReposForHost' src/renderer/src/store/repos/repo-catalog-identity.ts
printf '%s\n' '--- add-race tests ---'
cat -n src/renderer/src/store/slices/repos-add-races.test.ts
printf '%s\n' '--- skip-finalization tests ---'
cat -n src/renderer/src/components/sidebar/add-repo-skip-finalization.test.ts
printf '%s\n' '--- exact generation usages ---'
rg -n 'reposFetchGeneration|claimRepoCatalogGeneration|latestRepoCatalogGenerationByHostByStore|latestAllHostRepoCatalogGenerationByStore' src/renderer/srcRepository: stablyai/orca
Length of output: 16016
Invalidate catalog generations when addRepoPath commits a repository. fetchRepos captures its generation before awaiting the catalog, but addRepoPath does not invalidate that generation. mergeFetchedReposForHost then removes current-host rows absent from the fetched identities. A fetch that started before the add can therefore remove the new repository, and retainValidFilterRepoIds removes its appended ID. The imported project remains hidden by the user's previous filters.
Use the existing catalog-generation fencing when addRepoPath commits the repository. This shared correction also protects the filter append in src/renderer/src/lib/worktree-activation.ts:300.
|
Thanks @denis-sj for the fix. #20796 is already fixed on main by #20987 (07b7687). Both the worktree-activation path and |

Why
When a user has active project filters in the sidebar and adds a new project (git repo or folder workspace), Orca wiped all active
filterRepoIdsback to[]. The user was forced to reconfigure their sidebar filters from scratch on every project add.Two call sites were responsible:
worktree-activation.ts: calledstate.setFilterRepoIds([])when the newly activated worktree'srepoIdwas absent from the current filter.add-repo-skip-finalization.ts: same reset when an imported project skipped worktree creation.Summary
Both sites now append the newly added
repoIdinstead of clearing the array:Resulting invariant:
filterRepoIds.length === 0): stays unfiltered after add — no change.Tests
8 / 8 tests pass (
worktree-activation-reveal.test.ts,add-repo-skip-finalization.test.ts).project-added-default-checkout.test.tsupdated (15/15 pass).pnpm tc:webandpnpm run check:code-quality:changed— clean.Issue Number
Fixes #20796