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]: session_search results are unbounded in size and excluded from tool-result eviction #4098
Describe the bug session_search caps the number of matches (#3270 / #3382, max 100), but not their size. Each match carries the whole stored message, so a few matches that contain large tool outputs can produce a very large result. At the same time session_search is in ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS, so the eviction middleware never offloads it. The oversized result stays inline and can push the next model request over the input budget.
To Reproduce
Run a HarnessAgent long enough that several earlier tool results (e.g. large JSON API responses) are in the session log.
Have the agent call session_search with a keyword that matches those messages.
The tool returns all matching messages inline; with default eviction settings nothing trims it.
Observed in a benchmark run: 12 matches, ~143K characters in a single session_search result (one message alone ~80K serialized chars). Context compaction could not bring it under budget and the request was rejected.
Expected behavior
Oversized session_search results should be offloaded like other large tool outputs (head/tail preview + read_file pointer), while small results stay inline.
Additional context
SessionSearchTool comment relies on the exclusion: "The tool is excluded from ToolResultEvictionConfig on the 'bounded results' rationale, so nothing downstream trims an oversized result".
Activity
fix(harness): allow eviction of oversized session_search results (age…