fix(context_compressor): harden tool-call previews in summaries - #12588
fix(context_compressor): harden tool-call previews in summaries#12588sauerdaniel wants to merge 1 commit into
Conversation
1a73ba3 to
dc9b309
Compare
dc9b309 to
e6435e3
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for targeting a behavior that is still present on current main: agent/context_compressor.py:1506-1510 truncates raw arguments and emits name(args), and _generate_summary() consumes that serialization at agent/context_compressor.py:1778.
Problems
- The proposed helper's dictionary branch copies keys unchanged at
agent/context_compressor.py:494in the PR.max_items,max_depth, and_shorten_string()do not bound a very long key, so a valid arguments object can still make the supposedly bounded preview arbitrarily large.
Suggested changes
- Cap/replace overlong dictionary keys and add a regression test for that case, alongside the existing long-string-value coverage.
Automated hermes-sweeper review.
7737021 to
7747dba
Compare
|
Rebased onto current |
7747dba to
1fd7d3d
Compare
|
Rebased onto current |
1fd7d3d to
30bbe35
Compare
|
Final refresh onto the latest |
30bbe35 to
8fc5d8c
Compare
|
Interlock completion for the context-compressor shard campaign:
The full related set is explicitly recorded in #81074, including the prior compressor shards, same-surface colliders/fixers, and their referenced issue nodes. The residual |
What does this PR do?
Hardens context-compaction summary rendering for assistant tool calls.
Compaction summaries currently render tool arguments as truncated function-call-shaped pseudo examples such as
execute_code({ ... }). Those summaries are injected into later model context. This change renders bounded, JSON-safe descriptive previews asname args={preview}, reducing ambiguity while preserving useful argument context.Related Issue
Fixes #12586
Type of Change
Changes Made
agent/context_compressor.py_preview_tool_args_for_summary()for bounded, JSON-safe argument previews.name(args)pseudo calls toname args={preview}.tests/agent/test_context_compressor.pyHow to Test
scripts/run_tests.sh tests/agent/test_context_compressor.py -q.execute_code args=and notexecute_code({.Final focused verification after resolving the current-
mainredaction-helper rebase:Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
docs/, docstrings) — behavior is documented in helper docstrings and testscli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs