diff --git a/server/src/config.rs b/server/src/config.rs index 382f2e4..b5f933b 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -226,6 +226,11 @@ impl ProjectConfig { args.push(render(sp)); } + // Explicitly set the project directory so Claude Code doesn't + // resolve the main checkout via .git worktree indirection. + args.push("--directory".to_string()); + args.push(worktree_path.to_string()); + Ok((command, args, prompt)) } } @@ -390,7 +395,8 @@ max_turns = 0 .render_agent_args("/tmp/wt", "42_foo", None, None) .unwrap(); assert_eq!(cmd, "claude"); - assert!(args.is_empty()); + assert!(args.contains(&"--directory".to_string())); + assert!(args.contains(&"/tmp/wt".to_string())); assert!(prompt.contains("42_foo")); }