Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(plugin): report worker capacity from merged Codex settings (#1055)

mldangelo-oai8eb6b9dac68f
diff --git a/plugins/codex-security/scripts/config_preflight.py b/plugins/codex-security/scripts/config_preflight.py
index 9eaaa8209..15338627f 100644
--- a/plugins/codex-security/scripts/config_preflight.py
+++ b/plugins/codex-security/scripts/config_preflight.py
@@ -394,8 +394,7 @@ def lookup_multi_agent_v2_enabled(
table_override = False
for source, feature_config in v2_configs:
- # Higher tables inherit enabled only through uninterrupted lower tables.
- if table_override and not isinstance(feature_config, dict):
+ if table_override and not isinstance(feature_config, (dict, bool)):
break
if isinstance(feature_config, bool):
return True, feature_config, source
diff --git a/plugins/codex-security/tests/test_capability_profiles.py b/plugins/codex-security/tests/test_capability_profiles.py
index 5186f0512..3bccdcb38 100644
--- a/plugins/codex-security/tests/test_capability_profiles.py
+++ b/plugins/codex-security/tests/test_capability_profiles.py
@@ -1043,11 +1043,11 @@ def test_higher_partial_v2_table_inherits_lower_enabled(tmp_path: Path) -> None:
assert worker_slots["source"] == str(project_config)
-def test_higher_partial_v2_table_replaces_lower_boolean(tmp_path: Path) -> None:
+def test_higher_partial_v2_table_inherits_lower_boolean(tmp_path: Path) -> None:
user_config = tmp_path / "user.toml"
project_config = tmp_path / "project.toml"
user_config.write_text("[features]\ngoals = true\nmulti_agent_v2 = true\n")
- project_config.write_text("[features.multi_agent_v2]\nmax_concurrent_threads_per_session = 9\n")
+ project_config.write_text("[features.multi_agent_v2]\nmax_concurrent_threads_per_session = 3\n")
result = run_preflight(
"--profile",
@@ -1060,9 +1060,17 @@ def test_higher_partial_v2_table_replaces_lower_boolean(tmp_path: Path) -> None:
)
payload = json.loads(result.stdout)
+ worker_slots = next(
+ item for item in payload["results"] if item["capability"] == "usable_worker_slots_6"
+ )
assert result.returncode == 0
- assert payload["multi_agent_mode"] == "v1"
- assert payload["multi_agent_context"]["version_source"] == "documented-default"
+ assert payload["multi_agent_mode"] == "v2"
+ assert payload["multi_agent_context"]["version_source"] == str(user_config)
+ assert worker_slots["configured_value"] == 3
+ assert worker_slots["actual"] == 2
+ assert worker_slots["source"] == str(project_config)
+ assert worker_slots["status"] == "fail"
+ assert worker_slots["severity"] == "warn"
def test_deep_scan_preflight_accepts_native_v2_without_parent_slots(config_path: Path) -> None:
@@ -1183,6 +1191,37 @@ def test_higher_precedence_boolean_feature_overrides_lower_table(tmp_path: Path)
assert payload["multi_agent_context"]["owner"] == "native"
+def test_higher_boolean_v2_feature_preserves_lower_table_capacity(tmp_path: Path) -> None:
+ lower_config = tmp_path / "lower.toml"
+ higher_config = tmp_path / "higher.toml"
+ lower_config.write_text(
+ "[features.multi_agent_v2]\nenabled = false\nmax_concurrent_threads_per_session = 9\n"
+ )
+ higher_config.write_text("[features]\nmulti_agent_v2 = true\n")
+
+ result = run_preflight(
+ "--profile",
+ "security_scan",
+ "--config",
+ str(lower_config),
+ "--config",
+ str(higher_config),
+ *AVAILABLE_RUNTIME_CHECKS,
+ )
+
+ payload = json.loads(result.stdout)
+ worker_slots = next(
+ item for item in payload["results"] if item["capability"] == "usable_worker_slots_6"
+ )
+ assert result.returncode == 0
+ assert payload["multi_agent_mode"] == "v2"
+ assert payload["multi_agent_context"]["version_source"] == str(higher_config)
+ assert worker_slots["configured_value"] == 9
+ assert worker_slots["actual"] == 8
+ assert worker_slots["source"] == str(lower_config)
+ assert worker_slots["status"] == "pass"
+
+
def test_security_scan_warns_for_insufficient_bridge_worker_slots(config_path: Path) -> None:
result = run_config_preflight(
"security_scan",