The entire-gossamer command doesn't resolve workspaces back to their original git…
Rate quality
Private research annotation
Sign in to add a private research label or note.
- User
The entire-gossamer command doesn't resolve workspaces back to their original git directories. can you make it so that if the discover command finds a session in a worktree, it will infer the root directory and suggest that instead?
Assistant
I'll look into the codebase to find the "discover" functionality and how worktree/session directories are resolved.
Assistant
There is indeed a
discovercommand. Let me read it fully to understand how it scans for repos/sessions.Assistant
Let me look at status.rs around line 880-910 — there's already worktree-resolution logic there I can reuse.
Assistant
Now I'll add a helper to resolve the main worktree root (mirroring the logic already in
status.rs::find_repo_for_cwd) and use it inscan_candidatesso worktree cwds resolve back to the original repo directory.Assistant
Let me make the path resolution robust to relative
..segments by canonicalizing, since discover's suggestions get persisted to the DB and should be exact.Assistant
Now let's build and run the test suite to make sure nothing broke.
Assistant
Build succeeds (only pre-existing dead-code warnings). Let's write a quick manual test to confirm worktree resolution works, then run the integration test suite.
Assistant
Confirms the git behavior my fix relies on:
--git-common-dirfrom the linked worktree resolves tomain-repo/.git, whose parent is the original repo root — exactly what should now be suggested instead oflinked-wt. Now let's run the existing integration test suite to confirm no regressions.Assistant
That failure looks unrelated to worktree resolution — likely a pre-existing date-boundary flake. Let me verify it fails on a clean checkout too.
Assistant
Confirmed pre-existing failure unrelated to my change. Now let's reinstall the binary per project convention.
Assistant
Good — my only change is
src/commands/discover.rs; the other modified files are pre-existing uncommitted work from before this session. Let's clean up the scratch test repo.Assistant
Summary
entire gossamer discoverscanscwdvalues found in Claude Code JSONL logs and resolves each to a git repo viagit rev-parse --show-toplevel. When a session was run inside a linked git worktree, that command returns the worktree's own directory rather than the original repo — so discover was suggesting tracking the worktree instead of the real repo.Fixed in
src/commands/discover.rs: addedresolve_main_root(), which usesgit rev-parse --git-common-dir(the same techniquestatus.rs::find_repo_for_cwdalready uses for linked-worktree detection) to find the shared.gitdirectory and walk up to the main worktree root, canonicalizing to resolve any..segments.scan_candidatesnow uses this resolved root instead of the raw--show-topleveloutput, so worktree-only sessions get attributed to the correct original repo directory.Verified manually with a throwaway repo + linked worktree that the resolution lands on the main repo path, ran
cargo build --releaseand the integration suite (17/18 pass; the one failure,test_sessions_recent_filter_excludes_old_sessions, is a pre-existing date-boundary flake reproducible on before my change), and reinstalled via .- User
there is a small bug in the session list navigation- if the session list if bigger than the viewport, and we scroll down, the highlighted session row is outside of the viewport, even though the list itself moves correctly
Assistant
Found it — in
status.rs's sessions sub-screen, the scroll calculation counts the section's own header row as if it were available for entries.sessions_h(rows left for "Sessions" area) includes the "session / branch / author..." header row, butscrollis computed as if all ofsessions_hwere entry rows. That's off by one: the last visible entry index gets computed as still "in view" by the scroll math, while the header actually pushes it one row past the bottom of the viewport, so it getsbreak-ed out of the render loop without ever being drawn — the highlighted row disappears.Assistant
Now let's build and reinstall.
Assistant
Builds clean. Let's run the integration tests to confirm no regression, then reinstall.
Assistant
Only the pre-existing unrelated flake fails (already confirmed earlier to fail on clean
main); all other 17 tests pass. Binary reinstalled.Summary
Bug was in
draw_sessions(src/commands/status.rs), the sessions sub-screen you reach by drilling into a repo.sessions_h(rows left for the whole "Sessions" section) included the section's own column-header row ("session / branch / author / ..."), but the scroll offset was computed as if all ofsessions_hwere entry rows. That off-by-one meant the last entry near the viewport edge was judged "in view" by the scroll math but actually landed one row pastcontent_h, so the render loop'srow >= content_hcheck dropped it before drawing — the selection would scroll past the bottom of the visible list.Fixed by reserving one row of
sessions_hfor the header before computingscroll(entries_h = sessions_h.saturating_sub(1)). The standaloneentire gossamer sessionsscreen (src/commands/sessions.rs) already accounted for its header separately and didn't have this bug.