Bounded Tool Output
- Status: Todo
- Kind: Feature
- Authors: Jean Mertz git@jeanmertz.com
- Date: 2026-09-30
- Implements: 115
- Label: type=tracking
Tracking ticket for RFD 115.
Implementation plan
- Add config types for size_threshold: Introduces
SizeThreshold("unlimited"orByteSize), addssize_thresholdtoToolsDefaultsConfigandToolConfigwith the standard config trait impls, a resolver onToolConfigWithDefaults, and a validator rejecting values below"1KB". Pure config change with no behavior impact; mergeable on its own. - Let the Record barrier carry replacement content: Extends the Record barrier's reply to carry replacement content, has the execution service deliver it, and has the Host send it when a review is replaced. Covered by a service test (replacement delivered to the MCP caller) and an executor test (unattended call with a replaced review completes without a delivery mismatch); mergeable alone and a dependency for phases 3 and 4.
- Apply the configurable per-tool cap: Adds
cap_reviewand applies it whereexecute_with_promptingassemblesExecutionResult::reviews. Verified by two turn-loop integration tests (oversized result underUnattendedand underEdit) asserting the persisted response is capped within threshold and the correct notice is printed; depends on phases 1 and 2. - Enforce the batch-wide ceiling: Adds
MAX_TOOL_RESPONSE_BATCH_BYTESincommit_tool_responses, truncating the largest responses first across merged reviews and emitting a notice per truncated tool. Tested with a single response exceeding the budget undersize_threshold = "unlimited"and multiple individually-small responses that exceed the budget together; depends on phase 2. - Raise tool-local output caps: Drops or raises
MAX_EXPANDED_BYTESincargo_expandso the new centralsize_thresholdbecomes the binding limit for that tool. Small change, only meaningful after phase 3 lands. - Document the new behavior: Corrects the
InlineResultsdoc comment that incorrectly promises full delivery to the assistant, and documentssize_thresholdindocs/configuration.md.