Skip to content

fix(harness): allow eviction of oversized session_search results - #4099

Merged
jujn merged 1 commit into
agentscope-ai:mainfrom
guslegend0510:fix/issue-4098-session-search-eviction
Nov 13, 2026
Merged

jujn merged 1 commit into
agentscope-ai:mainfrom
guslegend0510:fix/issue-4098-session-search-eviction

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT (main)

Description

Fixes #4098

session_search only caps the number of matches (#3270), not their size. Each match embeds a whole stored message, so a handful of matches can exceed the eviction threshold. Because session_search was in ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS, such results were never offloaded and could push the next model request over budget.

Changes:

  • Remove session_search from ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS. Results under the threshold (80K chars by default) are unchanged; larger ones get the usual head/tail preview and a read_file pointer. Long single-line offload files are readable since fix(harness): bound read_file output with Unicode-safe pagination #3821.
  • Update the SessionSearchTool comment that relied on the exclusion.
  • Update the default exclusion list in docs/v2/{en,zh}/docs/harness/context.md.

The prune exclusion in CompactionConfig.PruneConfig is left unchanged: once a large result is offloaded, only the preview stays inline.

Compatibility: users who set excludedToolNames explicitly are not affected. With default settings, session_search results over 80K chars are now offloaded instead of kept inline.

How to test:

  • New ToolResultEvictionMiddlewareTest#defaultConfigEvictsOversizedSessionSearchButNotReadFile: with default config, an oversized session_search result is offloaded and an oversized read_file result is not. It fails on main and passes with this change.
  • mvn -B -T1C -pl agentscope-harness -am verify: passed (core 3060, 577, harness 1624 tests, 0 failures).

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

session_search caps the number of matches (agentscope-ai#3270) but not their size;
each match embeds a whole stored message, so a few matches can exceed
the eviction threshold. Remove session_search from the default
ToolResultEvictionConfig exclusions so oversized results are offloaded
with a head/tail preview and a read_file pointer.

Fixes agentscope-ai#4098
@mintlify

mintlify Bot commented Nov 10, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit d4c3cf4.

Approve preview

@jujn jujn added the P1 紧急不重要 label Nov 10, 2026
@jujn
jujn merged commit 36cabf4 into agentscope-ai:main Nov 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 紧急不重要

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: session_search results are unbounded in size and excluded from tool-result eviction

3 participants