You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Read the reference-resolution chain on main (f1daa54a2); the pieces exist but one of them cannot recognize a worktree path, which matches what you describe.
What the code does today:
File reads (fsList/fsRead) resolve their root through requireWorkspaceRoot(sessionId) (apps/desktop/electron/main/ipc/workspace-ipc.ts:771-789), which does branch on the session's worktree — so the file browser and tool reads already see the worktree.
Chat reference clicks go through fsResolveRef (:996-1021), which builds roots with projectRootsFor(workspaceRoot) → workspaceRootsFor(path) (apps/desktop/electron/main/workspace-roots.ts:59-72). That helper matches the path against the project group records by exact comparable path; a worktree path is not one of the group's roots (the group stores the main checkout), so it returns {} and the code falls back to a single root — which is fine.
The failure is in what the reference names: resolveChatFileRef treats an absolute ref as exact-absolute and requires it to sit inside one of those roots (packages/host-runtime/src/chat-ref-resolve.ts:386-413), and isChatRefOutsideRoots rejects it before that (:234-248). When the model writes an absolute path into the main checkout — which is where the parent repo lives and what many prompts/tools default to — the reference is outside the only root (the worktree) and resolves to null. Relative refs do work, because step 3 joins them against the worktree root first (:444-460).
So the likely bug is not the click handler but the path the model is handed/emits: the session's workspaceRoot (worktree) is passed to the runtime (packages/agent-runtime/src/sidecar.ts:127), yet a path from the parent checkout still reaches the transcript. Worth checking where file references are generated for a worktree session — if any producer still uses projectPath instead of workspaceRoot, that is the one line to fix. A secondary hardening: when a session has a worktree, also accept its parent checkout as a containment root (read-only) so a stray absolute ref opens instead of failing.
I'm on macOS and cannot drive a worktree session here, so this is static analysis of the chain rather than a reproduction — the last step (which producer writes the parent path) needs a session trace from a Linux worktree run.
Activity
muzimu217 commentedon Oct 18, 2026
Read the reference-resolution chain on
main(f1daa54a2); the pieces exist but one of them cannot recognize a worktree path, which matches what you describe.What the code does today:
fsList/fsRead) resolve their root throughrequireWorkspaceRoot(sessionId)(apps/desktop/electron/main/ipc/workspace-ipc.ts:771-789), which does branch on the session's worktree — so the file browser and tool reads already see the worktree.fsResolveRef(:996-1021), which builds roots withprojectRootsFor(workspaceRoot)→workspaceRootsFor(path)(apps/desktop/electron/main/workspace-roots.ts:59-72). That helper matches the path against the project group records by exact comparable path; a worktree path is not one of the group's roots (the group stores the main checkout), so it returns{}and the code falls back to a single root — which is fine.resolveChatFileReftreats an absolute ref as exact-absolute and requires it to sit inside one of those roots (packages/host-runtime/src/chat-ref-resolve.ts:386-413), andisChatRefOutsideRootsrejects it before that (:234-248). When the model writes an absolute path into the main checkout — which is where the parent repo lives and what many prompts/tools default to — the reference is outside the only root (the worktree) and resolves to null. Relative refs do work, because step 3 joins them against the worktree root first (:444-460).So the likely bug is not the click handler but the path the model is handed/emits: the session's
workspaceRoot(worktree) is passed to the runtime (packages/agent-runtime/src/sidecar.ts:127), yet a path from the parent checkout still reaches the transcript. Worth checking where file references are generated for a worktree session — if any producer still usesprojectPathinstead ofworkspaceRoot, that is the one line to fix. A secondary hardening: when a session has a worktree, also accept its parent checkout as a containment root (read-only) so a stray absolute ref opens instead of failing.I'm on macOS and cannot drive a worktree session here, so this is static analysis of the chain rather than a reproduction — the last step (which producer writes the parent path) needs a session trace from a Linux worktree run.
fix(chat): open worktree references from the branch copy
perf(sessions): cache file-derived session summaries by file identity (…