Repository navigation
fix(llm): keep a cloud model's reasoning out of gaia llm output - #6068
Conversation
`gaia llm --model fireworks.<model> "..."` printed the model's whole reasoning as a raw <think>...</think> block before the answer. The Lemonade provider wraps cloud reasoning in those tags for its consumers to separate; the agent and Agent UI strip them, `gaia llm` printed them. It now prints and returns only the answer.
|
Verdict: Approve with suggestions
One edge is worth closing. Cloud models can't have thinking switched off, and Real-world evidenceN/A: no evidence bundle was produced for this run. The PR description reports a live run, 🔍 Technical details🟡 A reasoning-only response now prints nothing ( 🟢 Streamed and non-streamed answers are trimmed differently ( 🟢 Tags split across chunks aren't handled Strengths
|
A cloud thinking model that spent the whole --max-tokens budget reasoning left gaia llm printing a blank answer with no explanation. It now exits with an error naming --max-tokens, and the streamed answer is trimmed like the non-streamed one.
|
The review's main finding is fixed. If a thinking model uses up its whole token budget on reasoning, `gaia llm` now exits with an error that tells you to raise `--max-tokens`, instead of printing a blank answer. Streamed answers also drop the blank lines left after the reasoning, the same way non-streamed answers already did. The Windows unit-test failure comes from a connectors timing test this PR doesn't touch. It's tracked in #6071. 🔍 Technical details
|
…#6073) The connectors test that checks the slot lock and file lock share one wait budget failed at random on loaded Windows runners, which blocked unrelated PRs like amd#6068. It timed the whole call against a 1.4 s ceiling, and a busy runner can blow past that with nothing wrong. It now checks the budget the file-lock wait actually gets, so runner load can't fail it, and it still fails if the two waits stop sharing a budget. Closes amd#6071 ## Test plan - [x] `python -m pytest tests/unit/connectors/ -q` passes (956 passed) - [x] `python util/lint.py --all` passes - [x] Mutation check: passing no `timeout` to the file-lock wait in `get_or_refresh` makes the test fail - [ ] Windows unit-test job passes on this PR <details> <summary>🔍 Technical details</summary> - The test wraps `_refresh_lock.held` to record the `timeout` it receives. The peer holds the slot for 0.6 s on a 1.0 s budget, so a shared budget passes at most ~0.4 s. The assertion allows up to 0.45 s for clock granularity. An unshared wait passes `None` or 1.0 and fails. - No source change. `tokens.get_or_refresh` already shares the deadline. The flake came from the wall-clock assertion, not from the code under test. - `tests/unit/` with `-x` stopped here on an unrelated collection error: `responses` isn't installed in this runner. The whole connectors suite was run instead. </details> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Kalin Ovtcharov <[email protected]>
…amd#8141) ## Summary `gaia prompt` with a thinking model now prints only the answer, instead of the model's whole `<think>...</think>` reasoning followed by the answer. A failed reply now exits 1 instead of 0. ## Why Scripts that read `gaia prompt`'s stdout got the reasoning glued to the answer. Every other surface already strips it, and `gaia llm` got the same fix in amd#6068; `gaia prompt` printed the raw stream. It now goes through the same filter as `gaia llm`, so the two commands print the same thing. If the model spends the whole token budget reasoning, `gaia prompt` now says to raise `--max-tokens`, as `gaia llm` does, instead of printing a blank line. That error, like a failed model call, used to exit 0, so a script could not tell it from an answer; it now exits 1. <details> <summary>🔍 Technical details</summary> - Reuses `_ReasoningFilter` and `_reasoning_only_error` from `gaia/apps/llm/app.py` rather than the chunk-splitting state machine sketched in the triage comment: the Lemonade provider emits `<think>` and `</think>` whole, which is what the `gaia llm` filter already relies on. - Leading blank lines after the reasoning are trimmed, matching `gaia llm`. </details> ## Linked issue Closes amd#8032 ## Changes - `gaia prompt` filters the streamed reply through the `gaia llm` reasoning filter before printing it. - `gaia prompt` exits 1 after a failed reply (model call error, or a reply that is all reasoning), as the review suggested. ## Test plan - [x] `python -m pytest tests/unit/cli/test_prompt_reasoning.py`: 3 of the 4 new tests fail on main with the `<think>` block on stdout and pass with the fix (the fourth checks a reply without reasoning prints unchanged) - [x] `test_prompt_model_call_error_exits_non_zero` and the all-reasoning test fail without the exit-code commit (exit 0) and pass with it - [x] `python -m pytest tests/unit/cli tests/unit/test_llm_app_thinking.py tests/unit/test_provider_error_surface_advice.py tests/unit/test_ctx_overflow_device_profile_2884.py` on the final branch: 698 passed, 1 skipped - [x] `python -m pytest tests/unit/ -n 8` on the first commit: 42095 passed, 9 failed. The same 8 fail on main on this machine (2 in `test_verification_scope.py`, 4 in the eval bench tests, 2 in `test_schedule_missed_runs.py`); the ninth, in `test_log_viewer.py`, passes when run on its own - [x] `python util/lint.py --all`: passes apart from two pylint errors in `utils/awake_clock.py` and `utils/terminal.py`, which come from the local pylint version (the Lint workflow passes on the same base commit) ## Evidence - [ ] **Agent exposed in the Agent UI**: N/A, CLI-only change - [ ] **MCP tools / servers**: N/A - [x] **CLI**: `gaia prompt "Reply with exactly: hello-rc24-once" --model fireworks.deepseek-v4p1-flash`, run against a local OpenAI-compatible server that streams `reasoning_content` and then `content` the way Fireworks does, so the real Lemonade provider path wraps the reasoning in `<think>` tags Before (main): ``` <think>The user wants me to reply with exactly "hello-rc24-once". This is simple. I should comply exactly.</think>hello-rc24-once ``` After (exit 0): ``` hello-rc24-once ``` After, when the stream ends while still reasoning (exit 1; was 0): ``` ❌ Error: The model spent its whole 512-token budget reasoning and returned no answer. Re-run with a larger --max-tokens (for example --max-tokens 4096). ``` - [ ] **HTTP API / REST**: N/A ## Checklist - [x] I have linked a GitHub issue above (`Closes #N` / `Fixes #N` / `Refs #N`). - [x] I have described **why** this change is being made, not just what changed. - [x] I have run linting and tests locally (`python util/lint.py --all`, `pytest tests/unit/`). - [x] I have attached **real-world evidence matched to the surface I changed** (see Evidence above), or marked each surface N/A. - [ ] I have updated documentation if user-visible behavior changed. N/A: no doc describes `gaia prompt` printing reasoning.
gaia llmwith a cloud thinking model (for example the Fireworks models GAIA recommends) printed the model's whole reasoning as a raw<think>…</think>block in front of the answer. Now it prints only the answer. The agent and the Agent UI already strip these tags;gaia llmwas the one consumer that didn't. Found while release-testing v0.25.2.Test plan
pytest tests/unit/test_llm_app_thinking.py tests/unit/test_llm.py: pass, including 3 new tests (streamed, glued-to-answer, non-streamed)gaia llm --model fireworks.deepseek-v4p1-flash "Reply with exactly: PONG"prints🤖 gaia: PONG(v0.25.2 printed<think>The user wants…</think>PONG)