Skip to content

fix(core): persist agent state on user interrupt recovery - #2008

Merged
chickenlj merged 2 commits into
agentscope-ai:mainfrom
guslegend0510:fix/2007-user-interrupt-agent-state
Jul 6, 2026
Merged

chickenlj merged 2 commits into
agentscope-ai:mainfrom
guslegend0510:fix/2007-user-interrupt-agent-state

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

Background

Fixes #2007.

When a USER interrupt happens during an in-flight ReActAgent call, the recovery message is appended to the current session AgentState, but that state was not persisted to AgentStateStore before returning. As a result, a fresh agent instance reloading the same (userId, sessionId) could miss the interrupt recovery state.

What Changed

  • persist session state in the USER interrupt recovery path before returning the recovery message
  • keep the change scoped to ReActAgent without altering the generic AgentBase interrupt semantics
  • add a regression test covering real in-flight user interruption with state-store reload verification

Testing

  • mvn -pl agentscope-core -Dtest=ReActAgentPerSessionStateTest test

Notes

  • the fix is intentionally minimal and only targets the missing persistence in the user-interrupt recovery flow
  • existing normal call() persistence behavior is unchanged

@guslegend0510
guslegend0510 requested a review from a team July 4, 2026 08:50
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jujn jujn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@chickenlj
chickenlj merged commit 1284073 into agentscope-ai:main Jul 6, 2026
5 checks passed
zouyx pushed a commit to zouyx/agentscope-java that referenced this pull request Jul 6, 2026
wzl521 pushed a commit to wzl521/agentscope-java that referenced this pull request Aug 12, 2026
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.

[Bug]:USER interrupt does not persist AgentState — context lost on next call

4 participants