package codex import ( "encoding/json" "errors" "testing" "amadan.net/oficina/equipo/internal/runner/provider" ) func TestAssistLaunchCodex(t *testing.T) { b := provider.Binding{Provider: "codex", CredentialHome: "/private/account", Home: "/private/run", RuntimeRoot: "/private/runtime"} profile, err := provider.Profile("assist") if err != nil { t.Fatal(err) } in := provider.PolicyInputs{Action: "assist", Tools: profile.MCPTools(), DeniedPaths: []string{"/private/state"}} if _, err := PolicyInputs(b, in, "gpt-6-astra"); err != nil { t.Fatalf("assist refused: %v", err) } more := in more.Tools = append(append([]string{}, in.Tools...), "mcp__equipo__record_task") if _, err := PolicyInputs(b, more, "gpt-6-astra"); !errors.Is(err, provider.ErrPolicy) { t.Fatalf("a seventh tool: %v", err) } } // The Assistant answers a person who is waiting: each of its turns asks // for low reasoning effort on the connection's own model, and the team's // turns keep the model's default. func TestAssistLaunchCodexLowEffort(t *testing.T) { b := provider.Binding{Provider: "codex", CredentialHome: "/private/account", Home: "/private/run", RuntimeRoot: "/private/runtime"} turn := func(action string) map[string]any { t.Helper() profile, err := provider.Profile(action) if err != nil { t.Fatal(err) } in, err := PolicyInputs(b, provider.PolicyInputs{Action: action, Tools: profile.MCPTools(), DeniedPaths: []string{"/private/state"}}, "gpt-6-astra") if err != nil { t.Fatalf("%s: %v", action, err) } var thread struct{ Model string } if json.Unmarshal(in.ThreadPolicy, &thread) != nil || thread.Model != "gpt-6-astra" { t.Fatalf("%s thread %s", action, in.ThreadPolicy) } var params map[string]any if err := json.Unmarshal(TurnParams(provider.Policy{TurnPolicy: in.TurnPolicy}, "th", "hello"), ¶ms); err != nil { t.Fatal(err) } return params } if got := turn("assist"); got["effort"] != "low" || got["threadId"] != "th" { t.Fatalf("assist turn/start %v", got) } for _, action := range []string{"converse", "coordinate", "implement", "inspect"} { if got, ok := turn(action)["effort"]; ok { t.Fatalf("%s effort %v", action, got) } } }