/agent: preserve session ID when switching agents

This commit is contained in:
Levi Neely 2026-05-20 10:57:04 +02:00
parent 82df12e293
commit 5099ccf51d
1 changed files with 1 additions and 3 deletions

View File

@ -206,8 +206,7 @@ func (s *agent) handleCommand(ctx context.Context, input string, handler EventHa
return
}
d := s.newDispatcher()
newSessID := NewSessionID()
env := BuildAgentEnv(cfg, d, s.cwd, []string{"OLLIE_SESSION_ID=" + newSessID})
env := BuildAgentEnv(cfg, d, s.cwd, []string{"OLLIE_SESSION_ID=" + s.sessionID})
if env.Backend != "" {
newBe, err := s.newBackend(env.Backend)
if err != nil {
@ -230,7 +229,6 @@ func (s *agent) handleCommand(ctx context.Context, input string, handler EventHa
s.cfg.MaxSteps = env.maxSteps
s.agentName = name
s.session = nil
s.sessionID = newSessID
s.pushSessionEnv()
for _, msg := range env.Messages {
handler(infoEvent(msg))