agentscope-ai / agentscope-ai/QwenPaw

[Bug] Agent enters infinite 'Thinking' state after completing response (SSE stream not closing properly)

オープン
#3,871 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
35k
フォーク
3.1k
平均マージ
1日 13時間
マージ済み PR(30日)
228

説明

## Bug Description

After the Agent has finished generating its response (the content is complete and displayed to the user), the UI shows an additional **"Thinking" bubble** that continues indefinitely, requiring the user to manually stop the session.

## Steps to Reproduce

1. Start a conversation with the Agent in the Console.
2. Ask a question that requires a multi-part response.
3. The Agent generates and displays the complete response.
4. **After the response is complete**, a new "Thinking" bubble appears and spins indefinitely.
5. The Agent does not produce further output, but the "Thinking" state never ends.
6. User must manually click "Stop" to terminate the session.

## Expected Behavior

After the Agent generates its final response, the SSE stream should close properly and the UI should return to an idle state. No additional "Thinking" bubble should appear after the response is complete.

## Actual Behavior

An extra "Thinking" bubble appears after the final response and spins forever. The underlying SSE stream or Agent state machine is not recognizing that the conversation turn has ended.

## Screenshots

![Infinite thinking after response](https://user-images.githubusercontent.com/39703217/3868-thinking-bug.png)

*(Note: Screenshot shows completed response followed by persistent "Thinking" bubble)*

## Environment

- **QwenPaw Version**: 1.1.4.post1
- **OS**: Windows 10 (AMD64)
- **Python**: 3.13
- **Channel**: Console
- **Model**: qwen3.6-plus (via aliyun-codingplan)

## Possible Root Causes

1. **SSE stream not closing**: The server-side SSE stream may not be emitting a proper `done` event after the Agent completes its response.
2. **ReAct loop not terminating**: The Agent's internal ReAct loop may not be recognizing that the current turn has reached a terminal state.
3. **Frontend state not resetting**: The Console UI may not be properly clearing the "Thinking" state after receiving the final message.

## Impact

- User experience is degraded as sessions appear to hang.
- Users must manually intervene to stop the Agent, disrupting the natural flow of conversation.
- This may also cause issues with subsequent messages in the same session.

## Suggested Investigation

1. Check the SSE stream lifecycle in `/console/chat` endpoint — verify that the stream properly closes after the Agent's final response.
2. Review the ReAct Agent's termination conditions in `react_agent.py` — ensure the loop exits cleanly when no further actions are needed.
3. Check the Console frontend's handling of the "Thinking" state — verify it resets after receiving a completed response.

## Related

This issue may be related to the SSE handling introduced in recent versions for the Console channel.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。