fix(activity): surface worktree sessions in active work, the sidebar and repo badges

- Resolve sessions in repo worktrees to the owning repo in the activity list; show the worktree branch and open the Workspaces tab
- Look up worktrees only for unmatched sessions in the window or under an active root, and hold the loading state until it settles
- Show schedule-worktree sessions only while running or needing input
- Light repo badges for worktree sessions through one app-wide worktree lookup
- List worktree sessions under the expanded repo in the sidebar
- Subscribe the event stream to active session directories so worktree permissions and forms arrive
- Keep the worktree tab when navigating from the desktop Activity panel
- Remove the braille spinner's always-dim bottom row
This commit is contained in:
Chris Scott committed 2026-10-16 20:36:56 +00:00
1 parent 1d31286904
commit bfbbbf08ef
23 files changed
+932 -81

No files matched your search

@@ -25,6 +25,7 @@ type SessionPinFixture = { sessionId: string; directory: string; pinnedAt: numbe
const {
listReposMock,
getRepoSiblingsMock,
sessionsData,
sessionsHookCalls,
createSessionCalls,
@@ -37,6 +38,7 @@ const {
searchError,
} = vi.hoisted(() => ({
listReposMock: vi.fn(),
getRepoSiblingsMock: vi.fn(),
sessionsData: [] as SessionFixture[],
sessionsHookCalls: [] as SessionsHookCall[],
createSessionCalls: [] as Array<{ directory?: string; vars?: unknown }>,
@@ -51,7 +53,7 @@ const {
vi.mock('@/api/repos', async (importOriginal) => {
const actual = await importOriginal<typeof import('@/api/repos')>()
return { ...actual, listRepos: listReposMock }
return { ...actual, listRepos: listReposMock, getRepoSiblings: getRepoSiblingsMock }
})
vi.mock('@/api/opencode', async (importOriginal) => {
@@ -156,6 +158,8 @@ describe('DesktopSessionTree', () => {
beforeEach(() => {
listReposMock.mockReset()
listReposMock.mockResolvedValue([repoA, repoB, repoC])
getRepoSiblingsMock.mockReset()
getRepoSiblingsMock.mockResolvedValue([])
sessionsData.splice(
0,
sessionsData.length,
@@ -197,6 +201,18 @@ describe('DesktopSessionTree', () => {
expect(fetchedDirectories()).toEqual(new Set(['/repos/a']))
})
it('shows a worktree session under its repo with the worktree branch tag', async () => {
getRepoSiblingsMock.mockResolvedValue([
{ fullPath: '/repos/a/.worktrees/feat', currentBranch: 'feat/x', worktreeSource: 'git' },
])
sessionsData.push(createSession('w1', '/repos/a/.worktrees/feat', Date.now() - 1000))
render(<DesktopSessionTree />, { wrapper: createWrapper(['/repos/1']) })
const row = await screen.findByRole('button', { name: /^Session w1/ })
expect(row).toHaveTextContent('feat/x')
})
it('opens nothing outside a repo', async () => {
render(<DesktopSessionTree />, { wrapper: createWrapper(['/']) })