Skip to content

fix(agent): parse OpenRouter output token errors#39957

Open
yinkev wants to merge 1 commit into
NousResearch:mainfrom
yinkev:fix-openrouter-output-token-parser
Open

fix(agent): parse OpenRouter output token errors#39957
yinkev wants to merge 1 commit into
NousResearch:mainfrom
yinkev:fix-openrouter-output-token-parser

Conversation

@yinkev

@yinkev yinkev commented Jun 5, 2026

Copy link
Copy Markdown

Summary

Fixes #38652

Tests

  • python -m pytest tests/test_ctx_halving_fix.py::TestParseAvailableOutputTokens::test_openrouter_nous_output_tokens_format -q -o addopts= --tb=short
    • failed before the fix with None == 236907
    • passes after the fix
  • python -m pytest tests/test_ctx_halving_fix.py -q -o addopts= --tb=short
  • python -m py_compile agent/model_metadata.py tests/test_ctx_halving_fix.py
  • ruff check agent/model_metadata.py tests/test_ctx_halving_fix.py
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/agent Core agent loop, run_agent.py, prompt builder provider/openrouter OpenRouter aggregator provider/nous Nous Research API (OAuth) labels Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P1 High — major feature broken, no workaround provider/nous Nous Research API (OAuth) provider/openrouter OpenRouter aggregator type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: parse_available_output_tokens_from_error() misses OpenRouter/Nous "in the output" format — causes infinite auto-reset loop

2 participants