diff --git a/src/autoresearch/role_runner.py b/src/autoresearch/role_runner.py index 32d37a0c..e6748310 100644 --- a/src/autoresearch/role_runner.py +++ b/src/autoresearch/role_runner.py @@ -115,8 +115,9 @@ def build_harness( the ephemeral boundary (CI). The tokenless split keeps credentials out of the session either way.""" if backend == "codex": - # the web: codex's native web_search tool, on when the spec grants it - web = ("--search",) if "WebSearch" in spec.tools else () + # the web, when the spec grants it: the config override, because + # `codex exec` does not accept `--search` + web = ("-c", "tools.web_search=true") if "WebSearch" in spec.tools else () return CodexHarness( api_key=api_key, binary=binary or "codex", diff --git a/tests/test_attempt.py b/tests/test_attempt.py index abb6fa50..7df5302b 100644 --- a/tests/test_attempt.py +++ b/tests/test_attempt.py @@ -1529,7 +1529,12 @@ def test_editor_harness_codex_backend_is_contained() -> None: assert harness.model == "gpt-5.6-terra" assert harness.timeout_s == 300 # host codex config, then the web (the author spec grants WebSearch) - assert harness.extra_args == ("-c", "use_legacy_landlock=true", "--search") + assert harness.extra_args == ( + "-c", + "use_legacy_landlock=true", + "-c", + "tools.web_search=true", + ) assert harness.supports_resume is True # codex exec resume, validated on 0.130.0 with pytest.raises(ValueError, match="unknown backend"): build_harness("sk-o", spec, backend="bogus", container_image="img.sif") diff --git a/tests/test_role_runner.py b/tests/test_role_runner.py index 35ec7d1a..3546cae1 100644 --- a/tests/test_role_runner.py +++ b/tests/test_role_runner.py @@ -201,7 +201,10 @@ def test_build_harness_codex_is_uniform_for_all_roles() -> None: assert isinstance(judge, CodexHarness) and isinstance(editor, CodexHarness) assert judge.sandbox == editor.sandbox == "danger-full-access" assert judge.container_image == "" and editor.container_image == "img.sif" - assert "--search" in judge.extra_args and "--search" in editor.extra_args # the web + # the web: the exec-compatible config override, never `--search` (which + # `codex exec` rejects — it killed every fleet attempt on 2026-08-29) + for h in (judge, editor): + assert "tools.web_search=true" in h.extra_args and "--search" not in h.extra_args def test_build_harness_hermes_toolsets_follow_the_spec(tmp_path: Path) -> None: