Skip to content

建议新增 IM 接入网关 + 优化 Harness 会话并发消息处理与中断能力 #1436

Open

Description

@wuxianjun66

需求:希望尽快规划开发统一 IM 网关层,快捷对接钉钉等主流 IM 实现消息收发;
现存问题:用户连续发消息,上一轮 Harness 响应未结束时新消息进入直接报错;手动调用 interrupt () 无法中断异步执行中的会话任务;
疑问与建议:会话被用户主动中断后,未完成对话是否存入上下文,是否增加中断状态标记;希望优化异步中断逻辑,增加会话并发消息处理策略,适配 IM 实时聊天场景。

Activity

  1. added
    enhancement
    on May 19, 2026
  2. wuxianjun66 commented on May 19, 2026

    @wuxianjun66
    Author

    Feature Issue (English Standard Format for AgentScope-Java)

    Title

    Support IM Gateway Access & Optimize Concurrent Chat Message Handling + Harness Interrupt Mechanism

    Is your feature request related to a problem? Please describe.

    1. We need to quickly connect mainstream IM platforms such as DingTalk to receive and send chat messages, there is no unified IM gateway layer currently.
    2. In actual chat scenarios, users often send continuous messages. When the previous Agent response is not finished yet and a new message comes in, Harness will throw errors directly.
    3. We tried to interrupt the ongoing conversation by calling harness.interrupt() to make new messages preempt execution, but it does not work normally, which is suspected to be caused by asynchronous execution logic.
    4. There is no unified rule whether to save incomplete interrupted conversation content into context memory, and there is no status mark for user active interruption.

    Describe the solution you'd like

    1. Plan to build a unified IM gateway layer to easily integrate DingTalk, WeCom and other IM platforms for message receiving and sending.
    2. Optimize the internal asynchronous interrupt mechanism of Harness, make interrupt() take effect stably to terminate running conversation tasks.
    3. Provide configurable concurrent message strategies: support new message interrupt old task and serial queue execution two modes for chat scene.
    4. Standardize context persistence rules after interruption: support saving incomplete dialogue records and add dedicated status flag for user active interruption.

    Describe alternatives you've considered

    1. Manually add session lock control in business code to limit single-session serial message processing, but it lacks flexibility and cannot realize preemption interruption.
    2. Custom encapsulate thread stop logic to terminate tasks, which is strongly coupled with business and easy to cause thread resource leakage.
    3. Discard unfinished conversation data directly after interruption, resulting in lost user dialogue records and poor experience.

    Additional context

    This optimization is very necessary for online customer service, group chat and real-time IM dialogue business scenarios, which can greatly improve the stability and user experience of Agent conversation interaction.

  3. added
    area/ext/integration
    area/harness
    on May 28, 2026
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/ext/integrationarea/harnessenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions