Skip to content

[OMEGA-350] reasoning takes the whole token budget - #337

Draft
paul-v-snet wants to merge 4 commits into
mainfrom
OMEGA-350-openrouter-reasoning-takes-the-whole-token-budget-glm-comes-back-empty
Draft

[OMEGA-350] reasoning takes the whole token budget#337
paul-v-snet wants to merge 4 commits into
mainfrom
OMEGA-350-openrouter-reasoning-takes-the-whole-token-budget-glm-comes-back-empty

Conversation

@paul-v-snet

Copy link
Copy Markdown
Collaborator

Description

Draft fix implementing my proposal.

Research showed GLM-5.2 has no numeric reasoning budget, only effort tiers, and medium (Omega's default) already maps to the lowest non-zero tier (high), so it can't be lowered further without turning reasoning off entirely. The real remaining bug is that finish_reason=length with empty content was silently swallowed

This PR implements option 1 from the discussion: don't retry, just tell the user what happened.

Changes:

  • providers/openrouter.py: fix the reasoning config so OpenRouter-Anthropic routes still get a numeric reasoning.max_tokens budget, while other routes (GLM-5.2 included) send reasoning.effort instead, since max_tokens on those routes was only ever being translated into an effort tier anyway.
  • providers/lib_llm_ext.py: log actual token usage per completion (finish_reason, completion_tokens, reasoning_tokens) so this is visible without guessing; when content comes back empty, return an explanatory (send ...) message instead of silence, so the user sees why nothing came back instead of the request looking ignored.

Open questions from the discussion still apply: whether this should be configurable and whether MeTTaClaw2 already covers this.

How Has This Been Tested?

  • Reproduced the original bug.
  • Forced a low max_tokens to trigger the same empty-content path and confirmed the user now receives the (send ...) explanatory message instead of silence.
  • Ran a normal completion against an anthropic/* OpenRouter route to confirm reasoning.max_tokens is still sent correctly there.
  • Ran a normal completion against z-ai/glm-5.2 to confirm reasoning.effort is sent and a real answer still comes back.

Checklist

  • PR contains autogenerated code
  • Self-review completed
  • Test scenarios above are passed with the version of the code from PR

…and fall back to a send command on empty replies
@paul-v-snet
paul-v-snet requested a review from vsbogd September 3, 2026 14:17
@paul-v-snet paul-v-snet added the fix label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant