-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Default toolResultMaxChars (16K) is too small for frontier models and undocumented #86746
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
agents.defaults.contextLimits.toolResultMaxCharsdefaults to 16,000 chars, which is appropriate for ~8K-context models but leaves frontier models (Claude Opus 200K, Grok 1M+, GPT-5 400K) using a tiny fraction of their context window per tool result. The knob exists and works (schema max 250,000), but it's effectively invisible:openclaw doctoroutputdocs/gateway/configuration.mdor related onboardinggatewayactionconfig.patchblocks it as a "protected config path" (only directopenclaw.jsonedit works)[... N more characters truncated]) and the user-facing version (⚠️ [... middle content omitted — showing head and tail ...]) don't hint that the cap is configurableThe result: agents and operators discover the knob only after burning context-debugging time, often by spelunking through
dist/or filing issues. This in turn drives the "Agent couldn't generate a response" symptoms reported in past issues (e.g., the now-closed #85801, where the recommended fix added the 16K cap but didn't surface its tunability).Repro / discovery friction
Operator on Claude Opus (200K context) tool-loop session:
reada 50KB strategic-report markdown file → output truncated at 16K, both head-and-tail markers shownexecreturning a 30KB config dump → truncated at 16K with[... 14000 more characters truncated]noticeopenclaw.jsonschema → finds nothing undertools.*DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS = 16e3inpi-embedded-runner/tool-result-truncation.tsand the resolver chain readingagents.defaults.contextLimits.toolResultMaxCharsgateway config.patch agents.defaults.contextLimits.toolResultMaxChars→ rejected as protected path~/.openclaw/openclaw.json, hot-reload picks it up, problem solvedTime-to-solve: ~30 min spelunking. Could be ~30 sec if discoverable.
Asks (in priority order)
Raise the default to something modern-model-aware. A flat 16K default punishes the 95% of OpenClaw users who are on frontier models. Suggested defaults:
toolResultMaxChars: 64000(still under 30% of context)3200016000This can be a calculated default in
resolveLiveToolResultMaxChars()readingcontextWindowTokens(already plumbed) rather than a static constant.Document the knob. Add to⚠️ Your model has a 200K context window but
docs/gateway/configuration.mdand toopenclaw doctoradvisory output ("toolResultMaxCharsis 16K. Consider raising it. See: …").Allow
gateway config.patchto mutate this path. It's a performance knob, not a security boundary — protected-path treatment is inappropriate. Or document why it's protected and add aconfig.patch --forcestyle override.Make the truncation marker actionable. Append a hint to the model-facing notice:
[... N more characters truncated; raise agents.defaults.contextLimits.toolResultMaxChars to keep more]. This converts a silent friction surface into self-documenting recovery.Surface as a top-level
tools.maxOutputCharsalias. The current path is buried 4 keys deep underagents.defaults.contextLimits. A top-level alias would dramatically improve discoverability for the most-likely-tuned knob.Why this matters
Frontier-model OpenClaw deployments waste both context budget and operator time on a configuration default that hasn't kept pace with model capabilities. The cost of fixing this is small (default-resolution logic + docs); the cumulative friction across the user base is substantial.
Related
gateway.webchat.toolProgressMaxChars/toolTranscriptMaxChars); orthogonal code path but same class of frictionVersion