package codex import ( "encoding/json" "amadan.net/oficina/equipo/internal/runner/provider" ) func effectiveConfigMatches(p provider.Policy, got map[string]json.RawMessage) bool { if configSubset(p.Settings, marshal(got)) { return true } var m struct{ ProviderVersion string } if json.Unmarshal(p.Manifest, &m) != nil || m.ProviderVersion != Version { return false } var want map[string]json.RawMessage if json.Unmarshal(p.Settings, &want) != nil { return false } // 0.165.0 keeps disabled tool flags in the session layer but omits // them from typed effective config; this is not proof they are disabled. // Live inventories must also prove absence. validateConfig separately // requires an unchanged command-line layer. var tools, effective map[string]json.RawMessage keys := []string{"experimental_request_user_input"} if p.Coordinator() || p.Research() || p.Glance() { keys = append(keys, "update_plan") } if json.Unmarshal(want["tools"], &tools) != nil || len(tools) != len(keys) || json.Unmarshal(got["tools"], &effective) != nil { return false } if len(effective) != 1 || !sameJSON(effective["web_search"], []byte(`null`)) { return false } for _, key := range keys { if !sameJSON(tools[key], []byte(`{"enabled":false}`)) { return false } } delete(want, "tools") return configSubset(marshal(want), marshal(got)) } // The pinned CLI discovers this disabled layer lazily after thread/start. func disabledEmptyProject(name, config []byte, reason string) bool { return sameJSON(name, []byte(`{"type":"project","dotCodexFolder":"/workspace/.codex"}`)) && sameJSON(config, []byte(`{}`)) && reason == "To load project-local config, hooks, and exec policies, add /workspace as a trusted project in /home/runner/config.toml." }