Conversation
…always_include semantics - max_tools==0 now means no cap on LLM-selected candidates (#2294) - sanitize tool names/descriptions before prompt interpolation to prevent prompt injection from attacker-controlled MCP servers (#2297) - document that always_include tools bypass max_tools cap; cap applies only to LLM-selected candidates (#2296) Add three unit tests: max_tools_zero_means_no_cap, description_sanitization_strips_control_chars_and_caps, always_include_bypasses_max_tools_cap. Closes #2294, Closes #2297, Closes #2296
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.
Summary
max_tools == 0now means no cap on LLM-selected candidates — previously0 >= 0fired on the first iteration, returning zero candidates (fix(mcp): prune_tools max_tools == 0 should mean no cap, not zero candidates #2294)char::is_control()), cap names at 64 chars and descriptions at 200 chars — prevents prompt injection from attacker-controlled MCP servers (fix(security): sanitize MCP tool descriptions before interpolating into pruning prompt #2297)always_includetools bypass themax_toolscap;max_toolsapplies only to LLM-selected candidates (fix(mcp): clarify always_include semantics vs max_tools cap in prune_tools #2296)All three fixes are prerequisites before
prune_toolsis wired into the agent loop.Changes
crates/zeph-mcp/src/pruning.rs: three fixes + three new unit testsCHANGELOG.md: entries for fix(mcp): prune_tools max_tools == 0 should mean no cap, not zero candidates #2294, fix(mcp): clarify always_include semantics vs max_tools cap in prune_tools #2296, fix(security): sanitize MCP tool descriptions before interpolating into pruning prompt #2297Test plan
cargo +nightly fmt --check— cleancargo clippy --features full --workspace -- -D warnings— no new warningscargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 6913/6913 passedmax_tools_zero_means_no_cap,description_sanitization_strips_control_chars_and_caps,always_include_bypasses_max_tools_capchar::is_control()covers all C0/C1 controls including\n,\r,\t, null byte; whitelist on LLM-returned names remains intactCloses #2294, Closes #2297, Closes #2296