Skip to content

Fix Claude reasoning overrides after #58 - #60

Merged
aviggiano merged 1 commit into
mainfrom
codex/fix-claude-agent-effort
Jul 17, 2026
Merged

aviggiano merged 1 commit into
mainfrom
codex/fix-claude-agent-effort

Conversation

@aviggiano

@aviggiano aviggiano commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #58.

  • clear backend-specific reasoning whenever --agent switches agents, including --agent plus --model
  • preserve configured reasoning for model-only overrides
  • forward Claude reasoning effort through the supported --effort flag
  • align CLI and config documentation

Validation:

  • pnpm -w format:check
  • pnpm -w lint
  • pnpm -w build
  • pnpm -w test
  • pnpm -w run ci
  • independent Smithers review approved with no findings

Greptile Summary

This follow-up to #58 fixes two related gaps in agent-override handling: backend-specific reasoning is now always cleared whenever --agent switches to a different agent (including when --model is also provided), and Claude's reasoningEffort is now forwarded to the Claude Code CLI via --effort rather than silently dropped.

  • applyDefaultProfileOverrides restructured so delete profile.reasoning fires unconditionally on any cross-agent switch, decoupled from the overrides.model === undefined guard that controls delete profile.model.
  • createClaudeAgent wires options.reasoningEffort to extraArgs: [\"--effort\", value] on SmithersClaudeCodeAgent; the template is excluded from the package tsconfig.json (.tsx pattern), so extraArgs validity is only caught at generated-project compile time.
  • New unit test in config.test.ts and updated integration assertion in runtime.test.ts cover both the agent-only and agent-plus-model override paths.

Confidence Score: 4/5

Safe to merge; the logic change is small and well-scoped, and all stated validation steps (build, lint, tests, CI) reportedly pass.

The reasoning-clear fix in applyDefaultProfileOverrides is straightforward and the test coverage is good, but the new test in config.test.ts omits a pre-condition assertion — it checks that reasoning is null after the override without first confirming it was set, so a future regression that removes the clearing logic would go undetected. The extraArgs forwarding in the Claude template is also untested against real smithers-orchestrator types (templates are excluded from the tsconfig), leaving that integration unverified at the package level.

packages/config/test/config.test.ts — the new test case should assert the pre-condition; packages/runtime/src/templates/smithers/agents/claude.tsx — extraArgs validity is not type-checked in this repo.

Important Files Changed

Filename Overview
packages/config/src/model-profiles.ts Separates model and reasoning clearing logic so reasoning is always deleted on any agent switch, while model is only deleted when no explicit replacement is provided.
packages/runtime/src/templates/smithers/agents/claude.tsx Removes the 'accepted and ignored' comment for reasoningEffort and wires it to ClaudeCodeAgent via extraArgs: ['--effort', value]; template is not type-checked against smithers-orchestrator since .tsx files are excluded from the tsconfig, so extraArgs validity is only caught at user-project compile time.
packages/config/test/config.test.ts Adds two new test cases for the agent-switch reasoning-clear fix; missing an explicit pre-condition assertion (that reasoning was non-null before the override).
packages/runtime/test/runtime.test.ts Extends existing agent-switch test to assert reasoningEffort is null after switching, and adds a template text-match assertion for the new --effort extraArgs pattern.
ultrafuzz.toml Updates the comment on the [models.claude] profile to reflect that ClaudeAgent now forwards reasoning via --effort.
docs/cli.md Documentation updated to accurately describe new reasoning-clearing semantics for --agent and --model overrides.
docs/reference/cli.md Reference docs updated to match; no blank line between the revised paragraph and the --max-concurrency description (pre-existing issue, not new).
docs/config.md Updates the ClaudeAgent reasoning section to document --effort passthrough instead of documenting it as a no-op.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["CLI: --agent / --model flags"] --> B{applyDefaultProfileOverrides}
    B --> C{agent override provided AND differs from profile.agent?}
    C -- No --> F[Profile unchanged, reasoning preserved]
    C -- Yes --> D{model override also provided?}
    D -- No --> E["delete profile.model\ndelete profile.reasoning"]
    D -- Yes --> G["delete profile.reasoning\nprofile.model = overrides.model"]
    E --> H[profile.agent = overrides.agent]
    G --> H
    F --> I{model override provided?}
    I -- Yes --> J[profile.model = overrides.model]
    I -- No --> K[Done]
    H --> K
    J --> K
    K --> L[Task spec: reasoningEffort = profile.reasoning ?? null]
    L --> M{reasoningEffort null?}
    M -- Yes --> N[Agent created without effort arg]
    M -- No --> O["ClaudeAgent: extraArgs: ['--effort', value]\nCodexAgent: config.model_reasoning_effort = value"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["CLI: --agent / --model flags"] --> B{applyDefaultProfileOverrides}
    B --> C{agent override provided AND differs from profile.agent?}
    C -- No --> F[Profile unchanged, reasoning preserved]
    C -- Yes --> D{model override also provided?}
    D -- No --> E["delete profile.model\ndelete profile.reasoning"]
    D -- Yes --> G["delete profile.reasoning\nprofile.model = overrides.model"]
    E --> H[profile.agent = overrides.agent]
    G --> H
    F --> I{model override provided?}
    I -- Yes --> J[profile.model = overrides.model]
    I -- No --> K[Done]
    H --> K
    J --> K
    K --> L[Task spec: reasoningEffort = profile.reasoning ?? null]
    L --> M{reasoningEffort null?}
    M -- Yes --> N[Agent created without effort arg]
    M -- No --> O["ClaudeAgent: extraArgs: ['--effort', value]\nCodexAgent: config.model_reasoning_effort = value"]
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/config/test/config.test.ts:242-262
**Missing pre-condition assertion weakens the regression test**

The test verifies that `reasoning` is `null` after the override but never asserts that it was non-null beforehand. If the default profile in `ultrafuzz.toml` ever loses its `reasoning = "xhigh"` entry, the test would still pass while silently proving nothing — the clearing logic could be deleted and every expectation would continue to hold. Adding an assertion before the `applyDefaultProfileOverrides` call would make the pre-condition explicit and keep the test honest as an invariant check.

Reviews (1): Last reviewed commit: "Fix Claude reasoning overrides" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Comment on lines +242 to +262
it("clears default reasoning whenever an agent override switches agents", () => {
const agentOnly = resolveConfig({ env: {} });
expect(agentOnly.ok).toBe(true);
if (!agentOnly.ok) return;
applyDefaultProfileOverrides(agentOnly.value, { agent: "ClaudeAgent" });
expect(agentOnly.value.models.profiles.default).toMatchObject({
agent: "ClaudeAgent"
});
expect(agentOnly.value.models.profiles.default?.model ?? null).toBeNull();
expect(agentOnly.value.models.profiles.default?.reasoning ?? null).toBeNull();

const pinned = resolveConfig({ env: {} });
expect(pinned.ok).toBe(true);
if (!pinned.ok) return;
applyDefaultProfileOverrides(pinned.value, { agent: "ClaudeAgent", model: "claude-sonnet-5" });
expect(pinned.value.models.profiles.default).toMatchObject({
agent: "ClaudeAgent",
model: "claude-sonnet-5"
});
expect(pinned.value.models.profiles.default?.reasoning ?? null).toBeNull();
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Missing pre-condition assertion weakens the regression test

The test verifies that reasoning is null after the override but never asserts that it was non-null beforehand. If the default profile in ultrafuzz.toml ever loses its reasoning = "xhigh" entry, the test would still pass while silently proving nothing — the clearing logic could be deleted and every expectation would continue to hold. Adding an assertion before the applyDefaultProfileOverrides call would make the pre-condition explicit and keep the test honest as an invariant check.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/config/test/config.test.ts
Line: 242-262

Comment:
**Missing pre-condition assertion weakens the regression test**

The test verifies that `reasoning` is `null` after the override but never asserts that it was non-null beforehand. If the default profile in `ultrafuzz.toml` ever loses its `reasoning = "xhigh"` entry, the test would still pass while silently proving nothing — the clearing logic could be deleted and every expectation would continue to hold. Adding an assertion before the `applyDefaultProfileOverrides` call would make the pre-condition explicit and keep the test honest as an invariant check.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

@aviggiano
aviggiano merged commit 0feac13 into main Jul 17, 2026
9 checks passed
@aviggiano
aviggiano deleted the codex/fix-claude-agent-effort branch July 17, 2026 11:45
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.

1 participant