fabro/lib
brynary-fabro[bot] 4df605e561
Map reasoning_effort to Anthropic output_config.effort (#115)
This PR adds support for mapping the unified `reasoning_effort` field to
Anthropic's `output_config.effort` API parameter, which is the
recommended way to control thinking depth for Claude Opus 4.6 and Sonnet
4.6 models. Previously, the Anthropic provider silently dropped
`reasoning_effort` from requests, while the OpenAI provider already
correctly mapped it to `reasoning: { effort }`. This inconsistency meant
that workflow nodes setting `reasoning_effort: "high"` (the default) had
no effect when routing through Anthropic.

The change adds an `output_config: Option<serde_json::Value>` field to
the `ApiRequest` struct with `skip_serializing_if = "Option::is_none"`
to ensure it's omitted when not set, then populates it in
`build_api_request` by transforming `request.reasoning_effort` into
`{"effort": <value>}` — mirroring the pattern used in the OpenAI
provider. All existing `ApiRequest` constructions in tests are updated
to include `output_config: None`.

The PR also takes the opportunity to refactor the test module by
extracting a `make_base_request()` helper, which reduces boilerplate in
`build_api_request_omits_whitespace_only_system_prompt` and
`make_request_with_format` and makes the two new tests
(`build_api_request_maps_reasoning_effort_to_output_config` and
`build_api_request_omits_output_config_when_no_reasoning_effort`) easy
to read. All existing provider tests continue to pass and no new Clippy
warnings are introduced.

### Fabro Details

<details>
<summary>Ran 9 stages in 10m 28s for $1.48</summary>

| Stage | Duration | Cost | Retries |
|---|---|---|---|
| start | 0s | – | 0 |
| toolchain | 0s | – | 0 |
| preflight_compile | 1m 8s | – | 0 |
| preflight_lint | 12s | – | 0 |
| implement | 2m 13s | $0.49 | 0 |
| simplify_opus | 4m 45s | $0.99 | 0 |
| simplify_gpt | 0s | – | 0 |
| verify | 1m 40s | – | 0 |
| fmt | 1s | – | 0 |
| **Total** | **10m 28s** | **$1.48** | **0** |

</details>

<details>
<summary>Ran <code>ImplementAndSimplify.fabro</code> (12 nodes and 15
edges)</summary>

```dot
digraph ImplementAndSimplify {
    graph [
        goal="Implement and simplify",
        model_stylesheet="
            * { backend: api; model: claude-opus-4-6;}
        "
    ]
    rankdir=LR

    start [shape=Mdiamond, label="Start"]
    exit  [shape=Msquare, label="Exit"]

    toolchain         [label="Toolchain", shape=parallelogram, script="command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1", max_retries=0]
    preflight_compile [label="Preflight Compile", shape=parallelogram, script="cargo check -q --workspace 2>&1", max_retries=0]
    preflight_lint    [label="Preflight Lint", shape=parallelogram, script="cargo clippy -q --workspace -- -D warnings 2>&1", max_retries=0]
    fix_lints         [label="Fix Lints", prompt="The preflight lint step failed. Read the build output from context and fix all clippy lint warnings.", max_visits=3]
    implement         [label="Implement", prompt="Read the plan file referenced in the goal and implement every step. Make all the code changes described in the plan. Use red/green TDD."]
    simplify_opus     [label="Simplify (Opus)", prompt="@prompts/simplify.md"]
    simplify_gpt      [label="Simplify (GPT-54)", prompt="@prompts/simplify.md", model="gpt-54"]
    verify            [label="Verify", shape=parallelogram, script="cargo clippy -q --workspace -- -D warnings 2>&1 && cargo nextest run --cargo-quiet --workspace --status-level fail 2>&1", goal_gate=true, retry_target="fixup"]
    fixup             [label="Fixup", prompt="The verify step failed. Read the build output from context and fix all clippy lint warnings and test failures.", max_visits=3]
    fmt               [label="Format", shape=parallelogram, script="cargo fmt --all 2>&1", max_retries=0]

    start -> toolchain
    toolchain -> preflight_compile [condition="outcome=success"]
    toolchain -> exit
    preflight_compile -> preflight_lint [condition="outcome=success"]
    preflight_compile -> exit
    preflight_lint -> implement [condition="outcome=success"]
    preflight_lint -> fix_lints
    fix_lints -> preflight_lint
    implement -> simplify_opus -> simplify_gpt -> verify
    verify -> fmt   [condition="outcome=success"]
    verify -> fixup
    fixup -> verify
    fmt -> exit
}

```

</details>

⚒️ Generated with [Fabro](https://fabro.sh)

---------

Co-authored-by: Fabro <noreply@fabro.sh>
2026-03-19 22:49:16 -04:00
..
crates Map reasoning_effort to Anthropic output_config.effort (#115) 2026-03-19 22:49:16 -04:00
packages/fabro-api-client Designate retros as experimental, disable by default via [features] flag 2026-03-15 20:36:32 -04:00