Skip to content

feat(codex): pass sdk_options.effort as model_reasoning_effort - #269

Open
danmunteanu1 wants to merge 2 commits into
mainfrom
feat/codex-reasoning-effort
Open

danmunteanu1 wants to merge 2 commits into
mainfrom
feat/codex-reasoning-effort

Conversation

@danmunteanu1

@danmunteanu1 danmunteanu1 commented Nov 25, 2026 •

Copy link
Copy Markdown

Summary

Codex takes agent.sdk_options.effort, the reasoning-effort tier, and sends it as the effort of every thread.turn call, typed as the SDK's ReasoningEffort. Codex applies it over the model_reasoning_effort in $CODEX_HOME/config.toml. Unset, nothing is sent: the host config.toml value applies, or else the model's default, as today.

sdk_options on Codex accepts only effort. Another key, a value that is not a string, or a tier outside openai_codex.api.ReasoningEffort (none, minimal, low, medium, high, xhigh, max, ultra) fails at load. Before this, any sdk_options on Codex failed at load. Now -D agent.sdk_options.effort=high works for Claude Code, Codex and Delegate, and a task sets it per task under agent.sdk_options.

Why

Under coder_eval, Codex runs at the model's default effort, and neither a task nor a run can change it. We tested six multi-turn dialog tasks from UiPath/skills (uipath-planner interview tasks, with a simulated user and an LLM judge). They pass reliably on Claude Code and fail intermittently on Codex. Each task ran 3 times at each effort, with gpt-5.6-luna, both efforts in the same CI runs. The rollouts record high in all 18 runs at high:

Task Default effort high
author-from-sdd 0/3 3/3
designed-genome 1/3 3/3
author-declined 2/3 3/3
extract-refactor 3/3 3/3
genome-with-sdd 2/3 2/3
author-complete-idea 2/3 1/3
Total 10/18 15/18

At high, the average cost per task went from $0.059 to $0.152, and runs took about 1.8× as long. Those runs set the tier with a pre_run step that wrote config.toml, because coder_eval had no option for it.

Changes

  • CodexAgentConfig.sdk_options, validated to effort and Codex's tiers. Codex and Delegate now share one validator, _validate_effort_only_sdk_options; it checks that effort is a string before it checks the tier.
  • CodexAgent._build_turn_options passes effort=ReasoningEffort(tier) to thread.turn when effort is set.
  • Reports: when a run has no recorded SDK options, as on Codex, the Agent Settings table shows Effort from agent_config.sdk_options, so effort variants show their tier in the markdown, experiment and HTML reports.
  • Docs: CODEX.md § Reasoning Effort, the sdk_options list in the Task Definition Guide (its Agent Types list no longer names sdk_options for claude-code only), and DELEGATE.md, which now names all three agents.
  • Tests: the three override tests that pinned "sdk_options on Codex raises" now pin that effort applies and that another key raises. Two new tests pin the "sdk_options cannot be used with agent type opencode" message, on the plain path and the --type path. The dataset-expansion fixtures that used the old rejection now use a key that only Claude accepts (max_thinking_tokens).

Scheduled runs: a task that sets only sdk_options.effort was skipped under --type codex before this PR, and now runs on Codex at that tier. A run that sets no sdk_options is unchanged.

Codex records sdk_options: null in run.json, as before; its tier is in agent_config.sdk_options.effort.

Testing

  • tests/test_codex_reasoning_effort.py:
    • communicate() with a recording thread: a set effort reaches thread.turn as ReasoningEffort; an unset effort sends no option;
    • the tier set equals openai_codex.api.ReasoningEffort;
    • another key, an unknown tier, or a non-string value (3, None, ["high"], {"tier": "high"}) is a ValidationError;
    • the Agent Settings rows of a Codex config show its Effort.
  • The new effort, non-string and report tests fail on the previous commit of this branch.
  • The turn path is not yet run live. The SDK documents the turn's effort as "Override the reasoning effort for this turn and subsequent turns". An earlier live run of the first commit, which sent the tier as the thread config's model_reasoning_effort, recorded effort: low with -D agent.sdk_options.effort=low over a config.toml that set medium.
  • Full suite on Windows: the same 20 failures and 3 errors as main (all environment), and 13 more passes, all from the new tests.
  • Clean: ruff format --check, ruff check and pyright on the changed files, the custom lint (753 passed), and the prose budget.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Claude finished @danmunteanu1's task in 1m 16s —— View job


PR Review in Progress

Todo List:

  • Read code review guidelines (.github/code_review.md)
  • Read CLAUDE.md for project conventions
  • Review the full diff (git diff origin/main...HEAD)
  • Read full context of each changed file
  • Check cross-file consistency
  • Verify test coverage and quality
  • Check documentation completeness
  • Provide structured review feedback

@uipreliga uipreliga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: coder_eval — pr:269 --post-comment

Scope: pr:269 --post-comment · branch feat/codex-reasoning-effort (PR #269 head) · 3056099 · 2026-11-25T19:20Z · workflow variant

Change class: complex — changes the public CodexAgentConfig schema (sdk_options now accepted and validated) and adds a new value to the Codex thread config

The codebase is healthy (9.7/10, with no critical or high findings and clean Security and Error Handling axes), but the new Codex sdk_options.effort path has three real risks: an unhashable effort value raises a raw TypeError that stops the whole suite, the tier goes through an untyped config key that an SDK rename can silently ignore, and reports cannot show effort variants apart; fix these three before you rely on Codex effort A/B results.

Summary

Axis Score 🔴 🟠 🟡 🔵 Top Issue
1. Code Quality & Style 9.4 / 10 0 0 1 1 Codex sdk_options single-key validator is a near-copy of Delegate's effort-only validator
2. Type Safety 9.9 / 10 0 0 0 1 Codex effort tier is an untyped dict[str, Any] entry checked against a runtime frozenset, not a typed Literal field
3. Test Health 9.4 / 10 0 0 1 1 PR deletes the only tests of the friendly '-D sdk_options on a kind that has none' OverrideError branch
4. Security 10 / 10 0 0 0 0 —
5. Architecture & Design 9.9 / 10 0 0 0 1 Codex effort uses the untyped thread config dict instead of the SDK's typed effort parameter
6. Error Handling & Resilience 10 / 10 0 0 0 0 —
7. API Surface & Maintainability 9.4 / 10 0 0 1 1 Codex effort validator raises a raw TypeError (not a ValidationError) for an unhashable value, which skips OverrideError formatting and per-task skip isolation, and no test covers it
8. Evaluation Harness Quality 9.5 / 10 0 0 1 0 Codex effort is not rendered in Agent Settings, so run.md/experiment.md/HTML cannot tell effort variants apart

Overall Score: 9.7 / 10 · Weakest Axis: Code Quality & Style at 9.4 / 10
Totals: 🔴 0 · 🟠 0 · 🟡 4 · 🔵 5 across 8 axes.

Blockers

None.

Non-blocking, but please consider before merge

  1. [Axis 1] Codex sdk_options single-key validator is a near-copy of Delegate's effort-only validator (src/coder_eval/models/agent_config.py:412-423) — The new CodexAgentConfig._validate_sdk_options_keys (lines 412-423) has the same shape as DelegateAgentConfig._validate_sdk_options_keys (lines 618-629). Both have a module-level frozenset({"effort"}) allowlist (_CODEX_SDK_OPTION_FIELDS at line 370, _DELEGATE_SDK_OPTION_FIELDS at line 560), the same unknown-key check unknown = sorted(set(v) - _CODEX_SDK_OPTION_FIELDS) / unknown = sorted(set(v) - _DELEGATE_SDK_OPTION_FIELDS), the same raise ValueError(f"sdk_options keys {unknown} are not ... coder_eval forwards " + f"(valid keys: {sorted(...)})"), and the same if "effort" in v and ... value check. Only the agent label and the effort predicate differ (closed tier set for Codex, isinstance(..., str) for Delegate). This is duplication across 2 sites, the Axis 1 Medium anchor. A third agent that adopts sdk_options.effort (the PR's docs push -D agent.sdk_options.effort=high as the cross-agent lever) would make a third copy. Fix: add one private helper, for example _validate_effort_only_sdk_options(v, *, owner: str, tiers: frozenset[str] | None) -> dict[str, Any], and call it from both validators. One shared _EFFORT_ONLY_SDK_OPTION_FIELDS = frozenset({"effort"}) can replace the two identical frozensets.
  2. [Axis 3] PR deletes the only tests of the friendly '-D sdk_options on a kind that has none' OverrideError branch (tests/test_overrides_engine.py:145) — On main, three tests reached the rejection branch at src/coder_eval/orchestration/overrides.py:153-158 (if type_value not in accepting: ... raise OverrideError(f"sdk_options cannot be used with {where}. This option is only supported for " ...)). They are test_overrides_engine.py:147 and :182 and test_merge_characterization.py:331, and all three used Codex as the kind that rejects the option. This PR changes all three into 'applies' tests: def test_sdk_options_effort_on_codex_applies(self): here, def test_sdk_options_effort_with_agent_type_codex_applies(self): at line 185, and test_merge_characterization.py:327. It adds no test for another kind that still rejects the option. I measured coverage of coder_eval.orchestration.overrides over the 12 related test files (overrides_engine, merge_characterization, cli_sdk_options, cli_set_overrides, experiment_resolver, config_lineage, cli_type_flag, dataset_expansion, and others). Lines 154-155 now show as missing. On main they are covered. The branch is still live: opencode, antigravity, pi and none have no sdk_options. Its message also changes with this PR. A probe shows the new message: 'sdk_options cannot be used with agent type opencode. This option is only supported for claude-code, codex, delegate agents.' Add a test that applies {"agent.sdk_options.effort": "high"} to an opencode (or pi) task and asserts the full message, including the accepted-kinds list that now names codex. Add a second test for the agent_type= rewrite path (--type opencode), because that is the second test this PR removed.
  3. [Axis 7] Codex effort validator raises a raw TypeError (not a ValidationError) for an unhashable value, which skips OverrideError formatting and per-task skip isolation, and no test covers it (src/coder_eval/models/agent_config.py:421) — At line 421 the validator runs if "effort" in v and v["effort"] not in _CODEX_EFFORT_TIERS:. That is a membership test against a frozenset, so an unhashable value raises TypeError: unhashable type. Pydantic does not convert a TypeError into a ValidationError. I reproduced this in the PR worktree: parse_agent_config(type=AgentKind.CODEX, sdk_options={'effort': ['high']}) raises TypeError: unhashable type: 'list', and {'effort': {'a': 1}} raises unhashable type: 'dict'. Two common typos produce such values: the YAML effort: {high} and -D agent.sdk_options.effort=[high] (parse_scalar YAML-parses the value). overrides._resolve re-raises only MergeError and ValidationError as OverrideError. Experiment resolution isolates a failing task only for (FileNotFoundError, OSError, ValueError, yaml.YAMLError) (experiment.py:662/721). So this TypeError gets no clear CLI message, and it does not skip only the bad task: it propagates and aborts the whole suite. The notes reserve TypeError for loader regressions. Delegate's validator avoids this because it checks isinstance(v["effort"], str) first. Fix: write if "effort" in v and (not isinstance(v["effort"], str) or v["effort"] not in _CODEX_EFFORT_TIERS):, and add ["high"] to the @pytest.mark.parametrize("effort", ["extreme", 3, None]) case at tests/test_codex_reasoning_effort.py:44. Cross-axis: Error Handling (6) and Harness (8).
  4. [Axis 8] Codex effort is not rendered in Agent Settings, so run.md/experiment.md/HTML cannot tell effort variants apart (src/coder_eval/agents/codex_agent.py:1801) — The PR adds effort = self.config.sdk_options.get("effort") / tool_config["model_reasoning_effort"] = effort (lines 1801-1803). CodexAgent does not override get_sdk_options(), so EvaluationResult.sdk_options stays None for Codex. resolve_agent_settings and html _render_agent_settings then fall back to agent_config with is_sdk=False. collect_agent_settings_rows adds the ("effort", "Effort") row only inside if is_sdk:, and only from a top-level key. I confirmed this at PR HEAD: a codex config with sdk_options={'effort':'high'} renders only [('Permission Mode','acceptEdits'), ('Allowed Tools','(all)'), ('Model','gpt-5')]. In an A/B experiment of codex at effort high against codex at effort xhigh, both variants show the same Agent Settings. Claude Code and Delegate (whose get_sdk_options includes effort) show the row. The value is present in run.json only as agent_config.sdk_options.effort. The previous PR #267 handled the same problem for context_window with resolve_context_window, which reads it from agent_config. Do the same for effort: render agent_config.sdk_options.effort when sdk_options is absent. Another option is to give CodexAgent a get_sdk_options() that returns the thread config with provider credentials redacted. Add a report-row test.

Nits

  1. [Axis 1] Validator named _validate_sdk_options_keys now also validates the effort value (src/coder_eval/models/agent_config.py:414) — Line 414, def _validate_sdk_options_keys(cls, v: dict[str, Any]) -> dict[str, Any]:, rejects unknown keys and also rejects an unknown tier value (line 421, if "effort" in v and v["effort"] not in _CODEX_EFFORT_TIERS:). The name says only half of what the function does. It copies the Delegate name, which has the same problem, so you can rename both together, for example to _validate_sdk_options. You can also do this as part of the shared-helper fix in finding 1. This is a naming nit.
  2. [Axis 2] Codex effort tier is an untyped dict[str, Any] entry checked against a runtime frozenset, not a typed Literal field (src/coder_eval/models/agent_config.py:381) — Line 381 sdk_options: dict[str, Any] = Field( and line 373 _CODEX_EFFORT_TIERS: frozenset[str] = frozenset({"none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"}) put the closed tier set only in a runtime frozenset. Pyright cannot see it, the JSON schema does not show it, and codex_agent.py:1801 (effort = self.config.sdk_options.get("effort")) gets an Any that goes into tool_config["model_reasoning_effort"] with no type check. The field copies the existing Delegate/Claude sdk_options dict shape, which the shared -D agent.sdk_options.effort path depends on, so this is Low. A small fix keeps the dict shape: declare CodexReasoningEffort = Literal["none", ..., "ultra"], build _CODEX_EFFORT_TIERS = frozenset(get_args(CodexReasoningEffort)) from it, and validate through TypeAdapter(CodexReasoningEffort) or a typed accessor that returns CodexReasoningEffort | None for the agent. This also fixes the unhashable-value TypeError, because the Literal check gives a ValidationError. The existing test_the_tiers_match_the_sdk check against openai_codex.api.ReasoningEffort keeps working unchanged.
  3. [Axis 3] The new 'other key on Codex raises' test matches any OverrideError that contains 'sdk_options', so it does not pin the new validator (tests/test_overrides_engine.py:152) — with pytest.raises(OverrideError, match="sdk_options"): also matches the friendly 'sdk_options cannot be used with agent type codex...' message that this PR replaced. If CodexAgentConfig lost its sdk_options field, the test would still pass. A probe shows the real message: "-D agent.sdk_options: Value error, sdk_options keys ['max_thinking_tokens'] are not Codex options coder_eval forwards (valid keys: ['effort'])". Match on are not Codex options, as test_codex_reasoning_effort.py:41 does, so the test asserts the new contract.
  4. [Axis 5] Codex effort uses the untyped thread config dict instead of the SDK's typed effort parameter (src/coder_eval/agents/codex_agent.py:1801) — Lines 1801-1803 put the tier into the free-form thread config dict: effort = self.config.sdk_options.get("effort") / if effort is not None: / tool_config["model_reasoning_effort"] = effort. The pinned openai_codex SDK has a typed parameter for this: Thread.turn(..., effort: ReasoningEffort | None = None), documented as "Override the reasoning effort for this turn and subsequent turns". This agent calls self.thread.turn at line 1862 (turn_handle = await self._run_async(self.thread.turn, state.user_input)). The new test module admits the cost of this choice in tests/test_codex_reasoning_effort.py lines 3-5: "the openai_codex SDK passes that dict through unchecked, so a Codex release that renamed the key would go unnoticed here." If the key changes, every effort tier silently runs at the default, and an effort A/B experiment then compares identical configurations with no error. context_window and tool_output_token_limit go through config because they have no typed parameter, but effort does. Recommendation: pass effort=ReasoningEffort(self.config.sdk_options["effort"]) to thread.turn at line 1862. An SDK rename then fails as an import or type error, and the existing tier-parity test (api.ReasoningEffort) already ties the validator to that enum. If thread-level config is deliberate, for example so the setting persists across resume, record that reason in .claude/notes/agents.md section Codex.
  5. [Axis 7] The PR edits the sdk_options section of TASK_DEFINITION_GUIDE but leaves the Agent Types list saying only claude-code supports sdk_options (docs/TASK_DEFINITION_GUIDE.md:225) — Line 225 still says "claude-code (default) — Claude Code SDK agent. Supports sdk_options, claude_settings, and all permission modes." The codex bullet on line 226 does not mention sdk_options. After this PR, codex (and delegate, which this list does not show) takes sdk_options.effort, so a reader of this list concludes that Codex rejects the key. Add sdk_options.effort (passed as model_reasoning_effort, link to agents/CODEX.md#reasoning-effort) to the codex bullet, or remove the per-type sdk_options claim here and point to the list at lines 194-201.

What's Missing

Parallel paths:

  • 🟡 The PR makes sdk_options.effort a cross-agent setting (CODEX.md and DELEGATE.md say -D agent.sdk_options.effort=high drives Claude Code, Codex and Delegate), but docs/agents/HARNESS_PARITY.md has no row for effort. Each agent accepts a different set of tiers. Claude Code's SDK types effort as Literal low/medium/high/xhigh/max. Codex accepts none/minimal/low/medium/high/xhigh/max/ultra. Delegate accepts any string, and the host falls back to the default for a tier it does not know. Antigravity, OpenCode and Pi set effort through their own typed fields with other names and other tier sets. So effort=ultra or effort=none loads on Codex but not on Claude Code, and -D agent.sdk_options.effort=high fails on opencode, pi and antigravity. The CLAUDE.md parity rule says a shared field must mean the same on every backend, or the difference must be documented. Add an effort section to HARNESS_PARITY.md that lists the field name and tier set for each agent, and what an unknown tier does. (trigger: docs/agents/CODEX.md)
  • 🔵 The Agent Types list in TASK_DEFINITION_GUIDE.md still says only claude-code supports sdk_options, and experiments/default.yaml still describes the sdk_options block as 'Claude Code SDK pass-through options'. The PR updates the sdk_options list at line 194 but not these other places that describe which kinds accept the key. (trigger: docs/TASK_DEFINITION_GUIDE.md) (restates: Axis 7: The PR edits the sdk_options section of TASK_DEFINITION_GUIDE but leaves the Agent Types list saying only claude-code supports sdk_options)

Tests:

  • 🟡 No test reaches the friendly 'sdk_options cannot be used with agent type X' OverrideError branch now. The PR changed all three tests that used Codex as the rejecting kind into 'applies' tests, and its accepted-kinds message now names codex. Add a test for opencode or pi, and one for the --type opencode rewrite path. (trigger: tests/test_overrides_engine.py) (restates: Axis 3: PR deletes the only tests of the friendly '-D sdk_options on a kind that has none' OverrideError branch)
  • 🟡 The new effort validator has no test for an unhashable value. effort: ['high'] or effort: {a: 1} raises a raw TypeError, not a ValidationError. Add ['high'] to the parametrize in test_codex_reasoning_effort.py:44. (trigger: tests/test_codex_reasoning_effort.py) (restates: Axis 7: Codex effort validator raises a raw TypeError (not a ValidationError) for an unhashable value, which skips OverrideError formatting and per-task skip isolation, and no test covers it)
  • 🔵 No test covers sdk_options.effort across the 5-layer merge or a kind switch. The companion tool_output_token_limit tests in test_codex_tool_output_cap.py check YAML null through resolve_root, a variant that switches away from Codex, and a -D round-trip with clean error text. test_codex_reasoning_effort.py tests only parse_agent_config directly. Add resolve_root cases for three switches: (a) a claude-code task with sdk_options: {effort: high} and a codex variant, which now inherits the effort; (b) the same with max_thinking_tokens, which must fail; (c) a codex task with effort: ultra and a claude-code variant. Also add an apply_overrides test for an invalid tier that asserts the -D agent.sdk_options.effort: ... must be one of message. (trigger: tests/test_codex_reasoning_effort.py)
  • 🔵 The new test module stops at the thread config dict, and its own docstring says a Codex rename of model_reasoning_effort would go unnoticed. No test pins the key against the SDK, and no test passes the typed Thread.turn(effort=...) parameter. (trigger: tests/test_codex_reasoning_effort.py) (restates: Axis 5: Codex effort uses the untyped thread config dict instead of the SDK's typed effort parameter)

Downstream consumers:

  • 🔵 Downstream readers of the effort tier get nothing for Codex. Codex does not override get_sdk_options(), so run.json/task.json sdk_options stays null for Codex rows, and Codex's effort is stored only as agent_config.sdk_options.effort. Claude Code and Delegate rows expose it under top-level sdk_options.effort. This affects anything that slices by effort: the report Agent Settings, the evalboard, and the coder-eval-uipath pipeline. docs/REPORT_SCHEMA.md (the sdk_options entry near line 175) does not say where a Codex row keeps its effort. Document agent_config.sdk_options.effort as the Codex location, or make Codex return its thread config from get_sdk_options() with credentials redacted. (trigger: src/coder_eval/agents/codex_agent.py) (restates: Axis 8: Codex effort is not rendered in Agent Settings, so run.md/experiment.md/HTML cannot tell effort variants apart)

Display & mapping dicts:

  • 🟡 The Effort row in collect_agent_settings_rows (reports/markdown.py:137) is shown only when is_sdk is true, and it reads a top-level key. The html _render_agent_settings has the same gate. Neither extends to the nested agent_config.sdk_options.effort that Codex now uses, so Codex effort A/B variants show the same Agent Settings. No report-row test asserts that a Codex effort value is rendered. (trigger: src/coder_eval/agents/codex_agent.py) (restates: Axis 8: Codex effort is not rendered in Agent Settings, so run.md/experiment.md/HTML cannot tell effort variants apart)

Daily/nightly:

  • 🔵 The PR does not say what changes for scheduled or nightly runs and for experiment configs in the coder-eval-uipath repo. Before this PR, sdk_options.effort in experiment defaults or a variant failed to load for Codex. Now it goes to Codex silently as model_reasoning_effort and overrides any model_reasoning_effort in the runner's $CODEX_HOME/config.toml. A nightly that shares a Claude-tuned effort default across agents now changes Codex's tier, and its Codex trend lines move with no change to any recorded Codex-specific field. Run.json sdk_options stays null for Codex, so a dashboard cannot see the change. State this in the PR, and add a trend-break note like the one CODEX.md has for tool_output_token_limit. (trigger: src/coder_eval/models/agent_config.py)

Harness & Lint Improvements

Static checks (lint / type):

  • [ce-lint] CE074 no-unguarded-allowlist-membership-in-validator (tests/lint/rules/ce074_no_unguarded_allowlist_membership.py, wired in tests/lint/runner.py). Scope: src/coder_eval/models/**. Inside a function decorated @field_validator / @model_validator, flag a Compare with In / NotIn when the left operand is a Subscript or .get(...) on the validator's value parameter and the right operand is a module-level name bound to frozenset(...) / set(...) / a set literal, unless the same BoolOp first has an isinstance(<same expr>, ...) guard. The rule message must recommend the Literal route from the pyright entry below: a Literal plus TypeAdapter gives a ValidationError, not a TypeError. Known blind spot: it does not see a value that was first bound to a local name. Prevents: Finding 'Codex effort validator raises a raw TypeError for an unhashable value' (src/coder_eval/models/agent_config.py:421, v["effort"] not in _CODEX_EFFORT_TIERS). The rule does not flag the Delegate validator, because its isinstance(v["effort"], str) guard comes first.
  • [pyright] Express the closed tier set as a type so that pyright can check it. Declare CodexReasoningEffort = Literal["none", ..., "ultra"]. Build _CODEX_EFFORT_TIERS = frozenset(get_args(CodexReasoningEffort)) from it. Validate with TypeAdapter(CodexReasoningEffort). Add a typed accessor CodexAgentConfig.effort -> CodexReasoningEffort | None and use it at codex_agent.py:1801 in place of self.config.sdk_options.get("effort"), which returns Any. Pyright cannot look into dict[str, Any], so the typed accessor is what puts this value under the type gate. As an optional second clause, CE074 could also forbid a module-level frozenset({<str literals only>}) in models/ when it is used as a value allowlist, unless it is built with get_args(<Literal>). Prevents: Finding 'Codex effort tier is an untyped dict[str, Any] entry checked against a runtime frozenset' (agent_config.py:373/381, codex_agent.py:1801). It also removes the TypeError shape at agent_config.py:421 at its root.
  • [pyright] Pass the effort through the typed SDK parameter: self.thread.turn(..., effort=ReasoningEffort(...)) at codex_agent.py:1862, not tool_config["model_reasoning_effort"]. If the pinned openai_codex SDK renames or removes the parameter or the enum, make typecheck then fails. With the current free-form config dict, the effort silently falls back to the default. This holds only if the typecheck environment installs the [codex] extra. Check that this is true, or add the extra to the environment. Prevents: Finding 'Codex effort uses the untyped thread config dict instead of the SDK's typed effort parameter' (src/coder_eval/agents/codex_agent.py:1801, and the gap that tests/test_codex_reasoning_effort.py:3-5 admits).
  • [ce-lint] CE075 doc parity, as a @pytest.mark.lint class in tests/test_custom_lint.py (it reasons over Markdown). The set of backticked agent kinds in the sdk_options per-type bullet list of docs/TASK_DEFINITION_GUIDE.md ('Each agent type validates its own keys at YAML load') must equal orchestration.overrides._kinds_accepting_sdk_options(). Delete before you guard: remove the per-type claim 'Supports sdk_options' from the 'Agent Types' bullets (line 225), so that the guarded list is the only place in the guide that states which kinds accept sdk_options. Prevents: Finding 'The PR edits the sdk_options section but leaves the Agent Types list saying only claude-code supports sdk_options' (docs/TASK_DEFINITION_GUIDE.md:225). It also prevents the next drift when another kind adopts sdk_options.effort.

Harness improvements (not statically reachable):

  • Add a sdk_options override contract test that takes its cases from the registry and not from one hardcoded sample kind. Parametrize over every registered AgentKind and apply -D agent.sdk_options.effort=high, on both the plain path and the --type <kind> rewrite path. Assert that the override applies if and only if the kind's config class declares sdk_options. Otherwise, assert the full friendly OverrideError message, including the accepted-kinds list from _kinds_accepting_sdk_options(). For each kind that accepts sdk_options, also assert two more things: an unknown key raises the validator's own message (match on 'are not options', not on 'sdk_options'), and an unhashable effort value (["high"]) raises OverrideError/ValidationError, not TypeError. Why not static: The test must run the override engine and the plugin registry to know which kinds accept sdk_options and which error path fires. A single-word match= is too common to forbid statically: tests/ has 73 such matches, and most of them are correct. Prevents: Finding 'PR deletes the only tests of the friendly OverrideError branch' (overrides.py:153-158 now uncovered; tests/test_overrides_engine.py:145/185, test_merge_characterization.py:327). Finding 'new other-key-on-Codex test matches any OverrideError containing sdk_options' (test_overrides_engine.py:152). It also catches the unhashable-value TypeError (agent_config.py:421) for every current and future copy of the effort validator.
  • Add a diff-coverage gate to make verify / CI, for example diff-cover or a coverage comparison against the merge base. The gate fails when a changed PR makes a line in src/ that main covered uncovered, even when the global 80% threshold still passes. Why not static: It needs a test run with coverage on both sides of the diff. The branch was still reachable and correct. It only lost its tests, and no AST property shows that. Prevents: Finding 'PR deletes the only tests of the friendly OverrideError branch' (orchestration/overrides.py:154-155 covered on main, missing on the PR).
  • Add an Agent Settings report parity test. For each agent kind whose config accepts sdk_options, build an EvaluationResult with every allowed sdk_options key set in agent_config. Leave sdk_options unset, as happens for an agent without a get_sdk_options() override. Render it through collect_agent_settings_rows in markdown and HTML, and assert that a row for each key appears with its value. Fix shape: like the resolve_context_window precedent, read effort from agent_config.sdk_options when sdk_options is absent, and do not gate it on is_sdk. Why not static: Whether a row renders depends on which runtime path is used: the agent's get_sdk_options() override, or the fallback to agent_config with is_sdk=False. Only a rendered report shows it. Prevents: Finding 'Codex effort is not rendered in Agent Settings, so run.md/experiment.md/HTML cannot tell effort variants apart' (codex_agent.py:1801, reports/markdown.py:132-140, reports/html.py:1020-1029).
  • Make sure that the configured Codex effort reaches the wire. The preferred fix is the typed Thread.turn(effort=...) route from the static bucket, which makes this item unnecessary. If thread-level config is kept on purpose, add a test against a recorded or faked openai_codex call that asserts the effective reasoning effort the SDK received. Also record in .claude/notes/agents.md, section Codex, why the config dict is used. Why not static: The SDK passes the config dict through without checks, so only an actual (or recorded) SDK invocation shows whether a key such as model_reasoning_effort took effect. Prevents: Finding 'Codex effort uses the untyped thread config dict instead of the SDK's typed effort parameter' (codex_agent.py:1801-1803): if the key is renamed, every effort tier silently runs at the default, and an effort A/B experiment compares identical configurations.
  • Do not add a lint rule for the duplicated effort-only validators or for the _validate_sdk_options_keys naming. Fix them with one shared private helper (for example _validate_effort_only_sdk_options(v, *, owner, tiers)) that both Codex and Delegate call, renamed so the name covers value validation too. The registry-driven contract test above then exercises every copy, so drift between agents shows up as a test failure. Why not static: ruff has no clone detector. pylint R0801 is not in the toolchain and is too noisy for blocks of about 10 lines. Whether a validator's name matches what it does needs semantic judgment. A guard rule that forbids sorted(set(v) - _X) outside the helper would guard a sharp edge that the helper removes. Prevents: Findings 'Codex sdk_options single-key validator is a near-copy of Delegate's effort-only validator' (agent_config.py:370/412-423 vs 560/618-629) and 'Validator named _validate_sdk_options_keys now also validates the effort value' (agent_config.py:414).

Top 5 Priority Actions

  1. Make the Codex effort check type-safe at src/coder_eval/models/agent_config.py:421: check isinstance(v["effort"], str) before the frozenset membership test, as the Delegate validator does at line 627, so that a typo such as effort: {high} or -D agent.sdk_options.effort=[high] gives a ValidationError/OverrideError and skips one task instead of a raw TypeError that aborts the whole suite; add ["high"] to the parametrize case at tests/test_codex_reasoning_effort.py:44.
  2. Pass the effort tier through the SDK's typed parameter (thread.turn(..., effort=ReasoningEffort(...))) at src/coder_eval/agents/codex_agent.py:1862 instead of the untyped tool_config["model_reasoning_effort"] key at lines 1801-1803, so that an SDK key rename fails loudly and cannot make every effort variant run silently at the default tier; if thread-level config is deliberate, record the reason in .claude/notes/agents.md.
  3. Show Codex effort in Agent Settings: when sdk_options is absent, render agent_config.sdk_options.effort in the fallback path of src/coder_eval/reports/markdown.py:50-64/132-140 and src/coder_eval/reports/html.py:1020, following the resolve_context_window example, so that codex-high and codex-xhigh variants do not show the same settings table; add a report-row test.
  4. Restore test coverage of the friendly 'sdk_options cannot be used with' OverrideError branch at src/coder_eval/orchestration/overrides.py:153-158: add a test for opencode (or pi) and a test for the --type opencode path that assert the full message, including the accepted-kinds list that now names codex (the PR removed these tests at tests/test_overrides_engine.py:145/185); also change match="sdk_options" at tests/test_overrides_engine.py:152 to match="are not Codex options".
  5. Merge the two duplicate effort-only validators (src/coder_eval/models/agent_config.py:412-423 and 618-629) into one helper named for what it does (for example _validate_sdk_options). Derive _CODEX_EFFORT_TIERS (line 373) from a CodexReasoningEffort Literal so the type checker and the JSON schema can see the tier set, and update the codex bullet at docs/TASK_DEFINITION_GUIDE.md:225-226 to say that it supports sdk_options.effort.

Stats: 0 🔴 · 0 🟠 · 4 🟡 · 5 🔵 across 8 axes reviewed.

@danmunteanu1

Copy link
Copy Markdown
Author

Addressed in d7f93c3.

Changed

  1. Duplicate validators: Codex and Delegate now call one helper, _validate_effort_only_sdk_options, and both validators are named _validate_sdk_options (nit 1). Claude Code's validator checks keys only, so it keeps _validate_sdk_options_keys.
  2. Rejection branch: two tests pin the full sdk_options cannot be used with agent type opencode. This option is only supported for claude-code, codex, delegate message, on the plain path and on the --type opencode path.
  3. Unhashable effort: reproduced (['high'] and {'a': 1} raised TypeError). The helper checks isinstance(effort, str) before the tier, and ["high"] and {"tier": "high"} are in the parametrize.
  4. Agent Settings: when a run has no recorded SDK options, the table shows Effort from agent_config.sdk_options, so Codex effort variants differ in the markdown, experiment and HTML reports.
  • Nit 3: the test matches are not Codex options.
  • Nit 4: effort now goes as thread.turn(..., effort=ReasoningEffort(tier)), not as a config key. A test drives communicate() with a recording thread and asserts the enum reaches turn.
  • Nit 5: the claude-code bullet under Agent Types no longer names sdk_options, so the sdk_options list is the one place that says which agent types take it.

Not changed

  • Nit 2 (Literal type): the one reader converts the tier to the SDK's ReasoningEffort enum at the call, and a test pins the tier set to that enum. A Literal and an adapter would add a type that no caller reads.
  • HARNESS_PARITY effort section: sdk_options is declared on each agent's config, not on BaseAgentConfig, and each agent's guide lists its own keys and tiers. That page covers run limits.
  • experiments/default.yaml and REPORT_SCHEMA: the first already says other agent types take their own keys; the second already says sdk_options is null on agents other than Claude Code and Delegate.
  • Merge-chain tests: the merge does not depend on the agent type. The --type codex test covers a type switch that carries effort, and the dataset-expansion fixtures cover a Claude-only key that fails under a Codex variant.
  • Trend-break note: before this PR, any sdk_options on Codex failed at load, so no run that worked carried an effort into Codex. The PR description now says what changes for scheduled runs.
  • CE074, CE075, the registry-driven contract test and the diff-coverage gate: the shared helper removes the pattern CE074 would guard; the others are harness work outside this change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants