From 03a29b087767c1cebab6d150bdfe6880a9559e08 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 19 Jul 2026 20:26:52 +0200 Subject: [PATCH] session: pass PromptEnv to all BuildRuntime calls Both restore and create paths now include PRIME_* env vars. Remote path uses HostInfo; local path uses PromptEnv(cwd). --- session/session.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/session/session.go b/session/session.go index e1b0bd3..fdb13f5 100644 --- a/session/session.go +++ b/session/session.go @@ -780,7 +780,9 @@ func (s *Manager) restoreSession(ps *agent.PersistedSession) error { newDisp := tools.NewDispatcherFunc(map[string]func() tools.Server{ "execute": execute.Decl(cwd, execOpts...), }) - rt := agent.BuildRuntime(cfg, newDisp(), cwd, []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)}) + env := []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)} + env = append(env, agent.PromptEnv(cwd)...) + rt := agent.BuildRuntime(cfg, newDisp(), cwd, env) restoredSession := agent.RestoreSession(ps.Messages) if ps.TaskState != nil { @@ -1025,6 +1027,7 @@ func (s *Manager) CreateSession(args []string) (string, error) { "execute": func() tools.Server { return rsrv }, }) remoteEnv = []string{ + "PRIME_CWD=" + cwd, "PRIME_PLATFORM=" + rsrv.Info.Platform, "PRIME_IS_GIT_REPO=" + fmt.Sprintf("%v", rsrv.Info.IsGitRepo), } @@ -1035,7 +1038,11 @@ func (s *Manager) CreateSession(args []string) (string, error) { } env := []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + MountPathFor(uname)} - env = append(env, remoteEnv...) + if len(remoteEnv) > 0 { + env = append(env, remoteEnv...) + } else { + env = append(env, agent.PromptEnv(cwd)...) + } rt := agent.BuildRuntime(cfg, newDisp(), cwd, env) // sessPtr is set after NewSession; the ReadPlanStep closure captures it.