Repository navigation
Conversation
HarnessAgent only delegated the legacy no-arg interrupt() and interrupt(Msg) methods to the underlying ReActAgent. The new per-session overloads added in 2.0.0-RC2 (accepting RuntimeContext or userId+sessionId pairs) were not exposed, making it impossible to interrupt a specific session when a single HarnessAgent instance serves multiple concurrent sessions. Add four passthrough methods: - interrupt(RuntimeContext) - interrupt(RuntimeContext, Msg) - interrupt(String userId, String sessionId) - interrupt(String userId, String sessionId, Msg)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This is a clean, well-scoped fix that adds four per-session interrupt passthrough methods to HarnessAgent, delegating to the corresponding ReActAgent overloads introduced in 2.0.0-RC2. The implementation follows the established delegate-passthrough pattern already used throughout the class. Javadocs are complete and consistent. The test suite covers all four new overloads, including a valuable session-isolation test that verifies interrupting one session does not affect another — directly validating the core fix described in the PR. No issues found.
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This is a clean, well-scoped fix that adds four per-session interrupt passthrough methods to HarnessAgent, delegating to the corresponding ReActAgent overloads introduced in 2.0.0-RC2. The implementation follows the established delegate-passthrough pattern already used throughout the class. Javadocs are complete and consistent. The test suite covers all four new overloads, including a valuable session-isolation test that verifies interrupting one session does not affect another — directly validating the core fix described in the PR. No issues found.
## Summary - route parent cancellation through a `HarnessAgent` to its `ReActAgent` delegate - interrupt the spawned `sub-*` session context instead of the parent run context - preserve cancellation-by-disposal for ordinary `Agent` implementations and timeout promotion behavior ## Root cause `AgentSpawnTool.interruptAgent` only handled direct `ReActAgent` instances, so a synchronously spawned `HarnessAgent` ignored parent cancellation. It also called `interrupt` with the parent `RuntimeContext`, while the child runs under a newly generated `sub-*` session. This fix stays local to `AgentSpawnTool` and does not change the shared `Agent` interrupt API or the `HarnessAgent` facade, avoiding overlap with #1685 and #1990. Closes #2408 Co-authored-by: jujn <[email protected]>
Fixes #1683
Summary
HarnessAgentonly delegated the legacy no-arginterrupt()andinterrupt(Msg)methods to the underlyingReActAgent. The new per-session overloads added in 2.0.0-RC2 (acceptingRuntimeContextoruserId+sessionIdpairs) were not exposed, making it impossible to interrupt a specific session when a singleHarnessAgentinstance serves multiple concurrent sessions.Changes
Add four passthrough methods to
HarnessAgentthat delegate to the correspondingReActAgentoverloads:interrupt(RuntimeContext ctx)interrupt(RuntimeContext ctx, Msg msg)interrupt(String userId, String sessionId)interrupt(String userId, String sessionId, Msg msg)These are not on the
Agentinterface, so they are added as public methods onHarnessAgentdirectly (same pattern as other delegate passthrough methods in the class).How to Test
mvn compile -pl agentscope-harness -ammvn test -pl agentscope-harness -amHarnessAgentserving multiple sessions concurrently, callagent.interrupt(userId, sessionId)to interrupt a specific session without affecting others.Checklist
mvn spotless:applymvn test)