oficina / equipo Public

fix: allow inert Codex MCP resource tools for the coordinator

codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev b1f3096c8d7330981c5c85a2f36e3408b7862bb5 parent 6836ff9
15 files changed, +316 −14
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +118 −0
  • internal/directlive/coordinator.go +1 −1
  • internal/directlive/coordinator_fixes_test.go +25 −1
  • internal/directlive/coordinator_inventory.go +1 −0
  • internal/directlive/driver_test.go +4 −4
  • internal/directlive/testdata/fake-cli.py +1 −0
  • internal/release/manifest.json +1 −1
  • internal/runner/coordinator_tools_test.go +45 −2
  • internal/runner/provider/actions.go +9 −0
  • internal/runner/provider/codex/launcher.go +4 −2
  • internal/runner/provider/codex/launcher_test.go +3 −0
  • internal/runner/provider/codex/plan_policy_test.go +79 −0
  • internal/runner/provider/direct_requirements.json +1 −1
  • internal/runner/provider/policy.go +12 −2
  • internal/runner/tools.go +12 −0

CI failed — run details

diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index b083c620..3041dbf4 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -1434,3 +1434,121 @@ git diff --check
```
Additional changed files for the gate consumer: `internal/directlive/certificate.go`, `internal/directlive/coordinator_certificate_test.go`, `internal/directlive/tuple_failures.go`, `internal/runner/provider/direct_groups.go`, `internal/runner/provider/direct_certification.go`, `internal/runner/provider/direct_certification_test.go`, `internal/runner/provider/direct_requirements.json`, and `internal/runner/provider/live_test.go`. No additional user-facing strings were introduced.
+
+## Fix round 2
+
+Status: DONE. Applied the controller ruling for Task 6 on `plan-3`. The Codex coordinator permits exactly `list_mcp_resources`, `list_mcp_resource_templates` and `read_mcp_resource` alongside the nine Equipo tools. Its release policy remains uncertified. Claude still has no built-in tools.
+
+### Controller ruling and reason
+
+This is a controller-approved policy change, not a review defect. As recorded in the controller notes and `task-6-rereview1.md`, pinned Codex 0.165.0 calls upstream `spec_plan.rs`'s `add_mcp_resource_tools` whenever any MCP server is configured. There is no configuration key to suppress these three tools. The former empty-native requirement therefore made the Codex coordinator impossible to certify. The ruling permits only these names, with one configured Equipo coordinator server and no resource access through that server. It does not permit shell, patch, file, search, browser, web, image or unknown tools.
+
+### Implementation and coverage
+
+- The existing Codex constructor supplies only the fixed `equipo` MCP server in both settings and the MCP manifest. Existing full configuration readback checks run before session creation and before each turn. `TestCoordinatorToolAllowlist` checks both constructor documents. `TestCoordinatorOnlyMCPServer` injects an additional server and a replacement server; both fail before `thread/start`. It also injects an additional server after opening a valid session and verifies rejection before `turn/start`.
+- The actual coordinator Unix-socket endpoint advertises only tools. `resources/list` returns `{"resources":[]}`; `resources/templates/list` returns `{"resourceTemplates":[]}`; `resources/read` always returns the existing rejection error. `TestCoordinatorToolBroker` checks these responses for both provider bindings, including a file URI, and retains broker approval/execution hash checks. No application callback or file reader is added to resource handling.
+- The observed inventory requires the exact nine Equipo tools plus all three named native tools for Codex. Missing names, duplicate names, added names, a foreign session, malformed observations and later additions fail. Both flat and namespaced Codex catalogs are covered. An additional MCP namespace fails even if it has no tools. Claude requires exactly the Equipo operations and its existing internal MCP permission endpoint; all native names, including these three, fail.
+- Added an omitted-when-empty `NativeTools` field to policy inputs and the hashed effective manifest. The builder accepts this declaration only for the Codex coordinator and only with the exact ordered three names. Codex launch validation reconstructs and compares it. This changes the policy identity without changing other profiles' constructor hashes. `TestCoordinatorNativePolicyHash` checks the manifest field and rejects missing, partial and widened declarations.
+- Renamed the certification observation from `coordinator-empty-native-inventory` to `coordinator-exact-tool-inventory`, including the required evidence check. The fake Codex emits the three pinned resource tools normally. Its failure fixture now adds `exec_command`; the Codex coordinator fails while specialist certification/calibration fixtures remain independent.
+
+The Codex coordinator constructor inventory hash changed from `439feb9ef31873621697f1bfbd156d7d07b672ea132e670c1ca35e7deff97831` to `e3a7b3d849f6c90aa8e68af73e1494534e097749cf00a29c58664d3f41c295b7`. The new hash is recorded with status `uncertified` in `internal/release/manifest.json`. The unchanged Claude coordinator hash is `fc32844140a0a086c644c62909650c7e12bfdff9d4b4bf75f55938151089ce69`. Release tests still reject old certificates as authority for these profiles.
+
+### Tests first
+
+The inventory, MCP-resource and policy-hash assertions were written before implementation. This command exited 1:
+
+```text
+CGO_ENABLED=0 go test ./internal/directlive ./internal/runner ./internal/runner/provider/codex -run '^TestCoordinator(InventoryObservation|ToolBroker|OnlyMCPServer|NativePolicyHash)$' -count=1
+```
+
+Observed failures: Codex `pinned MCP namespace rejected`; both broker bindings returned error `-32602` for `resources/list`; `native resource policy missing from manifest hash`. The additional-server test already passed against the existing full configuration checks.
+
+After implementation, the corresponding tests passed. Adding `./internal/release` and `TestPlanWorkflowReleasePolicyInventory` to the command then exited 1 with `pending codex coordinate e3a7b3d849f6c90aa8e68af73e1494534e097749cf00a29c58664d3f41c295b7`. Updating only the Codex coordinator manifest entry restored PASS.
+
+### Final verification
+
+All commands below exited 0. Only targeted tests ran.
+
+```text
+CGO_ENABLED=0 go test ./internal/directlive ./internal/runner ./internal/runner/provider/codex ./internal/release -run '^Test(Coordinator(InventoryObservation|ToolAllowlist|ToolBroker|OnlyMCPServer|NativePolicyHash)|PlanWorkflowReleasePolicyInventory)$' -count=1
+PASS: directlive 0.044s; runner 0.612s; codex 0.855s; release 0.003s.
+
+CGO_ENABLED=0 go test ./internal/coordinator ./internal/runner ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/release -run '^(TestCoordinator(Tool|OnlyMCPServer|NativePolicyHash|CertificationGroup)|TestPlanWorkflow(ProviderPolicies|Release)|TestClaudePermissionResponse|TestCodexApprovalResponse|TestEffectivePolicy|TestDirectLiveGate)' -count=1
+PASS: coordinator 0.003s; runner 11.310s; provider 4.651s;
+claude 4.509s; codex 7.860s; release 0.004s.
+
+CGO_ENABLED=0 go test ./internal/directlive -run '^TestCoordinator(InventoryObservation|CalibrationIsolation|LiveModeFakeCLI|FailureIsolatedFakeCLI|CertificationSelection|ManifestExclusion)$' -count=1
+PASS: directlive 38.083s.
+
+CGO_ENABLED=0 go vet ./internal/directlive ./internal/runner ./internal/runner/provider ./internal/runner/provider/codex ./internal/release
+PASS: no output.
+
+gofmt -l internal/directlive internal/runner internal/release
+PASS: no output.
+
+git diff --check
+PASS: no output.
+```
+
+Self-review caught an incomplete test setup: the first before-turn test did not attach the event stream. It could therefore fail before reaching configuration readback. After attaching events, the targeted test passed (0.523s). Bypassing `readConfig` then failed all three assertions, including `extra MCP server accepted before turn`. Restored code passed the final rerun:
+
+```text
+CGO_ENABLED=0 go test ./internal/runner/provider/codex -run '^TestCoordinator(OnlyMCPServer|NativePolicyHash)$' -count=1
+PASS: codex 0.602s; exit 0.
+CGO_ENABLED=0 go vet ./internal/runner/provider/codex
+PASS: no output; exit 0.
+```
+
+### Guard mutations
+
+Each mutation ran separately, failed through a test assertion with exit 1, and was restored byte-for-byte immediately. These are the exact commands used by the table:
+
+```text
+A: CGO_ENABLED=0 go test ./internal/directlive -run ^TestCoordinatorInventoryObservation$ -count=1
+B: CGO_ENABLED=0 go test ./internal/runner -run ^TestCoordinatorToolBroker$ -count=1
+C: CGO_ENABLED=0 go test ./internal/runner/provider/codex -run ^TestCoordinatorOnlyMCPServer$ -count=1
+D: CGO_ENABLED=0 go test ./internal/runner/provider/codex -run ^TestCoordinatorNativePolicyHash$ -count=1
+E: CGO_ENABLED=0 go test ./internal/release -run ^TestPlanWorkflowReleasePolicyInventory$ -count=1
+```
+
+| Mutation | Command | Observed failed assertion |
+| --- | --- | --- |
+| Bypass exact observed inventory comparison | A | `extra tool accepted: shell` and the other forbidden/duplicate names; missing names also accepted |
+| Permit an arbitrary MCP namespace | A | `additional empty MCP namespace accepted` |
+| Extend the native exception to Claude | A | `valid observed inventory rejected` for Claude's correct empty-native inventory |
+| Advertise the resources capability | B | `resources capability advertised` for both providers |
+| Return one resource | B | `nonempty resource discovery` for `resources` |
+| Return one resource template | B | `nonempty resource discovery` for `resourceTemplates` |
+| Return success for resource reads | B | `resource read succeeded` for both providers |
+| Bypass configuration readback | C | `additional or replaced MCP server accepted`; after fixing event attachment, also `extra MCP server accepted before turn` |
+| Omit native names from the hashed manifest | D | `native resource policy missing from manifest hash` |
+| Bypass exact native policy declaration check | D | `changed native policy accepted` |
+| Change the release entry to certified | E | `pending codex coordinate e3a7b3d849f6c90aa8e68af73e1494534e097749cf00a29c58664d3f41c295b7` |
+
+### Files changed
+
+- `internal/directlive/coordinator.go`
+- `internal/directlive/coordinator_fixes_test.go`
+- `internal/directlive/coordinator_inventory.go`
+- `internal/directlive/driver_test.go`
+- `internal/directlive/testdata/fake-cli.py`
+- `internal/release/manifest.json`
+- `internal/runner/coordinator_tools_test.go`
+- `internal/runner/provider/actions.go`
+- `internal/runner/provider/codex/launcher.go`
+- `internal/runner/provider/codex/launcher_test.go`
+- `internal/runner/provider/codex/plan_policy_test.go`
+- `internal/runner/provider/direct_requirements.json`
+- `internal/runner/provider/policy.go`
+- `internal/runner/tools.go`
+- `docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md`
+
+The full report is also appended at the requested `.superpowers/sdd/2026-11-04-equipo-plan-3-coordinator/task-6-report.md` path, which is ignored by Git.
+
+### Copy, self-review and limits
+
+No new or changed app-owned user-facing strings or copy keys. Resource-read errors reuse the existing rejection copy. The changed certification evidence key is a machine identifier, `coordinator-exact-tool-inventory`; no new prose accompanies it. Existing pending Task 6 copy stays pending. README prose is untouched.
+
+The ruling removes the known empty-native certification blocker. Live observation of the pinned Codex catalog remains unverified: the fake fixtures exercise the production launcher and certifier paths using test-only executable digests. Missing or unexpected live observations still fail closed. No live provider run, certification, sign-in or enrolment is claimed. The release remains ineligible until its separate human-run certification gates pass. Task 7's journal acknowledgement dependency and prior review follow-ups remain outside this ruling.
+
+No agents, copy-review server, `.claude/HANDOFF.md`, push, merge, deployment, full suite or `make ci`. No migration changed. Go caches stayed at their defaults. Scratch was confined to `$TMPDIR/equipo-task6-fix2` and removed before commit; fixture processes completed and cleaned up. The required commit subject is `fix: allow inert Codex MCP resource tools for the coordinator`, with author `codex <codex~paul@keymail.dev>`.
diff --git a/internal/directlive/coordinator.go b/internal/directlive/coordinator.go
index 932bf78c..4470f714 100644
--- a/internal/directlive/coordinator.go
+++ b/internal/directlive/coordinator.go
@@ -58,7 +58,7 @@ func (x *exercise) coordinatorFixture(ctx context.Context) (provider.DirectEvide
callMu.Lock()
defer callMu.Unlock()
observed := coordinatorInventory(x.evidence.Provider, x.session.ID, frames)
- if err = x.check("coordinator-empty-native-inventory", observed, frames); err != nil {
+ if err = x.check("coordinator-exact-tool-inventory", observed, frames); err != nil {
return x.evidence, err
}
if err = x.check("coordinator-structured-question", calls == 1, map[string]int{"calls": calls}); err != nil {
diff --git a/internal/directlive/coordinator_fixes_test.go b/internal/directlive/coordinator_fixes_test.go
index 4c6b3b8f..dd84850d 100644
--- a/internal/directlive/coordinator_fixes_test.go
+++ b/internal/directlive/coordinator_fixes_test.go
@@ -3,6 +3,7 @@ package directlive
import (
"amadan.net/oficina/equipo/internal/runner/provider"
"encoding/json"
+ "slices"
"strings"
"testing"
)
@@ -29,15 +30,38 @@ func TestCoordinatorInventoryObservation(t *testing.T) {
for _, name := range want {
members = append(members, map[string]any{"type": "function", "name": strings.TrimPrefix(name, "mcp__equipo__")})
}
- namespaced := marshal(map[string]any{"method": "rawResponseItem/completed", "params": map[string]any{"threadId": "session", "item": map[string]any{"type": "additional_tools", "role": "developer", "tools": []any{map[string]any{"type": "namespace", "name": "mcp__equipo", "tools": members}}}}})
+ native := []any{}
+ for _, name := range []string{"list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource"} {
+ native = append(native, map[string]any{"type": "function", "name": name})
+ }
+ want = append(want, "list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource")
+ namespaced := marshal(map[string]any{"method": "rawResponseItem/completed", "params": map[string]any{"threadId": "session", "item": map[string]any{"type": "additional_tools", "role": "developer", "tools": []any{map[string]any{"type": "namespace", "name": "mcp__equipo", "tools": members}, map[string]any{"type": "namespace", "name": "functions", "tools": native}}}}})
if !coordinatorInventory(family, "session", [][]byte{namespaced}) {
t.Fatal("pinned MCP namespace rejected")
}
+ var frame map[string]any
+ json.Unmarshal(namespaced, &frame)
+ item := frame["params"].(map[string]any)["item"].(map[string]any)
+ item["tools"] = append(item["tools"].([]any), map[string]any{"type": "namespace", "name": "mcp__other", "tools": []any{}})
+ if coordinatorInventory(family, "session", [][]byte{marshal(frame)}) {
+ t.Fatal("additional empty MCP namespace accepted")
+ }
}
good := inventoryFrame(family, "session", want)
if !coordinatorInventory(family, "session", [][]byte{good}) {
t.Fatal("valid observed inventory rejected")
}
+ for _, extra := range []string{"shell", "exec_command", "apply_patch", "file", "read_file", "search", "browser", "web", "view_image", "unknown", "mcp__other__read_project", "list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource"} {
+ if coordinatorInventory(family, "session", [][]byte{inventoryFrame(family, "session", append(slices.Clone(want), extra))}) {
+ t.Errorf("extra tool accepted: %s", extra)
+ }
+ }
+ for i, missing := range want {
+ without := append(slices.Clone(want[:i]), want[i+1:]...)
+ if coordinatorInventory(family, "session", [][]byte{inventoryFrame(family, "session", without)}) {
+ t.Errorf("missing tool accepted: %s", missing)
+ }
+ }
for name, frames := range map[string][][]byte{
"missing": nil,
"foreign": {inventoryFrame(family, "foreign", want)},
diff --git a/internal/directlive/coordinator_inventory.go b/internal/directlive/coordinator_inventory.go
index 04fb8bda..af85e5d6 100644
--- a/internal/directlive/coordinator_inventory.go
+++ b/internal/directlive/coordinator_inventory.go
@@ -14,6 +14,7 @@ func coordinatorInventory(family, session string, frames [][]byte) bool {
if family == "claude" {
want = append(want, "mcp__equipo__permission")
}
+ want = append(want, provider.CoordinatorNativeTools(family)...)
slices.Sort(want)
observed := false
for _, raw := range frames {
diff --git a/internal/directlive/driver_test.go b/internal/directlive/driver_test.go
index 45499f8a..86e186ad 100644
--- a/internal/directlive/driver_test.go
+++ b/internal/directlive/driver_test.go
@@ -32,7 +32,7 @@ func TestDirectDriverFakeCLI(t *testing.T) {
}
badCoordinator := os.Getenv("EQUIPO_FAKE_BAD_COORDINATOR") == "1"
if badCoordinator {
- script = []byte(strings.Replace(string(script), "names=mcp()", "names=mcp()\n if 'mcp__equipo__read_project' in names:names+=['list_mcp_resources','list_mcp_resource_templates','read_mcp_resource']", 1))
+ script = []byte(strings.Replace(string(script), "names=mcp()", "names=mcp()\n if 'mcp__equipo__read_project' in names:names+=['exec_command']", 1))
}
pins := map[string]string{}
for _, name := range []string{"claude", "codex", "codex-code-mode-host"} {
@@ -193,13 +193,13 @@ func TestDirectDriverFakeWorker(t *testing.T) {
var e provider.DirectEvidence
if strings.Contains(name, "Coordinator") {
if os.Getenv("EQUIPO_FAKE_BAD_COORDINATOR") == "1" && strings.HasPrefix(name, "codex-") {
- if json.Unmarshal(raw, &e) != nil || e.Checks["tuple-completed"].Status != "not-certified" || e.Checks["coordinator-empty-native-inventory"].Status != "not-certified" {
+ if json.Unmarshal(raw, &e) != nil || e.Checks["tuple-completed"].Status != "not-certified" || e.Checks["coordinator-exact-tool-inventory"].Status != "not-certified" {
t.Fatal("failed coordinator tuple absent", string(raw))
}
continue
}
- if json.Unmarshal(raw, &e) != nil || e.Checks["coordinator-empty-native-inventory"].Status != "pass" || e.Checks["coordinator-structured-question"].Status != "pass" {
- t.Fatalf("empty inventory fixture failed: %s", raw)
+ if json.Unmarshal(raw, &e) != nil || e.Checks["coordinator-exact-tool-inventory"].Status != "pass" || e.Checks["coordinator-structured-question"].Status != "pass" {
+ t.Fatalf("exact inventory fixture failed: %s", raw)
}
if e.ValidateGroup(filepath.Dir(filepath.Join(c.EvidenceDir, name)), "Contract") == nil {
t.Fatal("offline coordinator fixture certified production")
diff --git a/internal/directlive/testdata/fake-cli.py b/internal/directlive/testdata/fake-cli.py
index f92db2ce..3e8403e4 100644
--- a/internal/directlive/testdata/fake-cli.py
+++ b/internal/directlive/testdata/fake-cli.py
@@ -42,6 +42,7 @@ for line in sys.stdin:
session='thread-fixture'
names=mcp()
if 'mcp__equipo__read_project' in names:
+ names+=['list_mcp_resources','list_mcp_resource_templates','read_mcp_resource']
if not raw_events or not config.get('features',{}).get('incremental_tools'):raise RuntimeError('missing observed catalog configuration')
emit({'method':'rawResponseItem/completed','params':{'threadId':session,'turnId':str(turn),'item':{'type':'additional_tools','role':'developer','tools':[{'type':'function','name':n,'parameters':{'type':'object'}} for n in names]}}})
else:
diff --git a/internal/release/manifest.json b/internal/release/manifest.json
index 2854ec9c..c395ee52 100644
--- a/internal/release/manifest.json
+++ b/internal/release/manifest.json
@@ -120,7 +120,7 @@
{
"provider": "codex",
"action": "coordinate",
- "inventory_hash": "439feb9ef31873621697f1bfbd156d7d07b672ea132e670c1ca35e7deff97831",
+ "inventory_hash": "e3a7b3d849f6c90aa8e68af73e1494534e097749cf00a29c58664d3f41c295b7",
"status": "uncertified"
}
]
diff --git a/internal/runner/coordinator_tools_test.go b/internal/runner/coordinator_tools_test.go
index 3e131061..154b826f 100644
--- a/internal/runner/coordinator_tools_test.go
+++ b/internal/runner/coordinator_tools_test.go
@@ -7,6 +7,7 @@ import (
"net"
"os"
"path/filepath"
+ "slices"
"strings"
"testing"
"time"
@@ -38,14 +39,30 @@ func TestCoordinatorToolAllowlist(t *testing.T) {
}
}
if family == "claude" {
+ if len(got.NativeTools) != 0 {
+ t.Fatal("Claude native policy widened")
+ }
for i, arg := range got.Argv {
if arg == "--tools" && got.Argv[i+1] != "" {
t.Fatal("nonempty built-in inventory")
}
}
} else {
+ if !slices.Equal(got.NativeTools, []string{"list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource"}) {
+ t.Fatal("Codex native exception is not exact")
+ }
var cfg map[string]any
json.Unmarshal(got.Settings, &cfg)
+ servers := cfg["mcp_servers"].(map[string]any)
+ if len(servers) != 1 || servers["equipo"] == nil {
+ t.Fatal("additional MCP server configured")
+ }
+ var mcp struct {
+ Servers map[string]any `json:"mcpServers"`
+ }
+ if json.Unmarshal(got.MCP, &mcp) != nil || len(mcp.Servers) != 1 || mcp.Servers["equipo"] == nil {
+ t.Fatal("additional MCP server in manifest")
+ }
for _, key := range []string{"shell_tool", "view_image", "search_tool", "browser_use", "computer_use", "code_mode", "js_repl"} {
if cfg["features"].(map[string]any)[key] != false {
t.Fatal("Codex built-in enabled", key)
@@ -59,7 +76,7 @@ func TestCoordinatorToolAllowlist(t *testing.T) {
}
}
if json.Unmarshal(got.Catalog, &catalog) != nil || len(catalog.Models) != 1 || catalog.Models[0].Shell != "disabled" || catalog.Models[0].Patch != nil || len(catalog.Models[0].Tools) != 0 {
- t.Fatal("Codex native inventory not empty")
+ t.Fatal("Codex model catalog enables native tools")
}
if cfg["web_search"] != "disabled" {
t.Fatal("web search enabled")
@@ -186,20 +203,46 @@ func TestCoordinatorToolBroker(t *testing.T) {
defer conn.Close()
enc := json.NewEncoder(conn)
dec := json.NewDecoder(conn)
- for i, method := range []string{"initialize", "tools/list", "tools/call"} {
+ for i, method := range []string{"initialize", "tools/list", "resources/list", "resources/templates/list", "resources/read", "tools/call"} {
var params any = map[string]any{}
if method == "initialize" {
params = map[string]any{"protocolVersion": "2025-06-18", "capabilities": map[string]any{}, "clientInfo": map[string]any{}}
}
+ if method == "resources/read" {
+ params = map[string]any{"uri": "file:///workspace/private"}
+ }
if method == "tools/call" {
params = map[string]any{"name": "read_project", "arguments": map[string]any{"request_id": "read", "project_id": 1}}
}
mustJournal(t, enc.Encode(map[string]any{"jsonrpc": "2.0", "id": i, "method": method, "params": params}))
var reply map[string]any
mustJournal(t, dec.Decode(&reply))
+ if method == "resources/read" {
+ if reply["error"] == nil || reply["result"] != nil {
+ t.Fatal("resource read succeeded", reply)
+ }
+ continue
+ }
if reply["error"] != nil {
t.Fatal(reply)
}
+ if method == "initialize" {
+ caps := reply["result"].(map[string]any)["capabilities"].(map[string]any)
+ if _, ok := caps["resources"]; ok {
+ t.Fatal("resources capability advertised")
+ }
+ }
+ if method == "resources/list" || method == "resources/templates/list" {
+ key := "resources"
+ if method == "resources/templates/list" {
+ key = "resourceTemplates"
+ }
+ result := reply["result"].(map[string]any)
+ entries, ok := result[key].([]any)
+ if !ok || len(entries) != 0 || len(result) != 1 {
+ t.Fatal("nonempty resource discovery", reply)
+ }
+ }
if method == "tools/list" {
raw, _ := json.Marshal(reply)
if !strings.Contains(string(raw), "source_message_ids") || strings.Contains(string(raw), "submit_candidate") {
diff --git a/internal/runner/provider/actions.go b/internal/runner/provider/actions.go
index b18b828f..857cf417 100644
--- a/internal/runner/provider/actions.go
+++ b/internal/runner/provider/actions.go
@@ -52,3 +52,12 @@ func (p ActionProfile) MCPTools() []string {
func CoordinatorTools() []string {
return []string{"read_project", "read_task", "propose_plan", "ask_person", "route_to_task", "post_message", "suggest_preference", "suggest_specialist", "suggest_playbook"}
}
+
+// Codex 0.165.0 registers these whenever MCP is configured. The coordinator's
+// only server exposes no resources; Claude has no native-tool exception.
+func CoordinatorNativeTools(family string) []string {
+ if family == "codex" {
+ return []string{"list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource"}
+ }
+ return nil
+}
diff --git a/internal/runner/provider/codex/launcher.go b/internal/runner/provider/codex/launcher.go
index 50b2e6dd..39d77acc 100644
--- a/internal/runner/provider/codex/launcher.go
+++ b/internal/runner/provider/codex/launcher.go
@@ -58,6 +58,7 @@ type sessionState struct {
used map[string]bool
}
type manifest struct {
+ NativeTools []string
Action string
AuthHost string
Argv, DeniedPaths, EgressHosts, Tools []string
@@ -132,6 +133,7 @@ func PolicyInputs(b provider.Binding, in provider.PolicyInputs, model string) (p
}
if in.Action == "coordinate" {
configureCoordinator(settings, model)
+ in.NativeTools = provider.CoordinatorNativeTools("codex")
in.Catalog = coordinatorCatalog(model)
}
for _, tool := range in.Tools {
@@ -198,7 +200,7 @@ func policyInputs(p provider.Policy) (provider.PolicyInputs, manifest, error) {
if !uniqueJSON(p.Manifest) || json.Unmarshal(p.Manifest, &m) != nil {
return provider.PolicyInputs{}, m, provider.ErrPolicy
}
- in := provider.PolicyInputs{Action: m.Action, AuthHost: m.AuthHost, Argv: m.Argv, DeniedPaths: append([]string{}, m.DeniedPaths...), EgressHosts: m.EgressHosts, Tools: m.Tools, ProviderVersion: m.ProviderVersion, LauncherVersion: m.LauncherVersion, BwrapVersion: m.BwrapVersion, Workspace: m.Workspace, Scratch: m.Scratch, Catalog: m.Catalog, Settings: m.Settings, MCP: m.MCP, ThreadPolicy: m.ThreadPolicy, TurnPolicy: m.TurnPolicy, Env: map[string]string{}}
+ in := provider.PolicyInputs{NativeTools: m.NativeTools, Action: m.Action, AuthHost: m.AuthHost, Argv: m.Argv, DeniedPaths: append([]string{}, m.DeniedPaths...), EgressHosts: m.EgressHosts, Tools: m.Tools, ProviderVersion: m.ProviderVersion, LauncherVersion: m.LauncherVersion, BwrapVersion: m.BwrapVersion, Workspace: m.Workspace, Scratch: m.Scratch, Catalog: m.Catalog, Settings: m.Settings, MCP: m.MCP, ThreadPolicy: m.ThreadPolicy, TurnPolicy: m.TurnPolicy, Env: map[string]string{}}
for _, path := range []string{m.CredentialHome, "/home/runner"} {
for i, p := range in.DeniedPaths {
if p == path {
@@ -244,7 +246,7 @@ func (l *Launcher) validatePolicy(b provider.Binding, p provider.Policy) (provid
return in, provider.ErrPolicy
}
}
- if (in.Action == "coordinate" && !sameJSON(in.Catalog, want.Catalog)) || !reflect.DeepEqual(in.Argv, want.Argv) || p.Env["CODEX_HOME"] != "/home/runner" {
+ if !reflect.DeepEqual(in.NativeTools, want.NativeTools) || (in.Action == "coordinate" && !sameJSON(in.Catalog, want.Catalog)) || !reflect.DeepEqual(in.Argv, want.Argv) || p.Env["CODEX_HOME"] != "/home/runner" {
return in, provider.ErrPolicy
}
binary, helper, toolHelper := false, false, false
diff --git a/internal/runner/provider/codex/launcher_test.go b/internal/runner/provider/codex/launcher_test.go
index 4ea5d00e..7885095b 100644
--- a/internal/runner/provider/codex/launcher_test.go
+++ b/internal/runner/provider/codex/launcher_test.go
@@ -133,6 +133,9 @@ func (h *fakeHost) Start(ctx context.Context, l provider.Launch, args []string)
if mode == "mcp" {
config["mcp_servers"] = map[string]any{"inherited": map[string]any{"command": "evil"}}
}
+ if mode == "extra-mcp" {
+ config["mcp_servers"].(map[string]any)["other"] = map[string]any{"command": "other"}
+ }
if mode == "network" {
config["permissions"].(map[string]any)["equipo"].(map[string]any)["network"].(map[string]any)["enabled"] = true
}
diff --git a/internal/runner/provider/codex/plan_policy_test.go b/internal/runner/provider/codex/plan_policy_test.go
index 4530937e..f52ac71f 100644
--- a/internal/runner/provider/codex/plan_policy_test.go
+++ b/internal/runner/provider/codex/plan_policy_test.go
@@ -117,3 +117,82 @@ func TestCoordinatorToolCatalogBound(t *testing.T) {
}
t.Fatal("catalog not mounted")
}
+
+func TestCoordinatorOnlyMCPServer(t *testing.T) {
+ for _, mode := range []string{"", "extra-mcp", "mcp"} {
+ t.Run(mode, func(t *testing.T) {
+ f := fixtureFor(t)
+ f.host.set(mode)
+ in := f.inputs
+ in.Action = "coordinate"
+ in.Tools = provider.ActionProfile{Action: "coordinate"}.MCPTools()
+ in, err := PolicyInputs(f.lease.Binding(), in, f.launch.Selection.Model)
+ if err != nil {
+ t.Fatal(err)
+ }
+ f.launch.Policy, err = provider.BuildPolicy(f.lease.Binding(), in)
+ if err != nil {
+ t.Fatal(err)
+ }
+ session, err := f.l.Open(context.Background(), f.launch)
+ if mode != "" {
+ if err == nil {
+ f.l.Close(context.Background(), session)
+ t.Fatal("additional or replaced MCP server accepted")
+ }
+ if f.host.count("thread/start") != 0 {
+ t.Fatal("thread started with untrusted MCP configuration")
+ }
+ return
+ }
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.l.Close(context.Background(), session)
+ if _, err = f.l.Events(context.Background(), session); err != nil {
+ t.Fatal(err)
+ }
+ f.host.set("extra-mcp")
+ if f.l.StartTurn(context.Background(), session, provider.Turn{ID: "turn", AdmissionID: "admission", Prompt: "fixture"}) == nil {
+ t.Fatal("extra MCP server accepted before turn")
+ }
+ if f.host.count("turn/start") != 0 {
+ t.Fatal("prompt sent with extra server")
+ }
+ })
+ }
+}
+
+func TestCoordinatorNativePolicyHash(t *testing.T) {
+ f := fixtureFor(t)
+ in := f.inputs
+ in.Action = "coordinate"
+ in.Tools = provider.ActionProfile{Action: "coordinate"}.MCPTools()
+ in, err := PolicyInputs(f.lease.Binding(), in, f.launch.Selection.Model)
+ if err != nil {
+ t.Fatal(err)
+ }
+ p, err := provider.BuildPolicy(f.lease.Binding(), in)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var m map[string]json.RawMessage
+ if json.Unmarshal(p.Manifest, &m) != nil {
+ t.Fatal("bad manifest")
+ }
+ for _, native := range [][]string{nil, {"list_mcp_resources"}, {"list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource", "exec_command"}} {
+ changed := in
+ changed.NativeTools = native
+ if _, err := provider.BuildPolicy(f.lease.Binding(), changed); err == nil {
+ t.Fatal("changed native policy accepted")
+ }
+ }
+ if !sameJSON(m["NativeTools"], []byte(`["list_mcp_resources","list_mcp_resource_templates","read_mcp_resource"]`)) {
+ t.Fatal("native resource policy missing from manifest hash")
+ }
+ delete(m, "NativeTools")
+ old, err := json.Marshal(m)
+ if err != nil || provider.DigestDirectEvidence(old) == p.ManifestHash {
+ t.Fatal("native policy did not change hash")
+ }
+}
diff --git a/internal/runner/provider/direct_requirements.json b/internal/runner/provider/direct_requirements.json
index 753db3fe..042d32c8 100644
--- a/internal/runner/provider/direct_requirements.json
+++ b/internal/runner/provider/direct_requirements.json
@@ -1,7 +1,7 @@
{
"Coordinator": [
"account-version-readback", "effective-policy-readback",
- "coordinator-empty-native-inventory", "coordinator-structured-question",
+ "coordinator-exact-tool-inventory", "coordinator-structured-question",
"pid1-go-helper-owner", "private-network", "immutable-settings",
"settings-write-denied", "host-services-absent", "host-control-sockets-denied"
],
diff --git a/internal/runner/provider/policy.go b/internal/runner/provider/policy.go
index ffac12b0..3e245ae2 100644
--- a/internal/runner/provider/policy.go
+++ b/internal/runner/provider/policy.go
@@ -23,6 +23,7 @@ const CoordinatorCatalogPath = "/config/equipo-coordinator-models.json"
const MCPPath = "/config/equipo-mcp.json"
type PolicyInputs struct {
+ NativeTools []string `json:",omitempty"`
Action string
AuthHost string
RuntimeFiles []Mount
@@ -42,7 +43,8 @@ type fileDigest struct {
SHA256 string
}
type effectiveManifest struct {
- Action string `json:",omitempty"`
+ NativeTools []string `json:",omitempty"`
+ Action string `json:",omitempty"`
AuthHost string
OuterMounts, GeneratedMounts []Mount
NamespaceArgs []string
@@ -224,6 +226,14 @@ func hashFiles(mounts []Mount, b Binding) ([]fileDigest, error) {
return out, nil
}
func BuildPolicy(b Binding, in PolicyInputs) (Policy, error) {
+ var native []string
+ if in.Action == "coordinate" {
+ native = CoordinatorNativeTools(b.Provider)
+ }
+ if !slices.Equal(in.NativeTools, native) {
+ return Policy{}, ErrPolicy
+ }
+
if !b.VerifiedDedicatedHome() {
return Policy{}, ErrIdentity
}
@@ -343,7 +353,7 @@ func BuildPolicy(b Binding, in PolicyInputs) (Policy, error) {
for _, k := range []string{"HTTP_PROXY", "HTTPS_PROXY", "http_proxy", "https_proxy"} {
fullEnv[k] = "http://127.0.0.1:18080"
}
- m := effectiveManifest{Action: in.Action, AuthHost: in.AuthHost, Version: PolicyVersion, BindingID: b.ID, Provider: b.Provider, AccountID: b.AccountID, CredentialHome: b.CredentialHome, Identity: b.Expected, ProviderVersion: in.ProviderVersion, LauncherVersion: in.LauncherVersion, BwrapVersion: in.BwrapVersion, Argv: append([]string(nil), in.Argv...), Env: fullEnv, Files: files, DeniedPaths: denied, EgressHosts: hosts, Tools: tools, Catalog: in.Catalog, Settings: settings, MCP: mcp, ThreadPolicy: thread, TurnPolicy: turn, Workspace: in.Workspace, Scratch: in.Scratch, RuntimeHome: b.Home, ConfigHome: b.provenance.config, Instructions: instructions, HooksDisabled: true, PluginsDisabled: true, TurnOverridesOmitted: true, MaskedDirectories: []string{"/etc/claude-code", "/etc/codex"}, Proxy: "http://127.0.0.1:18080"}
+ m := effectiveManifest{NativeTools: slices.Clone(in.NativeTools), Action: in.Action, AuthHost: in.AuthHost, Version: PolicyVersion, BindingID: b.ID, Provider: b.Provider, AccountID: b.AccountID, CredentialHome: b.CredentialHome, Identity: b.Expected, ProviderVersion: in.ProviderVersion, LauncherVersion: in.LauncherVersion, BwrapVersion: in.BwrapVersion, Argv: append([]string(nil), in.Argv...), Env: fullEnv, Files: files, DeniedPaths: denied, EgressHosts: hosts, Tools: tools, Catalog: in.Catalog, Settings: settings, MCP: mcp, ThreadPolicy: thread, TurnPolicy: turn, Workspace: in.Workspace, Scratch: in.Scratch, RuntimeHome: b.Home, ConfigHome: b.provenance.config, Instructions: instructions, HooksDisabled: true, PluginsDisabled: true, TurnOverridesOmitted: true, MaskedDirectories: []string{"/etc/claude-code", "/etc/codex"}, Proxy: "http://127.0.0.1:18080"}
readOnly := false
if in.Action != "" {
profile, err := Profile(in.Action)
diff --git a/internal/runner/tools.go b/internal/runner/tools.go
index 82353a79..c53e225b 100644
--- a/internal/runner/tools.go
+++ b/internal/runner/tools.go
@@ -175,6 +175,18 @@ func serveTools(ctx context.Context, input io.Reader, output io.Writer, capabili
result = map[string]any{"protocolVersion": params.ProtocolVersion, "capabilities": map[string]any{"tools": map[string]any{}}, "serverInfo": map[string]any{"name": "equipo-runner", "version": "1"}}
case "ping":
result = map[string]any{}
+ case "resources/list", "resources/templates/list":
+ if !initialized || !cap.Coordinator {
+ err = runnerproto.ErrInvalid
+ break
+ }
+ key := "resources"
+ if q.Method == "resources/templates/list" {
+ key = "resourceTemplates"
+ }
+ result = map[string]any{key: []any{}}
+ case "resources/read":
+ err = runnerproto.ErrInvalid
case "tools/list":
if !initialized {
err = runnerproto.ErrInvalid