agentscope-ai / agentscope-ai/agentscope-java

ToolResultEvictionMiddleware leaves full tool output in Redis AgentState

Đang mở
#2,145 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
area/harness bug
Ngôn ngữ chính
Java
Star
5.6k
Fork
1.3k
Merge trung bình
4 ngày 12 giờ
Pull request đã merge (30 ngày)
77

Mô tả

## Environment

- AgentScope Java source commit: e3a412ed2cc944e401da861c8d5e464b967724e9
- HarnessAgent with RemoteFilesystemSpec(IsolationScope.SESSION)
- RedisDistributedStore backed by Jedis
- ToolResultEvictionConfig maxResultChars=128, previewChars=16

## Reproduction

1. Build a HarnessAgent with a RedisDistributedStore, RemoteFilesystemSpec, and ToolResultEvictionConfig.
2. Run a tool returning a deterministic 500+ character TextBlock.
3. Let the model consume the ToolResultBlock and complete the turn.
4. Read the eviction artifact through WorkspaceManager: the full output is present.
5. Load agent_state from RedisAgentStateStore in the same or a fresh JVM.

## Expected

The persisted AgentState contains the bounded `Tool output was too large...` placeholder, matching the context transformed by ToolResultEvictionMiddleware. A fresh JVM restores the bounded context and can retrieve the full result from `/large_tool_results//`.

## Actual

The remote eviction artifact is written successfully, but persisted AgentState still contains the complete 500+ character ToolResultBlock. A fresh JVM therefore restores the oversized result and defeats long-conversation context bounding.

The existing local acceptance can miss this because the state object and middleware mutation remain visible in-process. The real Redis fresh-client path exposes the persistence ordering difference.

## Suspected cause

`ToolResultEvictionMiddleware` transforms the acting result after the AgentState persistence point. The artifact write succeeds, but the transformed message is not persisted back to the distributed AgentStateStore before turn completion.

## Why this belongs upstream

Tool-result eviction, middleware ordering, and AgentState persistence are Harness/Core runtime facts. Product hosts should not add a second save/eviction owner to patch this behavior.

A useful regression test should use two fresh Redis clients/JVM phases and assert both the bounded persisted placeholder and full remote artifact recovery.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.