Repository navigation
harbor: let pi ask for more than 16384 output tokens - #1781
Merged
Merged
Conversation
InterceptPi's models.json named the model and nothing else, so pi capped every call at its own default of 16384 output tokens, below a deployment's --max-output-tokens. A thinking model's turn then stopped mid-reasoning. models.json now sets maxTokens (32768, or intercept_config["max_tokens"]). The capture proxy still clamps every request to its own cap, so nothing changes where that cap is lower. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
The docs for this pull request are available at https://openenv.github.io/OpenEnv/pr-preview/pr-1781/ (commit d325556). The preview may take a minute to update and is removed when the pull request closes. |
…igher Above PI_MAX_TOKENS (or with no cap) pi still asks for PI_MAX_TOKENS, so the proxy's cap is not what applies there; the lower of the two is. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InterceptPiwrites amodels.jsonthat names the model and nothing else. For a model pi's catalog doesn't know, pi then caps every call at its own default of 16384 output tokens, whatever the deployment's--max-output-tokensis.models.jsonnow setsmaxTokens, so the capture proxy's cap is the one that applies.Type of Change
What happened without it
pi on Terminal-Bench (base model with thinking on, proxy cap above 16384): 17 of 89 rollouts ended on a turn of almost exactly 16384 tokens, cut off mid-reasoning, and all 17 failed.
Changes
install_fixes.py:build_models_json(..., max_tokens=PI_MAX_TOKENS)writes"maxTokens"on the model (PI_MAX_TOKENS = 32768).InterceptPitakes an optionalmax_tokensinintercept_configto change it.--max-output-tokens(clamp_output_tokens). With the default cap of 8192, requests are clamped to 8192 as before.Test Plan
tests/envs/test_harbor_pi_max_tokens.py: the defaultmodels.jsonhasmaxTokens, andInterceptPi.setupwrites the default or the configuredmax_tokens.40 passed.
ruff format --check,ruff checkandusort checkare clean.Used in production as a runtime patch (
maxTokens: 32768) for pi GRPO training and Terminal-Bench evals.RFC Status
🤖 Generated with Claude Code
Note
Low Risk
Scoped Harbor/pi config wiring with tests; no auth or shared proxy logic changes beyond requesting a higher output token ceiling when allowed.
Overview
Fixes pi (Terminal-Bench / Harbor) cutting thinking rollouts at 16384 output tokens when the model isn’t in pi’s catalog.
build_models_jsonnow writesmaxTokenson the custom provider model (defaultPI_MAX_TOKENS = 32768), andInterceptPi.setuphonors an optionalmax_tokensinintercept_config.Behavior elsewhere is unchanged: the capture proxy still clamps to
--max-output-tokens, so the effective limit remains the lower of pi’s request and the deployment cap.Adds
tests/envs/test_harbor_pi_max_tokens.pyfor default and configured limits in the writtenmodels.json.Reviewed by Cursor Bugbot for commit d325556. Bugbot is set up for automated code reviews on this repo. Configure here.