Repository navigation
[BUG] Streaming chat shows "no visible reply" for a long time; later cancels and backend logs cleanup warnings #869
Description
Summary
In the UI, streaming chats sometimes show no visible incremental reply for a long period. Eventually the request may cancel/time out on the frontend, and backend logs include cleanup warnings (e.g., Runner.close() was cancelled and MCP cancel‑scope messages). Users perceive this as the chat "hanging" or failing, and it can occasionally correlate with probe failures under load.
Version / Environment
- kagent version: 0.5.5 (also observed on latest main)
- UI image with embedded Nginx reverse proxy
- A2A streaming via Next.js route
/a2a/{namespace}/{agent}
Steps To Reproduce
- Deploy UI and Controller, create a streaming Agent (e.g., AIRE‑agent).
- Start a chat and observe the browser network panel for
/a2a/.... - In certain runs, there are no incremental SSE events visible for an extended time; later the request cancels or ends.
Expected Behavior
- The chat shows incremental updates in real time while the agent processes the request.
Actual Behavior
- The chat appears to have no reply for a long time.
- The request may cancel/time out on the frontend.
- Backend logs show cleanup‑phase warnings and cancellations.
Evidence / Logs
Examples seen in backend logs:
WARNING:google_adk...: Runner.close() was cancelled; suppressing during cleanup
ERROR asyncio: Exception in callback EventConsumer.agent_task_callback()
...
asyncio.exceptions.CancelledError: Cancelled by cancel scope ...
Warning: Error during MCP session cleanup ... Attempted to exit cancel scope in a different task than it was entered in
Impact
- Users see chats that appear stuck or fail.
- May cascade into timeouts/cancellations and occasional probe failures under pressure.
Additional Context
- Similar user symptoms were reported in [BUG] An error occurred during processing at the end of agent chat #859.
📋 Prerequisites
- I have searched the existing issues to avoid creating a duplicate
- By submitting this issue, you agree to follow our Code of Conduct
- I am using the latest version of the software
- I have tried to clear cache/cookies or used incognito mode (if ui-related)
- I can consistently reproduce this issue
🎯 Affected Service(s)
UI Service
🚦 Impact/Severity
No impact (Default)
🐛 Bug Description
Summary
In the UI, streaming chats sometimes show no visible incremental reply for a long period. Eventually the request may cancel/time out on the frontend, and backend logs include cleanup warnings (e.g., Runner.close() was cancelled and MCP cancel‑scope messages). Users perceive this as the chat "hanging" or failing, and it can occasionally correlate with probe failures under load.
Version / Environment
- kagent version: 0.5.5 (also observed on latest main)
- UI image with embedded Nginx reverse proxy
- A2A streaming via Next.js route
/a2a/{namespace}/{agent}
Steps To Reproduce
- Deploy UI and Controller, create a streaming Agent (e.g., AIRE‑agent).
- Start a chat and observe the browser network panel for
/a2a/.... - In certain runs, there are no incremental SSE events visible for an extended time; later the request cancels or ends.
Expected Behavior
- The chat shows incremental updates in real time while the agent processes the request.
Actual Behavior
- The chat appears to have no reply for a long time.
- The request may cancel/time out on the frontend.
- Backend logs show cleanup‑phase warnings and cancellations.
Evidence / Logs
Examples seen in backend logs:
WARNING:google_adk...: Runner.close() was cancelled; suppressing during cleanup
ERROR asyncio: Exception in callback EventConsumer.agent_task_callback()
...
asyncio.exceptions.CancelledError: Cancelled by cancel scope ...
Warning: Error during MCP session cleanup ... Attempted to exit cancel scope in a different task than it was entered in
Impact
- Users see chats that appear stuck or fail.
- May cascade into timeouts/cancellations and occasional probe failures under pressure.
Additional Context
- Similar user symptoms were reported in [BUG] An error occurred during processing at the end of agent chat #859.
🔄 Steps To Reproduce
- Open the UI and initiate a streaming chat with a configured Agent.
- Observe the network panel for the
/a2a/{namespace}/{agent}request. - Note that incremental SSE events may not appear for an extended time, followed by cancellation.
🤔 Expected Behavior
Chat should stream incremental responses in real time without long gaps or unexpected cancellation.
📱 Actual Behavior
- Long period with no visible incremental output.
- Stream cancels/times out; backend logs show cleanup warnings.
💻 Environment
- kagent 0.5.5 and latest main
- UI with embedded Nginx, Next.js proxy route
/a2a/... - Browser: Chrome/Edge (latest)
🔧 CLI Bug Report
No response
🔍 Additional Context
No response
📋 Logs
WARNING:google_adk...: Runner.close() was cancelled; suppressing during cleanup
ERROR asyncio: Exception in callback EventConsumer.agent_task_callback()
...
asyncio.exceptions.CancelledError: Cancelled by cancel scope ...
Warning: Error during MCP session cleanup ... Attempted to exit cancel scope in a different task than it was entered in📷 Screenshots
No response
🙋 Are you willing to contribute?
- I am willing to submit a PR to fix this issue
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
xrwang8 commentedon Sep 9, 2025
Hypothesis (SSE buffering)
Fix UI/streaming timeouts for long running LLM requests (#907)
Fix UI/streaming timeouts for long running LLM requests (kagent-dev#907)