Skip to content

fix(rules): bound structured history inputs - #48

Open
Hiro-Chiba wants to merge 1 commit into
nizos:mainfrom
Hiro-Chiba:agent/bound-history-tool-inputs
Open

fix(rules): bound structured history inputs#48
Hiro-Chiba wants to merge 1 commit into
nizos:mainfrom
Hiro-Chiba:agent/bound-history-tool-inputs

Conversation

@Hiro-Chiba

Copy link
Copy Markdown
Contributor

What

This is a small fix for structured tool inputs bypassing enforceTdd's existing maxContentChars history limit.

trimHistory now 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: 1000 and retained the explicit truncation marker.

Verification

  • npm run checks
  • 58 test suites passed
  • 539 tests passed, with 26 existing skips
  • Prompt-level regression test for a large structured Edit input
  • Unit coverage for structured input JSON formatting and clipping

@Hiro-Chiba
Hiro-Chiba marked this pull request as ready for review July 18, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant