fix: set agent ID on tool server after /agent switch

SwitchProfile creates a new tool server connection but wasn't calling
SetAgentID on it, causing 'agent ID required' errors when listing tools.
This commit is contained in:
Levi Neely 2026-08-12 11:08:37 +02:00
parent edd5ade471
commit aedfdec564
1 changed files with 3 additions and 0 deletions

View File

@ -359,6 +359,9 @@ func (ag *Agent) SwitchProfile(name string) error {
return fmt.Errorf("agent %q: %w", name, err)
}
disp := ag.newToolServer()
if disp != nil && ag.id != "" {
disp.SetAgentID(ag.id)
}
env := []string{"OLLIE_SESSION_ID=" + ag.sessionID, "OLLIE_UNAME=" + ag.id}
rt := BuildRuntime(cfg, disp, ag.cwd, env, ag.systemPrompt, ag.envBlock)
if cfg.Backend != "" {