[BUG] /ultraplan attaches to ancestor git repository, ignoring nested repo in CWD
Preflight Checklist
- [x] Searched existing issues
- [x] Single bug report
- [x] Using latest version
What's Wrong?
When invoking /ultraplan from inside a nested git repository, Claude Code uploads an ancestor repository to the cloud session instead of the repository in the current working directory. Git itself resolves the CWD repo correctly (git rev-parse --show-toplevel returns the nested repo), but ultraplan's repo detection disagrees and picks an ancestor.
This is silent and deterministic. The user has no indication that a different repo has been attached — the cloud plan is generated against an entirely unrelated codebase from the first invocation onward, with no prior ultraplan session required.
What Should Happen?
Ultraplan should upload the repository reported by git rev-parse --show-toplevel — the nested repo in the current working directory — not an ancestor repository further up the tree.
Error Messages/Logs
When the ancestor happens to have uncommitted changes, the cloud session errors with:
There are uncommitted changes in the repository. Please commit and push these changes to the remote branch. Do not create a pull request unless the user has explicitly asked for one.
This message is misleading — the child repo in CWD is clean; the dirty state belongs to an ancestor the user did not intend to attach.
When the ancestor is clean, there is no error — the cloud session silently proceeds with the wrong codebase.
Steps to Reproduce
- Create a parent git repository:
````
mkdir ~/parent && cd ~/parent && git init
echo "parent" > a.txt && git add . && git commit -m "init"
- Inside it, create a nested git repository with its own GitHub remote:
````
mkdir ~/parent/child && cd ~/parent/child
git init && gh repo create child --private --source=. --push
- Confirm git resolves the child correctly:
````
$ git rev-parse --show-toplevel
/Users/<you>/parent/child
- From
~/parent/child, runclaudeand invoke/ultraplan <any prompt>.
Observed: ultraplan attaches to ~/parent (the ancestor) instead of ~/parent/child (the CWD repo).
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.100 (Claude Code)
Platform
Anthropic API
Operating System
macOS 26.4
Terminal/Shell
Terminal.app
Additional Information
Subscribed via Claude Max.
git rev-parse --show-toplevel is git's canonical way to resolve the enclosing repository and is what any CLI tool operating on "the current repo" should use. Ultraplan appears to use separate resolution logic that walks further up the tree than git does, even when the nested repo has its own .git directory and its own remote.
Possibly related, different root cause:
- #44643 — "Remote session receives wrong project context." That report describes cross-session state leakage (a previous ultraplan session's project context bleeding into a new invocation for a different project). This issue is distinct: the wrong repo is attached on the first invocation with no prior session, and the wrong repo is specifically the git ancestor of the CWD.
- #44815 — "Always routes to wrong workspace." Closed as duplicate of #44643, but the reporter describes deterministic first-call failure, which matches this issue's symptom more closely than #44643's stale-session diagnosis. Possibly a misfiled dedupe.
Both bugs likely live in the same workspace-resolution module, but the symptoms, repros, and fix directions differ.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗