Repository navigation
Conversation
…whole Before, every string argument over 2,000 characters was cut to its head and tail: a 100k write_file was judged on 2k of content, and a long bash script with `rm -rf` in its middle was judged without that line. A call still over 12k after that was denied. Now arguments are sent whole when they fit with_max_argument_chars (default 48,000) and the backend's token limits (check_token_limits, shared with Request::validate). A call that does not fit has its longest strings cut only as far as needed (one per-string cap, binary-searched, at least 400), and the state lists the cuts under tool_call.omitted. Full views (with_full_view(tool, json_pointer); default bash /command; without_default_full_views) are never cut: one that does not fit denies. Calls are never judged in pieces. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
…back chain An unlimited primary that failed left a fallback with smaller token limits to skip the call unsent; the gate then denied it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG
This branch has not been 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.
Why
A question about
ToolGateasked whether big writes are handed back to the user because of the 12k argument cap. They weren't — but the real edge was worse. A mock-only probe ofmain:write_file, 100k contentbash, 100k command,rm -rf ~in the middlermedit_file, 50k + 50kWhat changes
ToolGate::with_max_argument_chars(default 48,000 characters, serialized) and the decision backend's token limits.question::check_token_limitsis extracted fromRequest::validate, so the gate fits to exactly what validation would accept.with_full_view(tool, json_pointer)(a pointer to an array/object covers everything under it, RFC 6901 escaping). The built-inbashtool's/commandis a full view by default (without_default_full_viewsdrops it). A full view that doesn't fit denies without asking: "more than the gate can review in full".cdin one, anrmin the next).Behaviour change (CHANGELOG): a
bashcommand over roughly 48k characters is now denied instead of judged from its head and tail; more calls are sent whole, so large calls cost more decision-model input tokens and take longer (the 5 s timeout still applies).Tests
tests/decision_agent_test.rs: the three old long-argument tests are replaced by eight:omittedand the full content still executed;bashwithrm -rf ~in the middle: sent whole when it fits, denied unsent when it doesn't, shortened with the default dropped;src/decision/gate.rsunit tests: whole-segment matching (/command≠/commands),~0/~1escaping, longest-first cutting, and blaming the full view.cargo test --all-features(no failures), clippy--all-targets --all-features -D warnings, rustdoc-Dwarnings, wasm32 clippy withdecision,cargo fmt --check.Docs:
docs/concepts/decision-models.md(the Arguments section, What denies), CLAUDE.md, CHANGELOG.🤖 Generated with Claude Code
https://claude.ai/code/session_01T7iq5hpndSiHQcnAsywKuG