Skip to content

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

Open

Description

@cluskiop01

Describe the bug

ReActAgent provides per-session interrupt methods that are essential for the stateless (singleton) agent pattern introduced in 2.0:

  • interrupt(RuntimeContext ctx)
  • interrupt(String userId, String sessionId)
  • interrupt(String userId, String sessionId, Msg msg)

However, HarnessAgent only overrides the deprecated no-arg interrupt() and interrupt(Msg), which fall back to defaultSessionId. In a multi-session singleton deployment, calling interrupt() on a shared HarnessAgent cannot target a specific session — it always hits the default session, leaving other concurrent sessions unaffected when they should be interrupted.

To Reproduce

  1. Build a singleton HarnessAgent (no defaultSessionId set):
HarnessAgent agent = HarnessAgent.builder()
    .name("my-agent")
    .model(model)
    .stateStore(new MysqlAgentStateStore(dataSource))
    .build();
  1. Start concurrent calls with different RuntimeContext:
agent.streamEvents(msgs, RuntimeContext.builder()
    .userId("user-1").sessionId("session-A").build());
agent.streamEvents(msgs, RuntimeContext.builder()
    .userId("user-2").sessionId("session-B").build());
  1. Try to interrupt only session-A:
agent.interrupt("user-1", "session-A");  // compile error: method not found
  1. Workaround via getDelegate():
agent.getDelegate().interrupt("user-1", "session-A");  // works but leaks internals

Expected behavior

HarnessAgent should forward the per-session interrupt methods to its ReActAgent delegate, consistent with how it already forwards interrupt() and interrupt(Msg):

public void interrupt(RuntimeContext ctx) {
    delegate.interrupt(ctx);
}

public void interrupt(String userId, String sessionId) {
    delegate.interrupt(userId, sessionId);
}

public void interrupt(String userId, String sessionId, Msg msg) {
    delegate.interrupt(userId, sessionId, msg);
}

Environment

  • AgentScope-Java Version: 2.0.0-RC2
  • Java Version: 21
  • OS: Windows 11

Additional context

The HarnessAgent.getDelegate() method exists as a workaround, but requiring users to reach through the wrapper defeats the purpose of the facade. Since 2.0 explicitly promotes the stateless singleton pattern, per-session interrupt is a core capability that HarnessAgent should expose.

Activity

  1. added
    bug
    on Jun 10, 2026
  2. added
    area/harness
    on Jun 10, 2026
  3. moved this from Backlog to In progress in AgentScope Javaon Jun 10, 2026
  4. yulindong commented on Jun 29, 2026

    @yulindong

    We've encountered the same issue. Should we abstract these methods into an interface?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/harnessbug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions