Skip to content

olmo_core: accept uncapped max_tokens in the request trace - #319

Merged
abhishekraok merged 3 commits into
mainfrom
fix/olmo-core-uncapped-max-tokens
Aug 27, 2026
Merged

abhishekraok merged 3 commits into
mainfrom
fix/olmo-core-uncapped-max-tokens

Conversation

@abhishekraok

Copy link
Copy Markdown
Collaborator

OlmoCoreProvider._build_generation_kwargs rejects max_tokens <= 0, which raises TypeError: '<=' not supported between instances of 'NoneType' and 'int' when max_tokens is None.

The generation path never hit this — generate() calls _resolve_max_tokens() first, which replaces None with the room left in the context. But describe_request() builds the same kwargs without resolving, and runners/asynq/processing.py traces every request before generation. So any task using max_tokens=None fails on this provider before inference starts.

That affects the three migrated post-training tasks in flight — #307 popqa:chat, #308 omega_500, #309 gpqa_*:cot — all of which use max_tokens=None (generate to the model's context limit) to avoid the fixed-131k footgun in #310. They ran fine on vllm_server, which is why this wasn't caught by the parity runs.

None now passes the guard; a concrete non-positive limit is still rejected.

Regression test added: describe_request with SamplingParams(max_tokens=None) on the existing fake-provider fixture. Verified it raises TypeError at olmo_core.py:384 without the fix. Full suite 1958 passed, ruff/ty clean.

Reported by Codex review on #308.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LMFjgUqHjQA3aCeB4QmEHZ

`_build_generation_kwargs` rejected `max_tokens <= 0`, which raises
TypeError when max_tokens is None. The generation path never hit this —
it calls `_resolve_max_tokens` first — but `describe_request` builds the
same kwargs without resolving, and the async runner traces every request
before generation. Any task using `max_tokens=None` (generate to the
context limit) therefore failed on this provider before inference.

None now passes the guard; a concrete non-positive limit is still
rejected.

Reported by Codex review on #308.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LMFjgUqHjQA3aCeB4QmEHZ
@abhishekraok
abhishekraok requested a review from undfined August 25, 2026 19:52

@undfined undfined left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@abhishekraok
abhishekraok merged commit 496f034 into main Aug 27, 2026
10 checks passed
@abhishekraok
abhishekraok deleted the fix/olmo-core-uncapped-max-tokens branch August 27, 2026 17:37
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.

2 participants