Repository navigation
docs(openclaw): recommend setting context_window - #4547
Merged
Merged
Conversation
Signed-off-by: Abhishree <[email protected]>
Contributor
Author
|
/ok to test 4276d40 |
yaoyu-33
approved these changes
Oct 12, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38322542872 |
This branch was previously deployed
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.
What does this PR do?
README only. Tells OpenClaw users to set
context_windowto the model server's maximum context length, and explains how OpenClaw uses it andmax_output_tokens. Follow-up to #4476, which lets sandbox sessions usemax_output_tokens; there is no issue.Why: when
context_windowis unset, OpenClaw assumes 200,000 tokens. On a server with a smaller limit, it keeps requesting its full output limit and does not compact in time, so long episodes can send requests the server rejects. Gym'svllm_modelreturns an empty reply, not an error, by default, and the run ends early.Example, worked out from the code and not measured in a run: released vLLM (up to 0.31) rejects a call when prompt + requested output >
max_model_len. At 131,072 with nocontext_window, calls fail once the prompt passes 122,880 tokens (131,072 − 8,192 default), or 98,304 withmax_output_tokens: 32768(131,072 − 32,768). Withcontext_window: 131072, OpenClaw lowers each call's output to fit the room left by its estimate of the input; the estimate can undercount code or JSON. Unreleased vLLM main (vllm-project/vllm#57035) lowers the output instead of rejecting, but still rejects a prompt longer thanmax_model_len.The sandbox section now also says that the request field is rejected but the agent config field applies, and that a
max_output_tokensabovecontext_windowis rejected (the check from #4476).Validation
configs/openclaw_agent.yaml) and at 2026.6.35 (the pin in feat(rollout): add multi-harness fan-out training #4082). Both match the README:contextWindowdefaults to 200,000 andmaxTokensto min(8,192,contextWindow) (dist/io-*.js);maxTokens,contextWindow− estimated input − 1), where the estimate is characters / 4 × 1.25. This applies to any base URL other than OpenAI's or Azure OpenAI's, which covers Gym's model server (dist/openai-transport-stream-*.js);contextWindow. One is the context guard: once a run passes its limit, OpenClaw compacts and retries (installToolResultContextGuardindist/selection-*.js). The other is the cap on each tool result's size (resolveLiveToolResultMaxCharsindist/tool-result-truncation-*.js)._build_openclaw_configwritescontextWindowandmaxTokensonly when they are set, andvllm_modelreturns an emptylengthcompletion on a context-length error unlesspropagate_context_overflow_errorsis true.git merge-treeshows this PR adds no conflicts with any of them.pre-commit run --all-files: passed.Rollouts
N/A: README-only change, with no code or config changes.
Compatibility and benchmark impact
None from this PR. Following the advice can change rollouts with long episodes or long tool results, because
context_windowalso sets when OpenClaw compacts and how much of a tool result it keeps.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).