Skip to content

The agent that grows with you

fix(desktop): coding rail reads only its own worktree

Brooklyn Nicholson8f4ab7ad2c53
diff --git a/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx b/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx
index 6ad820765e5..4d25320d952 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/coding-row.tsx
@@ -16,8 +16,6 @@ import { DiffCount } from '@/components/ui/diff-count'
import type { HermesGitBranch } from '@/global'
import { useI18n } from '@/i18n'
import {
- $repoStatus,
- $repoWorktrees,
registerRepoStatusCwd,
repoStatusForCwd,
repoWorktreesForCwd
@@ -69,10 +67,13 @@ export const CodingStatusRow = memo(function CodingStatusRow({
const s = t.statusStack.coding
const p = t.sidebar.projects
const resolvedRepoPath = repoPath?.trim() || undefined
- // Per-cwd slice when this surface knows its worktree (tiles); otherwise the
- // primary main-pane computed — so a blank/missing repoPath still paints.
- const status = useStore(resolvedRepoPath ? repoStatusForCwd(resolvedRepoPath) : $repoStatus)
- const worktrees = useStore(resolvedRepoPath ? repoWorktreesForCwd(resolvedRepoPath) : $repoWorktrees)
+ // This surface's OWN worktree, always — never the primary's. The row used to
+ // fall back to the global `$repoStatus` for a blank repoPath, which painted
+ // the main pane's branch/± onto a tile whose cwd hadn't resolved yet. That
+ // fallback bought nothing (the primary's computed is keyed to `$currentCwd`,
+ // which is blank in exactly the same case) and cost a wrong-tree rail.
+ const status = useStore(repoStatusForCwd(resolvedRepoPath))
+ const worktrees = useStore(repoWorktreesForCwd(resolvedRepoPath))
// While mounted, keep this worktree in the coding-status refresh set so the
// turn-settle / tool-complete / focus edges re-probe it too (tiles otherwise