Skip to content

feat(core): Expose ReActAgent state-cache cleanup APIs - #2572

Merged
chickenlj merged 1 commit into
release/2.0.1from
reactagent-state-cache-cleanup-api
Aug 5, 2026
Merged

feat(core): Expose ReActAgent state-cache cleanup APIs#2572
chickenlj merged 1 commit into
release/2.0.1from
reactagent-state-cache-cleanup-api

Conversation

@jujn

@jujn jujn commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings August 5, 2026 13:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes explicit APIs to clear ReActAgent’s in-memory per-session caches (agent state + permission engine), and wires that functionality through HarnessAgent so callers can release cached session data without affecting persisted AgentStateStore contents.

Changes:

  • Added ReActAgent.clearStateCache(...) overloads to clear all cached slots or a targeted (userId, sessionId) slot.
  • Added HarnessAgent.clearStateCache(...) passthrough methods delegating to the wrapped ReActAgent.
  • Added unit tests validating targeted/all-cache clearing and verifying persisted state remains intact after cache eviction.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
agentscope-harness/src/test/java/io/agentscope/harness/agent/HarnessAgentTest.java Adds a harness-level test ensuring HarnessAgent.clearStateCache(ctx) evicts only the targeted delegate session cache.
agentscope-harness/src/main/java/io/agentscope/harness/agent/HarnessAgent.java Exposes clearStateCache overloads on HarnessAgent by delegating to the wrapped ReActAgent.
agentscope-core/src/test/java/io/agentscope/core/agent/ReActAgentPerSessionStateTest.java Adds coverage for clearing all caches, clearing a single session cache, and preserving persisted state after cache eviction.
agentscope-core/src/main/java/io/agentscope/core/ReActAgent.java Implements cache-eviction APIs for per-session AgentState and permission engine caches; clears caches on close().

@jujn
jujn force-pushed the reactagent-state-cache-cleanup-api branch from 06302cf to 0b277b9 Compare August 5, 2026 13:32
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...e/src/main/java/io/agentscope/core/ReActAgent.java 69.23% 1 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@chickenlj
chickenlj changed the base branch from main to release/2.0.1 August 5, 2026 14:52
@chickenlj
chickenlj merged commit 75b93c3 into release/2.0.1 Aug 5, 2026
11 checks passed
@jujn
jujn deleted the reactagent-state-cache-cleanup-api branch August 5, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants