fix: GetContextInfo workDir uses session touch_dir instead of EffectiveWorkspace

EffectiveWorkspace only differs from workspace when a worktree is active.
The tool-detected touch_dir from the most recent active session reflects
the actual project directory the agent is working in.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-02-24 17:54:45 +09:00
parent 62058922df
commit 60342d1aca

View file

@ -2467,7 +2467,12 @@ func (al *AgentLoop) GetContextInfo() (workDir, planWorkDir, workspace string, b
} }
workspace = agent.Workspace workspace = agent.Workspace
planWorkDir = agent.ContextBuilder.GetPlanWorkDir() planWorkDir = agent.ContextBuilder.GetPlanWorkDir()
// Use the most recent active session's touch_dir (tool-detected project directory)
if active := al.sessions.ListActive(); len(active) > 0 && active[0].TouchDir != "" {
workDir = active[0].TouchDir
} else {
workDir = agent.ContextBuilder.workDir workDir = agent.ContextBuilder.workDir
}
bootstrap = agent.ContextBuilder.ResolveBootstrapPaths() bootstrap = agent.ContextBuilder.ResolveBootstrapPaths()
return return
} }