Files
kandev/apps/backend/internal/agent/agents/codex_acp_test.go
T
José Almeida 7be7aede8b fix(codex): align with the standard SessionDirTemplate pattern
Codex was the only agent that bind-mounted its host home into the
container via an explicit `Mounts: [{home}/.codex → /root/.codex]`
entry, while every other ACP agent uses `SessionConfig.SessionDirTemplate`
+ `SessionDirTarget`. Move codex onto the same surface so the
host-state isolation work in the next commit covers it uniformly.

This change alone does not stop the host-state leak — the bind mount
still resolves to the host's ~/.codex for now — but it removes the
last agent-specific branch in the runtime config so the docker
container manager can apply one rule for all agents.
2026-05-06 21:03:31 +01:00

30 lines
688 B
Go

package agents
import (
"strings"
"testing"
)
func TestCodexACPRuntimeNoLongerBindMountsHostHome(t *testing.T) {
a := NewCodexACP()
rt := a.Runtime()
for _, m := range rt.Mounts {
if strings.Contains(m.Source, "{home}") {
t.Fatalf("codex Mounts unexpectedly references {home}: %+v", m)
}
}
}
func TestCodexACPSessionDirTemplate(t *testing.T) {
a := NewCodexACP()
cfg := a.Runtime().SessionConfig
if cfg.SessionDirTemplate != "{home}/.codex" {
t.Fatalf("SessionDirTemplate = %q, want %q", cfg.SessionDirTemplate, "{home}/.codex")
}
if cfg.SessionDirTarget != "/root/.codex" {
t.Fatalf("SessionDirTarget = %q, want %q", cfg.SessionDirTarget, "/root/.codex")
}
}