Skip to content

fix(harness): pass through per-session interrupt overloads to delegate#1685

Open
cluski wants to merge 2 commits into
agentscope-ai:mainfrom
cluski:fix/harness-agent-interrupt-passthrough
Open

fix(harness): pass through per-session interrupt overloads to delegate#1685
cluski wants to merge 2 commits into
agentscope-ai:mainfrom
cluski:fix/harness-agent-interrupt-passthrough

Conversation

@cluski

@cluski cluski commented Jun 10, 2026

Copy link
Copy Markdown

Fixes #1683

Summary

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.

Changes

Add four passthrough methods to HarnessAgent that delegate to the corresponding ReActAgent overloads:

  • 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 Agent interface, so they are added as public methods on HarnessAgent directly (same pattern as other delegate passthrough methods in the class).

How to Test

  1. Build: mvn compile -pl agentscope-harness -am
  2. Tests: mvn test -pl agentscope-harness -am
  3. Manual verification: create a HarnessAgent serving multiple sessions concurrently, call agent.interrupt(userId, sessionId) to interrupt a specific session without affecting others.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

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)
@cluski cluski requested a review from a team June 10, 2026 01:50
@CLAassistant

CLAassistant commented Jun 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/harness agentscope-harness (test/runtime support) labels Jun 10, 2026

@AgentScopeJavaBot AgentScopeJavaBot 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.

🤖 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 AgentScopeJavaBot 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.

🤖 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/harness agentscope-harness (test/runtime support) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:HarnessAgent does not forward per-session interrupt methods from ReActAgent

3 participants