fix(rules): bound structured history inputs - #48
Open
Hiro-Chiba wants to merge 1 commit into
Open
Conversation
Hiro-Chiba
marked this pull request as ready for review
July 18, 2026 11:58
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.
What
This is a small fix for structured tool inputs bypassing
enforceTdd's existingmaxContentCharshistory limit.trimHistorynow formats a structured input once and applies the same head-and-tail clipping used for prompts and tool output. Inputs already within the limit keep their original value and object identity.Does applying the existing per-field limit to tool input match the intended meaning of
maxContentChars?Why
The option bounded prompt text and action output, but an Edit or Write input containing a large file body was still serialized in full when the recent history block was built.
In a local check, a structured input whose JSON representation was 150,014 characters produced a complete 7,909-character validator prompt with
maxContentChars: 1000and retained the explicit truncation marker.Verification
npm run checks