feat: make tool output size limit configurable via GOOSE_MAX_TOOL_RESPONSE_SIZE#9256
feat: make tool output size limit configurable via GOOSE_MAX_TOOL_RESPONSE_SIZE#9256DOsinga wants to merge 1 commit into
Conversation
…PONSE_SIZE Read GOOSE_MAX_TOOL_RESPONSE_SIZE from config (same pattern as GOOSE_TOOL_CALL_CUTOFF), defaulting to the existing 200,000 character limit. Users with smaller-context models can lower this to avoid degraded performance from large tool outputs. Fixes #7027 Signed-off-by: Douwe Osinga <douwe@squareup.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f839528b3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fn large_text_threshold() -> usize { | ||
| Config::global() | ||
| .get_param::<usize>("GOOSE_MAX_TOOL_RESPONSE_SIZE") | ||
| .unwrap_or(DEFAULT_LARGE_TEXT_THRESHOLD) |
There was a problem hiding this comment.
Cache configured response-size limit
Avoid reading GOOSE_MAX_TOOL_RESPONSE_SIZE from Config on every tool result. process_tool_response runs for each tool call, and large_text_threshold() now calls Config::global().get_param(...), which falls through to config-file loading/parsing when the env var is unset. That introduces synchronous filesystem/config-deserialization work on a hot path and can add noticeable latency in tool-heavy sessions compared to the previous constant-time check.
Useful? React with 👍 / 👎.
Reads
GOOSE_MAX_TOOL_RESPONSE_SIZEfrom config, defaulting to the existing 200,000 character threshold. Users with smaller-context models can lower this to keep large tool outputs from degrading performance.Uses the same
Config::global().get_parampattern asGOOSE_TOOL_CALL_CUTOFF.Fixes #7027