You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]:TruncateArgsConfig clips tool arguments to a hardcoded 20 chars instead of maxArgLength #4203
CompactionConfig.TruncateArgsConfig documents that large tool arguments "are clipped to getMaxArgLength() characters" (CompactionConfig.java:443-444), with a default maxArgLength of 2000. But ConversationCompactor.truncateToolUseBlock clips to a
hardcoded 20 characters:
maxArgLength is only used as the "should I truncate" threshold; the kept prefix is always
20 chars. With the default config this means a 5 000-char argument is reduced to 20 chars
(not the documented 2000) — far more data loss than configured.
ConversationCompactorTruncateArgsTest enshrines the 20-char behavior
("x".repeat(20) + config.getTruncationText()), so either the Javadoc or the
implementation is wrong.
To Reproduce
var cfg = CompactionConfig.TruncateArgsConfig.builder()
.maxArgLength(2000) // default-like
.build();
// a ToolUseBlock with an input value of "x".repeat(5000) in an older (pre keep-window) message
// after compactor.truncateArgs(...): the value becomes "x".repeat(20) + truncationText
Expected
Large arguments are clipped to maxArgLength characters (per the class Javadoc), i.e.
substring(0, cfg.getMaxArgLength()); or the Javadoc should be corrected to state that only
the first 20 chars are kept.
Opened PR #4204 for this: clip tool arguments to maxArgLength instead of a hardcoded 20,
with the tests updated to assert the configured length. The getTruncationText Javadoc is
corrected accordingly. This changes behavior for arguments longer than maxArgLength
(clipped to maxArgLength rather than 20) — flagging in case you intended the 20-char prefix.
Activity
coderzhn commentedon Nov 15, 2026
Opened PR #4204 for this: clip tool arguments to
maxArgLengthinstead of a hardcoded 20,with the tests updated to assert the configured length. The
getTruncationTextJavadoc iscorrected accordingly. This changes behavior for arguments longer than
maxArgLength(clipped to
maxArgLengthrather than 20) — flagging in case you intended the 20-char prefix.