fix: refresh cached system prompt after LLM iteration
Tool execution during runLLMIteration updates touch_dir, but the cached system prompt was captured before that. Now rebuilds and re-captures after iteration so Mini App shows the prompt with current workDir (correct AGENTS.md). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
944239fd54
commit
9deaa4725d
1 changed files with 6 additions and 2 deletions
|
|
@ -926,8 +926,12 @@ func (al *AgentLoop) runAgentLoop(ctx context.Context, agent *AgentInstance, opt
|
|||
return "", err
|
||||
}
|
||||
|
||||
// If last tool had ForUser content and we already sent it, we might not need to send final response
|
||||
// This is controlled by the tool's Silent flag and ForUser content
|
||||
// 5-post. Refresh cached system prompt: tool execution may have updated touch_dir,
|
||||
// so rebuild with current workDir so Mini App shows the up-to-date version.
|
||||
if active := al.sessions.ListActive(); len(active) > 0 && active[0].SessionKey == opts.SessionKey && active[0].TouchDir != "" {
|
||||
agent.ContextBuilder.SetWorkDir(filepath.Join(agent.Workspace, active[0].TouchDir))
|
||||
}
|
||||
al.lastSystemPrompt.Store(agent.ContextBuilder.BuildSystemPrompt())
|
||||
|
||||
// 5a. Auto-advance plan phases after LLM iteration
|
||||
postStatus := agent.ContextBuilder.GetPlanStatus()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue