[MODEL] spawn_task creates worktree off origin/main, ignoring parent session's branch
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Claude modified files I didn't ask it to modify
What You Asked Claude to Do
- Work on a long-running feature branch that has diverged from main
(multiple commits, not yet merged).
- Have Claude spawn a sub-session via the spawn-task affordance
(mcp__ccd_session__spawn_task / the chip UI), explicitly naming
the intended base branch in the spawn prompt.
- Click the chip to start the spawned session.
- Inspect the new worktree's git base.
What Claude Actually Did
The spawned worktree was created off origin/main, ignoring the
parent session's branch entirely. The spawn prompt's stated "base
branch X" was treated as text only — not enforced. The spawned
agent then referenced files that exist on the intended branch but
not on main, causing its plan to drift from reality.
Failure is silent: no error, no warning, no UI hint that the
worktree base won't inherit. For users on long-running feature
branches, the spawned session writes code against a base missing
the in-progress work; merging back produces a frankenstein diff
containing every commit on main since the parent branched off,
smeared with the new feature.
Suggested fix:
- a
base_branchparameter on the spawn tool - defaulting the worktree to the parent session's HEAD
- surfacing the base in the chip UI before clicking
Expected Behavior
The spawned worktree should inherit the parent session's current
branch as its base or, at minimum, the spawn tool should expose abase_branch parameter that the model can set explicitly, with a
confirmation step in the chip UI showing which base will be used
before the user clicks. The current behavior of silently defaulting
to origin/main is a foot-gun for any user working on a feature
branch that has diverged from main.
Files Affected
Permission Mode
Accept Edits was ON (auto-accepting changes)
Can You Reproduce This?
Yes, every time with the same prompt
Steps to Reproduce
- Check out a feature branch that has diverged from
mainby
several commits (e.g. an in-progress feature you've been
working on for more than a day).
- Start a Claude Code session from that branch.
- Ask the model to spawn a sub-session via the spawn-task
affordance (mcp__ccd_session__spawn_task), and in the spawn
prompt explicitly state the intended base branch — e.g. "base
branch: <your-feature-branch>".
- Click the chip in the UI to start the spawned session.
- Inside the spawned session's worktree, run:
git log -1 --oneline HEAD
git log -1 --oneline origin/main
git log -1 --oneline origin/<your-feature-branch>
Observe that HEAD matches origin/main, not the feature branch
named in the spawn prompt.
- Confirm the impact by listing files that exist on the feature
branch but not on main — they will be missing from the worktree.
Claude Model
Opus
Relevant Conversation
Impact
Critical - Data loss or corrupted project
Claude Code Version
Claude 1.6608.1 (f156d0) 2026-05-08T05:28:58.000Z
Platform
Anthropic API
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗