Skip to content

Diff panel fails to resolve git root when CLI changes directory internally #113

@yoziv

Description

@yoziv

Bug

When the Copilot CLI (or Claude Code) changes its working directory internally via its cwd command, the diff panel fails with:

Error invoking remote method 'diff:resolveGitRoot': Error: No git repository found from: C:\Users

Works when you cd to the repo directory before starting the CLI.
Fails when the CLI changes directory after it's already running.

Root Cause

The diff panel reads terminal.cwd from the terminal store to resolve the git root. CWD tracking relies on OSC 7, OSC 9;9, and prompt regex — none of which fire when the CLI changes directory internally (it runs as a subprocess and doesn't emit escape sequences).

Fix

PR #112 — DiffReview.tsx's terminalCwd selector now checks the linked AI session's CWD first (via copilotSessions/claudeCodeSessions), falling back to shell CWD when no session is linked. This avoids overwriting terminal.cwd entirely (no two-writers problem, no WSL path corruption, no session restore poisoning).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions