Summary
gpt_oss.generate documents --limit 0 as unlimited and uses 0 as the CLI default, but main() converts that sentinel to None before calling the selected token generator:
max_tokens = None if args.limit == 0 else args.limit
...
generator.generate(..., max_tokens=max_tokens, ...)
All three reference token generators define max_tokens: int = 0. Torch and Triton implement unlimited generation with:
while max_tokens == 0 or num_generated_tokens < max_tokens:
so passing None makes the first comparison false and then attempts num_generated_tokens < None, which raises TypeError. The vLLM generator also expects the integer 0 sentinel and converts it to None internally for vLLM.
Impact
The default gpt_oss.generate limit value can break the Torch and Triton generation backends instead of disabling the token limit as documented.
Proposed resolution
Pass the CLI's integer limit through unchanged. A value of 0 should reach each backend as 0 so every generator can apply its own documented unlimited behavior.
Add a regression around main() with a stub generator verifying the default/unlimited path passes max_tokens=0.
Summary
gpt_oss.generatedocuments--limit 0as unlimited and uses 0 as the CLI default, butmain()converts that sentinel toNonebefore calling the selected token generator:All three reference token generators define
max_tokens: int = 0. Torch and Triton implement unlimited generation with:so passing
Nonemakes the first comparison false and then attemptsnum_generated_tokens < None, which raisesTypeError. The vLLM generator also expects the integer 0 sentinel and converts it toNoneinternally for vLLM.Impact
The default
gpt_oss.generatelimit value can break the Torch and Triton generation backends instead of disabling the token limit as documented.Proposed resolution
Pass the CLI's integer limit through unchanged. A value of 0 should reach each backend as 0 so every generator can apply its own documented unlimited behavior.
Add a regression around
main()with a stub generator verifying the default/unlimited path passesmax_tokens=0.