Skip to content

fix(reka): floor reka-flash-3 output budget so always-on reasoning can't empty content - #13199

Closed
hummern wants to merge 5 commits into
cheaper-inference:release/v3.8.51from
turbolego:fix/reka-flash-reasoning-budget
Closed

hummern wants to merge 5 commits into
cheaper-inference:release/v3.8.51from
turbolego:fix/reka-flash-reasoning-budget

Conversation

@hummern

@hummern hummern commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #13198. reka-flash-3 always runs a reasoning phase, so a caller-set undersized max_tokens (e.g. 256) is consumed entirely by reasoning_content and the upstream returns empty content with finish_reason: length. A transparent OpenAI-compatible proxy forwards that reasoning-only, empty-content response to the client, which can surface as huge garbage output (e.g. Hermes Agent's forwarded reasoning onto Telegram).

ensureThinkingBudget() (#6912) already floors undersized budgets for reasoning models, but it only fired when the client explicitly opted into reasoning. reka-flash-3 reasons unconditionally.

Change

  • Add RegistryModel.alwaysReasons (boolean): true when an upstream always reasons regardless of client opt-in. Set it on reka-flash-3.
  • DefaultExecutor.ensureThinkingBudget() treats alwaysReasons === true as implicit reasoning opt-in, so a tiny caller max_tokens gets the 4096 floor.
  • Regression tests (verified to fail without the fix).

Repro → fixed

max_tokens=256  → content:'', finish_reason:length          (before)
max_tokens=4096 → content:'TELEGRAM_TEST_123', finish_reason:stop  (after)

Tests

  • tests/unit/clinepass-thinking-budget.test.ts — 9/9 pass; the new alwaysReasons cases fail without the fix (sabotage-verified).
  • tests/unit/provider-models-config.test.ts — 12/12 pass.
  • tests/unit/provider-models-route.test.ts — 59/59 pass.
  • npx tsc --noEmit -p tsconfig.typecheck-core.json — clean (exit 0).
  • Pre-commit hooks (prettier, eslint, any-budget, quality gates) passed.

Related

Reviewer note

The two eslint errors in the touched files (shared.ts:791, default.ts:5) are pre-existing baseline warnings on lines I did not modify, not introduced by this diff.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

The alwaysReasons floor for reka-flash-3 is a clean, well-tested fix (9/9 passing, good
coverage of the non-clinepass and non-regression cases). One thing to flag before merge:
your branch carries an unrelated commit (c70e425, "Change hasFree from true to false for
pioneer.ai") that touches frontier-labs.ts — nothing to do with reka-flash, and it looks
stale against the current Pioneer AI notice text on the tip. Could you drop that commit (or
rebase it out)? If the Pioneer AI free-tier change is still accurate, happy to see it as its
own small PR with a current source.

@hummern
hummern force-pushed the fix/reka-flash-reasoning-budget branch from ec5a26c to 2fa8787 Compare September 15, 2026 14:32
@hummern

hummern commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing this PR — the alwaysReasons floor for reka-flash-3 was already merged upstream via #13531 (2d1a281), and the unrelated pioneer.ai commit (c70e425) has also landed in release/v3.8.51. The branch is now rebased clean against the current tip. Thanks for the review feedback!

@hummern

hummern commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Superseded — fix already merged via #13531.

@hummern hummern closed this Sep 15, 2026
@hummern
hummern deleted the fix/reka-flash-reasoning-budget branch October 29, 2026 12:51
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.

fix(providers): reka-flash-3 always-on reasoning burns tiny max_tokens, returns empty content (finish_reason:length)

3 participants