Skip to content

Bug: getDiff fails with 'not a git repository' when agents cd out of worktree #136

@that-github-user

Description

@that-github-user

Summary

During thinktank runs, getDiff frequently fails with:
`fatal: not a git repository (or any of the parent directories): .git`

This happens because Claude Code agents sometimes cd into subdirectories or temp directories during execution, and when getDiff runs afterward, the current working directory is no longer the worktree.

Fix

getDiff and getDiffStats should always use the explicit worktree path as cwd, which they already do. But the issue may be that the worktree was removed by git or the OS during agent execution. Need to verify the worktree still exists before trying to diff.

Impact

Shows 0 files changed for agents that actually made changes. Reduces the effectiveness of convergence analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions