Skip to content

fix(agents): suppress low context window warning for explicitly configured values#13986

Closed
0xRaini wants to merge 1 commit intoopenclaw:mainfrom
0xRaini:fix/suppress-context-window-warn-explicit
Closed

fix(agents): suppress low context window warning for explicitly configured values#13986
0xRaini wants to merge 1 commit intoopenclaw:mainfrom
0xRaini:fix/suppress-context-window-warn-explicit

Conversation

@0xRaini
Copy link
Contributor

@0xRaini 0xRaini commented Feb 11, 2026

Problem

When users deliberately configure a small contextWindow in their model config (e.g., 2048 for lightweight heartbeat checks with a local model), OpenClaw still emits:

warn agent/embedded low context window: ollama/qwen2.5:7b-2k ctx=2048 (warn<32000) source=modelsConfig

This is misleading — the user intentionally chose this value.

Fixes #13933

Solution

Skip shouldWarn when the context window source is explicitly configured:

  • modelsConfig — set via models.providers[].models[].contextWindow
  • agentContextTokens — set via agents.defaults.contextTokens

shouldBlock (hard minimum) is unchanged — still enforced regardless of source.

Tests

Updated existing tests + added 2 new test cases confirming:

  • Explicit modelsConfig source → no warning
  • Auto-detected model source → still warns

All 11 tests pass.

AI Disclosure

This PR was authored with AI assistance.

Greptile Overview

Greptile Summary

Suppressed low context window warnings when users explicitly configure contextWindow via models.providers[].models[].contextWindow or agents.defaults.contextTokens. The warning now only fires for auto-detected (model) or default values, preventing misleading warnings when users deliberately choose small context windows (e.g., 2048 tokens for lightweight heartbeat checks).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is focused and well-tested with 11 passing tests covering all scenarios (explicit config sources don't warn, auto-detected sources still warn). The logic is straightforward: a single boolean check prevents warnings for user-configured values while preserving shouldBlock enforcement. No breaking changes or side effects.
  • No files require special attention

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Feb 11, 2026
TWFBusiness added a commit to TWFBusiness/openclaw-tw that referenced this pull request Feb 11, 2026
…pstream fixes

- Remove Discord, Telegram, Slack, Signal, iMessage, BlueBubbles extensions
- Remove @buape/carbon, grammy, and other gateway-specific dependencies
- Add session-based login system (cookie auth, rate limiting)
- Add type stubs for optional deps (baileys, ciao, qrcode-terminal)
- Apply upstream PRs: XSS fix (openclaw#13952), orphan tool_results (openclaw#13974),
  Anthropic tool ID sanitization (openclaw#13976), BM25 score fix (openclaw#14005),
  redaction fix (openclaw#14006), subagent timeout (openclaw#13996), context window
  guard (openclaw#13986), model default reset (openclaw#13993), cache token accounting (openclaw#13853)
- Fix all TypeScript compilation errors from channel removal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…gured values

When users deliberately set a small contextWindow in their model config
(e.g., 2048 for lightweight heartbeat checks), the 'low context window'
warning is misleading noise. The warning should only fire for
auto-detected or default values, not explicit user configuration.

Skip shouldWarn when the context window source is 'modelsConfig'
(models.providers[].models[].contextWindow) or 'agentContextTokens'
(agents.defaults.contextTokens). shouldBlock is unchanged — hard
minimum still enforced regardless of source.

Fixes #13933
@0xRaini

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't warn about low context window when explicitly configured by user

1 participant