Skip to content

Conversation

@AlbumenJ
Copy link
Collaborator

No description provided.

…persistence

Change-Id: Ibce1f62ce38ac544b80433507bfe2c00ce30c469
@AlbumenJ AlbumenJ requested review from a team and Copilot December 29, 2025 13:20
@AlbumenJ AlbumenJ changed the title feat(core): Redesign Session and StateModule API for type-safe state persistence [WIP] feat(core): Redesign Session and StateModule API for type-safe state persistence Dec 29, 2025
Copy link
Contributor

Copilot AI left a comment

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 introduces a major redesign of the session and state management API to provide type-safe state persistence for AgentScope. The new API replaces string-based session identifiers with a SessionKey interface and introduces a State marker interface for persistable objects, enabling compile-time type safety and better incremental storage support.

Key changes:

  • New SessionKey/SimpleSessionKey and State interfaces for type-safe session and state management
  • New StateModule.saveTo()/loadFrom() methods replacing the legacy stateDict() API
  • StatePersistence configuration record allowing fine-grained control over which components are persisted
  • Toolkit no longer extends StateModuleBase; its activeGroups state is now managed by ReActAgent

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
State.java New marker interface for persistable state objects
SessionKey.java New marker interface for session identifiers
SimpleSessionKey.java Default string-based SessionKey implementation with validation
StatePersistence.java Configuration record for controlling component state management
AgentMetaState.java Record for agent metadata persistence
ToolkitState.java Record for toolkit active groups persistence
PlanNotebookState.java Record for plan state persistence
StateModule.java Added new saveTo/loadFrom API, deprecated legacy methods
Session.java Added type-safe save/get methods with SessionKey, deprecated string-based methods
JsonSession.java Implemented new API with JSONL incremental storage for lists
InMemorySession.java Implemented new API with in-memory storage (full replacement)
Msg.java Now implements State interface
ContentBlock.java Now implements State interface
InMemoryMemory.java Implemented saveTo/loadFrom with new API
PlanNotebook.java Implemented StateModule, added saveTo/loadFrom support
Toolkit.java Removed StateModuleBase inheritance, added setActiveGroups method
ReActAgent.java Added StatePersistence configuration and saveTo/loadFrom implementation
SupervisorAgent.java Updated to reflect Toolkit no longer being a StateModule component
Test files Comprehensive test coverage for new API across all components

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…persistence

Change-Id: I0ff5a9f563e7a7096db38278c64b76cf33a19abf
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…persistence

Change-Id: I674b243d3a8080f05ae3004c540c36521de954c4
…persistence

Change-Id: I66d3744dfe16b4874932d9803e7209a50c45a999
…persistence

Change-Id: If97082b04df8cc643332f266ad3501dd47383466
Change-Id: Ia5df1edfd7bbd9293b50044731af9abddcac6075
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 50 out of 50 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…persistence

Change-Id: I5053d7e81bddaa0453809f55f8d76ac015aa6c75
…persistence

Change-Id: Id263ec3145d934fc51b6926f0e87f2b85381d0d3
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 53 out of 53 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

void testSaveAndGetListState() throws SQLException {
when(mockStatement.execute()).thenReturn(true);
when(mockStatement.executeUpdate()).thenReturn(1);
when(mockStatement.executeQuery()).thenReturn(mockResultSet);
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

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

This ResultSet is not always closed on method exit.

Copilot uses AI. Check for mistakes.
void testGetNonExistentListState() throws SQLException {
when(mockStatement.execute()).thenReturn(true);
when(mockStatement.executeUpdate()).thenReturn(1);
when(mockStatement.executeQuery()).thenReturn(mockResultSet);
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

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

This ResultSet is not always closed on method exit.

Copilot uses AI. Check for mistakes.
…persistence

Change-Id: I7eed1f45bf8a0ba62214694c833cd52229bb16b1
…persistence

Change-Id: Iff9e88c41e5807db3f2dfd3459d8ab16867dd2d6
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant