mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-06 08:18:58 +00:00
parent
581c211101
commit
052e9ee040
5 changed files with 151 additions and 7 deletions
|
|
@ -1,14 +1,16 @@
|
|||
{
|
||||
"timestamp": "2026-03-20T01:33:22.908648Z",
|
||||
"current_node": "preflight_lint",
|
||||
"timestamp": "2026-03-20T01:35:38.178802Z",
|
||||
"current_node": "implement",
|
||||
"completed_nodes": [
|
||||
"start",
|
||||
"toolchain",
|
||||
"preflight_compile",
|
||||
"preflight_lint"
|
||||
"preflight_lint",
|
||||
"implement"
|
||||
],
|
||||
"node_retries": {
|
||||
"preflight_lint": 1,
|
||||
"implement": 1,
|
||||
"preflight_compile": 1,
|
||||
"start": 1,
|
||||
"toolchain": 1
|
||||
|
|
@ -16,16 +18,21 @@
|
|||
"context_values": {
|
||||
"internal.node_visit_count": 1,
|
||||
"thread.preflight_compile.current_node": "preflight_lint",
|
||||
"internal.retry_count.implement": 1,
|
||||
"graph.goal": "# Plan: Map `reasoning_effort` to Anthropic `output_config.effort`\n\n## Context\n\nThe Anthropic Messages API now supports `output_config: { effort: \"low\" | \"medium\" | \"high\" | \"max\" }` as the recommended way to control thinking depth for Claude Opus 4.6 and Sonnet 4.6 (replacing deprecated `budget_tokens`). Fabro's unified `Request` already carries `reasoning_effort: Option<String>` and workflow nodes default it to `\"high\"`, but the Anthropic provider silently drops this field — it never appears in the API request. The OpenAI provider correctly maps it to `reasoning: { effort }`, but the Anthropic provider has no equivalent.\n\n## Single file to modify\n\n`lib/crates/fabro-llm/src/providers/anthropic.rs`\n\n## Step 1: Add failing tests\n\nAdd tests at the end of the `#[cfg(test)] mod tests` block (before line 2043's `}`). These tests reference a new `output_config` field on `ApiRequest` that doesn't exist yet, so they won't compile until Step 2.\n\n**Test A** — `build_api_request_maps_reasoning_effort_to_output_config`: Build a `Request` with `reasoning_effort: Some(\"medium\")`, call `build_api_request`, assert `api_request.output_config == Some(json!({\"effort\": \"medium\"}))`. Pattern: follows existing `build_api_request_omits_whitespace_only_system_prompt` test (line 1592).\n\n**Test B** — `build_api_request_omits_output_config_when_no_reasoning_effort`: Same but with `reasoning_effort: None`, assert `api_request.output_config.is_none()`.\n\n## Step 2: Add `output_config` field to `ApiRequest` struct\n\nAt line 108 (after `thinking`), add:\n\n```rust\n#[serde(skip_serializing_if = \"Option::is_none\")]\noutput_config: Option<serde_json::Value>,\n```\n\nUpdate every existing `ApiRequest` construction to include `output_config: None`:\n- line 1566 (serialization test)\n- line 1962 (merge_provider_options test)\n- line 1993 (merge_provider_options test)\n\nAt this point: code compiles, Test B passes, **Test A fails** (proving the bug exists).\n\n## Step 3: Map `reasoning_effort` → `output_config` in `build_api_request`\n\nAt line 1073 (next to the `thinking` extraction), add:\n\n```rust\nlet output_config = request\n .reasoning_effort\n .as_ref()\n .map(|effort| serde_json::json!({\"effort\": effort}));\n```\n\nAdd `output_config,` to the `ApiRequest` construction at line 1075.\n\nThis mirrors the OpenAI provider pattern at `openai.rs:385-388`.\n\nAll tests pass.\n\n## Verification\n\n```sh\ncargo test -p fabro-llm -- anthropic::tests::build_api_request_maps_reasoning_effort\ncargo test -p fabro-llm -- anthropic::tests::build_api_request_omits_output_config\ncargo test -p fabro-llm # all provider tests still pass\ncargo clippy --workspace -- -D warnings\n```\n",
|
||||
"internal.thread_id": "preflight_compile",
|
||||
"internal.thread_id": "preflight_lint",
|
||||
"internal.retry_count.preflight_compile": 1,
|
||||
"internal.retry_count.start": 1,
|
||||
"thread.start.current_node": "toolchain",
|
||||
"last_stage": "implement",
|
||||
"thread.toolchain.current_node": "preflight_compile",
|
||||
"current.preamble": "Goal: # Plan: Map `reasoning_effort` to Anthropic `output_config.effort`\n\n## Context\n\nThe Anthropic Messages API now supports `output_config: { effort: \"low\" | \"medium\" | \"high\" | \"max\" }` as the recommended way to control thinking depth for Claude Opus 4.6 and Sonnet 4.6 (replacing deprecated `budget_tokens`). Fabro's unified `Request` already carries `reasoning_effort: Option<String>` and workflow nodes default it to `\"high\"`, but the Anthropic provider silently drops this field — it never appears in the API request. The OpenAI provider correctly maps it to `reasoning: { effort }`, but the Anthropic provider has no equivalent.\n\n## Single file to modify\n\n`lib/crates/fabro-llm/src/providers/anthropic.rs`\n\n## Step 1: Add failing tests\n\nAdd tests at the end of the `#[cfg(test)] mod tests` block (before line 2043's `}`). These tests reference a new `output_config` field on `ApiRequest` that doesn't exist yet, so they won't compile until Step 2.\n\n**Test A** — `build_api_request_maps_reasoning_effort_to_output_config`: Build a `Request` with `reasoning_effort: Some(\"medium\")`, call `build_api_request`, assert `api_request.output_config == Some(json!({\"effort\": \"medium\"}))`. Pattern: follows existing `build_api_request_omits_whitespace_only_system_prompt` test (line 1592).\n\n**Test B** — `build_api_request_omits_output_config_when_no_reasoning_effort`: Same but with `reasoning_effort: None`, assert `api_request.output_config.is_none()`.\n\n## Step 2: Add `output_config` field to `ApiRequest` struct\n\nAt line 108 (after `thinking`), add:\n\n```rust\n#[serde(skip_serializing_if = \"Option::is_none\")]\noutput_config: Option<serde_json::Value>,\n```\n\nUpdate every existing `ApiRequest` construction to include `output_config: None`:\n- line 1566 (serialization test)\n- line 1962 (merge_provider_options test)\n- line 1993 (merge_provider_options test)\n\nAt this point: code compiles, Test B passes, **Test A fails** (proving the bug exists).\n\n## Step 3: Map `reasoning_effort` → `output_config` in `build_api_request`\n\nAt line 1073 (next to the `thinking` extraction), add:\n\n```rust\nlet output_config = request\n .reasoning_effort\n .as_ref()\n .map(|effort| serde_json::json!({\"effort\": effort}));\n```\n\nAdd `output_config,` to the `ApiRequest` construction at line 1075.\n\nThis mirrors the OpenAI provider pattern at `openai.rs:385-388`.\n\nAll tests pass.\n\n## Verification\n\n```sh\ncargo test -p fabro-llm -- anthropic::tests::build_api_request_maps_reasoning_effort\ncargo test -p fabro-llm -- anthropic::tests::build_api_request_omits_output_config\ncargo test -p fabro-llm # all provider tests still pass\ncargo clippy --workspace -- -D warnings\n```\n\n\n## Completed stages\n- **toolchain**: success\n - 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`\n - Stdout:\n ```\n cargo 1.94.0 (85eff7c80 2026-01-15)\n ```\n - Stderr: (empty)\n- **preflight_compile**: success\n - Script: `cargo check -q --workspace 2>&1`\n - Stdout: (empty)\n - Stderr: (empty)\n",
|
||||
"current.preamble": "Goal: # Plan: Map `reasoning_effort` to Anthropic `output_config.effort`\n\n## Context\n\nThe Anthropic Messages API now supports `output_config: { effort: \"low\" | \"medium\" | \"high\" | \"max\" }` as the recommended way to control thinking depth for Claude Opus 4.6 and Sonnet 4.6 (replacing deprecated `budget_tokens`). Fabro's unified `Request` already carries `reasoning_effort: Option<String>` and workflow nodes default it to `\"high\"`, but the Anthropic provider silently drops this field — it never appears in the API request. The OpenAI provider correctly maps it to `reasoning: { effort }`, but the Anthropic provider has no equivalent.\n\n## Single file to modify\n\n`lib/crates/fabro-llm/src/providers/anthropic.rs`\n\n## Step 1: Add failing tests\n\nAdd tests at the end of the `#[cfg(test)] mod tests` block (before line 2043's `}`). These tests reference a new `output_config` field on `ApiRequest` that doesn't exist yet, so they won't compile until Step 2.\n\n**Test A** — `build_api_request_maps_reasoning_effort_to_output_config`: Build a `Request` with `reasoning_effort: Some(\"medium\")`, call `build_api_request`, assert `api_request.output_config == Some(json!({\"effort\": \"medium\"}))`. Pattern: follows existing `build_api_request_omits_whitespace_only_system_prompt` test (line 1592).\n\n**Test B** — `build_api_request_omits_output_config_when_no_reasoning_effort`: Same but with `reasoning_effort: None`, assert `api_request.output_config.is_none()`.\n\n## Step 2: Add `output_config` field to `ApiRequest` struct\n\nAt line 108 (after `thinking`), add:\n\n```rust\n#[serde(skip_serializing_if = \"Option::is_none\")]\noutput_config: Option<serde_json::Value>,\n```\n\nUpdate every existing `ApiRequest` construction to include `output_config: None`:\n- line 1566 (serialization test)\n- line 1962 (merge_provider_options test)\n- line 1993 (merge_provider_options test)\n\nAt this point: code compiles, Test B passes, **Test A fails** (proving the bug exists).\n\n## Step 3: Map `reasoning_effort` → `output_config` in `build_api_request`\n\nAt line 1073 (next to the `thinking` extraction), add:\n\n```rust\nlet output_config = request\n .reasoning_effort\n .as_ref()\n .map(|effort| serde_json::json!({\"effort\": effort}));\n```\n\nAdd `output_config,` to the `ApiRequest` construction at line 1075.\n\nThis mirrors the OpenAI provider pattern at `openai.rs:385-388`.\n\nAll tests pass.\n\n## Verification\n\n```sh\ncargo test -p fabro-llm -- anthropic::tests::build_api_request_maps_reasoning_effort\ncargo test -p fabro-llm -- anthropic::tests::build_api_request_omits_output_config\ncargo test -p fabro-llm # all provider tests still pass\ncargo clippy --workspace -- -D warnings\n```\n\n\n## Completed stages\n- **toolchain**: success\n - 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`\n - Stdout:\n ```\n cargo 1.94.0 (85eff7c80 2026-01-15)\n ```\n - Stderr: (empty)\n- **preflight_compile**: success\n - Script: `cargo check -q --workspace 2>&1`\n - Stdout: (empty)\n - Stderr: (empty)\n- **preflight_lint**: success\n - Script: `cargo clippy -q --workspace -- -D warnings 2>&1`\n - Stdout: (empty)\n - Stderr: (empty)\n",
|
||||
"response.implement": "All 390 tests pass and clippy is clean with zero warnings.\n\nHere's a summary of the changes made to `lib/crates/fabro-llm/src/providers/anthropic.rs`:\n\n1. **Added `output_config` field to `ApiRequest` struct** (after `thinking`):\n ```rust\n #[serde(skip_serializing_if = \"Option::is_none\")]\n output_config: Option<serde_json::Value>,\n ```\n\n2. **Mapped `reasoning_effort` → `output_config` in `build_api_request`** — converts `request.reasoning_effort` into `{\"effort\": \"<value>\"}` JSON, mirroring how the OpenAI provider maps this field:\n ```rust\n let output_config = request\n .reasoning_effort\n .as_ref()\n .map(|effort| serde_json::json!({\"effort\": effort}));\n ```\n\n3. **Added two tests**:\n - `build_api_request_maps_reasoning_effort_to_output_config` — verifies `reasoning_effort: Some(\"medium\")` produces `output_config: Some({\"effort\": \"medium\"})`\n - `build_api_request_omits_output_config_when_no_reasoning_effort` — verifies `reasoning_effort: None` produces `output_config: None`\n\n4. **Updated all existing `ApiRequest` construction sites** in tests to include `output_config: None`.",
|
||||
"graph.model_stylesheet": "\n * { backend: api; model: claude-opus-4-6;}\n ",
|
||||
"command.stderr": "",
|
||||
"current_node": "preflight_lint",
|
||||
"thread.preflight_lint.current_node": "implement",
|
||||
"last_response": "All 390 tests pass and clippy is clean with zero warnings.\n\nHere's a summary of the changes made to `lib/crates/fabro-llm/src/providers/anthropic.rs`:\n\n1. **Added `output_config` field to `ApiRequest`",
|
||||
"current_node": "implement",
|
||||
"failure_signature": "",
|
||||
"outcome": "success",
|
||||
"command.output": "",
|
||||
|
|
@ -51,6 +58,28 @@
|
|||
"status": "success",
|
||||
"duration_ms": 0
|
||||
},
|
||||
"implement": {
|
||||
"status": "success",
|
||||
"context_updates": {
|
||||
"last_response": "All 390 tests pass and clippy is clean with zero warnings.\n\nHere's a summary of the changes made to `lib/crates/fabro-llm/src/providers/anthropic.rs`:\n\n1. **Added `output_config` field to `ApiRequest`",
|
||||
"response.implement": "All 390 tests pass and clippy is clean with zero warnings.\n\nHere's a summary of the changes made to `lib/crates/fabro-llm/src/providers/anthropic.rs`:\n\n1. **Added `output_config` field to `ApiRequest` struct** (after `thinking`):\n ```rust\n #[serde(skip_serializing_if = \"Option::is_none\")]\n output_config: Option<serde_json::Value>,\n ```\n\n2. **Mapped `reasoning_effort` → `output_config` in `build_api_request`** — converts `request.reasoning_effort` into `{\"effort\": \"<value>\"}` JSON, mirroring how the OpenAI provider maps this field:\n ```rust\n let output_config = request\n .reasoning_effort\n .as_ref()\n .map(|effort| serde_json::json!({\"effort\": effort}));\n ```\n\n3. **Added two tests**:\n - `build_api_request_maps_reasoning_effort_to_output_config` — verifies `reasoning_effort: Some(\"medium\")` produces `output_config: Some({\"effort\": \"medium\"})`\n - `build_api_request_omits_output_config_when_no_reasoning_effort` — verifies `reasoning_effort: None` produces `output_config: None`\n\n4. **Updated all existing `ApiRequest` construction sites** in tests to include `output_config: None`.",
|
||||
"last_stage": "implement"
|
||||
},
|
||||
"notes": "Stage completed: implement",
|
||||
"usage": {
|
||||
"model": "claude-opus-4-6",
|
||||
"input_tokens": 10586,
|
||||
"output_tokens": 4365,
|
||||
"cache_read_tokens": 133808,
|
||||
"cache_write_tokens": 14522,
|
||||
"reasoning_tokens": 22,
|
||||
"cost": 0.486165
|
||||
},
|
||||
"files_touched": [
|
||||
"/home/daytona/workspace/lib/crates/fabro-llm/src/providers/anthropic.rs"
|
||||
],
|
||||
"duration_ms": 133121
|
||||
},
|
||||
"preflight_lint": {
|
||||
"status": "success",
|
||||
"context_updates": {
|
||||
|
|
@ -70,11 +99,12 @@
|
|||
"duration_ms": 63
|
||||
}
|
||||
},
|
||||
"next_node_id": "implement",
|
||||
"next_node_id": "simplify_opus",
|
||||
"node_visits": {
|
||||
"toolchain": 1,
|
||||
"preflight_compile": 1,
|
||||
"preflight_lint": 1,
|
||||
"implement": 1,
|
||||
"start": 1
|
||||
}
|
||||
}
|
||||
80
nodes/implement/prompt.md
Normal file
80
nodes/implement/prompt.md
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
Goal: # Plan: Map `reasoning_effort` to Anthropic `output_config.effort`
|
||||
|
||||
## Context
|
||||
|
||||
The Anthropic Messages API now supports `output_config: { effort: "low" | "medium" | "high" | "max" }` as the recommended way to control thinking depth for Claude Opus 4.6 and Sonnet 4.6 (replacing deprecated `budget_tokens`). Fabro's unified `Request` already carries `reasoning_effort: Option<String>` and workflow nodes default it to `"high"`, but the Anthropic provider silently drops this field — it never appears in the API request. The OpenAI provider correctly maps it to `reasoning: { effort }`, but the Anthropic provider has no equivalent.
|
||||
|
||||
## Single file to modify
|
||||
|
||||
`lib/crates/fabro-llm/src/providers/anthropic.rs`
|
||||
|
||||
## Step 1: Add failing tests
|
||||
|
||||
Add tests at the end of the `#[cfg(test)] mod tests` block (before line 2043's `}`). These tests reference a new `output_config` field on `ApiRequest` that doesn't exist yet, so they won't compile until Step 2.
|
||||
|
||||
**Test A** — `build_api_request_maps_reasoning_effort_to_output_config`: Build a `Request` with `reasoning_effort: Some("medium")`, call `build_api_request`, assert `api_request.output_config == Some(json!({"effort": "medium"}))`. Pattern: follows existing `build_api_request_omits_whitespace_only_system_prompt` test (line 1592).
|
||||
|
||||
**Test B** — `build_api_request_omits_output_config_when_no_reasoning_effort`: Same but with `reasoning_effort: None`, assert `api_request.output_config.is_none()`.
|
||||
|
||||
## Step 2: Add `output_config` field to `ApiRequest` struct
|
||||
|
||||
At line 108 (after `thinking`), add:
|
||||
|
||||
```rust
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
output_config: Option<serde_json::Value>,
|
||||
```
|
||||
|
||||
Update every existing `ApiRequest` construction to include `output_config: None`:
|
||||
- line 1566 (serialization test)
|
||||
- line 1962 (merge_provider_options test)
|
||||
- line 1993 (merge_provider_options test)
|
||||
|
||||
At this point: code compiles, Test B passes, **Test A fails** (proving the bug exists).
|
||||
|
||||
## Step 3: Map `reasoning_effort` → `output_config` in `build_api_request`
|
||||
|
||||
At line 1073 (next to the `thinking` extraction), add:
|
||||
|
||||
```rust
|
||||
let output_config = request
|
||||
.reasoning_effort
|
||||
.as_ref()
|
||||
.map(|effort| serde_json::json!({"effort": effort}));
|
||||
```
|
||||
|
||||
Add `output_config,` to the `ApiRequest` construction at line 1075.
|
||||
|
||||
This mirrors the OpenAI provider pattern at `openai.rs:385-388`.
|
||||
|
||||
All tests pass.
|
||||
|
||||
## Verification
|
||||
|
||||
```sh
|
||||
cargo test -p fabro-llm -- anthropic::tests::build_api_request_maps_reasoning_effort
|
||||
cargo test -p fabro-llm -- anthropic::tests::build_api_request_omits_output_config
|
||||
cargo test -p fabro-llm # all provider tests still pass
|
||||
cargo clippy --workspace -- -D warnings
|
||||
```
|
||||
|
||||
|
||||
## Completed stages
|
||||
- **toolchain**: success
|
||||
- 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`
|
||||
- Stdout:
|
||||
```
|
||||
cargo 1.94.0 (85eff7c80 2026-01-15)
|
||||
```
|
||||
- Stderr: (empty)
|
||||
- **preflight_compile**: success
|
||||
- Script: `cargo check -q --workspace 2>&1`
|
||||
- Stdout: (empty)
|
||||
- Stderr: (empty)
|
||||
- **preflight_lint**: success
|
||||
- Script: `cargo clippy -q --workspace -- -D warnings 2>&1`
|
||||
- Stdout: (empty)
|
||||
- Stderr: (empty)
|
||||
|
||||
|
||||
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.
|
||||
5
nodes/implement/provider_used.json
Normal file
5
nodes/implement/provider_used.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"mode": "agent",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-opus-4-6"
|
||||
}
|
||||
23
nodes/implement/response.md
Normal file
23
nodes/implement/response.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
All 390 tests pass and clippy is clean with zero warnings.
|
||||
|
||||
Here's a summary of the changes made to `lib/crates/fabro-llm/src/providers/anthropic.rs`:
|
||||
|
||||
1. **Added `output_config` field to `ApiRequest` struct** (after `thinking`):
|
||||
```rust
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
output_config: Option<serde_json::Value>,
|
||||
```
|
||||
|
||||
2. **Mapped `reasoning_effort` → `output_config` in `build_api_request`** — converts `request.reasoning_effort` into `{"effort": "<value>"}` JSON, mirroring how the OpenAI provider maps this field:
|
||||
```rust
|
||||
let output_config = request
|
||||
.reasoning_effort
|
||||
.as_ref()
|
||||
.map(|effort| serde_json::json!({"effort": effort}));
|
||||
```
|
||||
|
||||
3. **Added two tests**:
|
||||
- `build_api_request_maps_reasoning_effort_to_output_config` — verifies `reasoning_effort: Some("medium")` produces `output_config: Some({"effort": "medium"})`
|
||||
- `build_api_request_omits_output_config_when_no_reasoning_effort` — verifies `reasoning_effort: None` produces `output_config: None`
|
||||
|
||||
4. **Updated all existing `ApiRequest` construction sites** in tests to include `output_config: None`.
|
||||
6
nodes/implement/status.json
Normal file
6
nodes/implement/status.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"status": "success",
|
||||
"notes": "Stage completed: implement",
|
||||
"failure_reason": null,
|
||||
"timestamp": "2026-03-20T01:35:38.178462+00:00"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue