Pre-checks
Deployment Method
Source (setup.sh)
Steps to Reproduce
- Configure a Feishu bot for an agent with CardKit streaming enabled.
- Send a message that triggers a tool call (e.g., asking the agent to search the web, read a document, etc.).
- Observe the streaming card output during the tool execution.
Expected vs Actual Behavior
Expected: The streaming output should flow smoothly without interruption. The LLM reply text should appear continuously in the CardKit streaming element.
Actual: When a tool call starts or completes, the _ws_on_tool_call callback triggers _flush_stream("tool"), which injects tool status text (e.g., ⏳ Tool running: search_web / ✅ Tool done: search_web) into the CardKit streaming element content. This concatenation of tool status lines before the actual reply text causes the streaming element to be rewritten from scratch, visually resetting the output and creating a jarring flash/flicker.
Root Cause
The tool call status display was originally added to work around Feishu card block rendering limitations (blocks not updating smoothly). Now that CardKit streaming mode is used, the tool status text injected into the streaming element disrupts the smooth incremental output:
- Each tool status change triggers
_flush_stream("tool") → an extra stream_card_content call.
- The tool status lines are prepended to the accumulated reply text before being sent to the CardKit streaming element, effectively rewriting the entire content.
- This breaks the continuity of the streaming element, causing visible resets/flickers.
Proposed Fix
Remove the tool call status display logic from the Feishu channel:
- Stop passing
on_tool_call=_ws_on_tool_call to _call_agent_llm().
- Remove
_tool_status_running, _tool_status_done state tracking variables.
- Remove tool status rendering from
_build_card() and _flush_stream().
- Remove the
_TOOL_STATUS_KEEP_LINES constant.
- Remove the
_ws_on_tool_call callback function.
This way the Feishu streaming output only contains the LLM reply text and is never interrupted by tool call status updates.
Impact
- Only affects the Feishu channel message display.
- WebSocket (Web Chat) tool call display is unaffected.
- Trigger daemon tool call logging is unaffected.
- Image streaming path (
_handle_feishu_file) is unaffected (it never used tool status display).
Logs / Screenshots
Relevant code in backend/app/api/feishu.py:
_TOOL_STATUS_KEEP_LINES constant
_tool_status_running / _tool_status_done state dicts
_ws_on_tool_call callback (the main trigger)
_build_card() tool status section rendering
_flush_stream() CardKit path tool status concatenation
Pre-checks
Deployment Method
Source (setup.sh)
Steps to Reproduce
Expected vs Actual Behavior
Expected: The streaming output should flow smoothly without interruption. The LLM reply text should appear continuously in the CardKit streaming element.
Actual: When a tool call starts or completes, the
_ws_on_tool_callcallback triggers_flush_stream("tool"), which injects tool status text (e.g.,⏳ Tool running: search_web/✅ Tool done: search_web) into the CardKit streaming element content. This concatenation of tool status lines before the actual reply text causes the streaming element to be rewritten from scratch, visually resetting the output and creating a jarring flash/flicker.Root Cause
The tool call status display was originally added to work around Feishu card block rendering limitations (blocks not updating smoothly). Now that CardKit streaming mode is used, the tool status text injected into the streaming element disrupts the smooth incremental output:
_flush_stream("tool")→ an extrastream_card_contentcall.Proposed Fix
Remove the tool call status display logic from the Feishu channel:
on_tool_call=_ws_on_tool_callto_call_agent_llm()._tool_status_running,_tool_status_donestate tracking variables._build_card()and_flush_stream()._TOOL_STATUS_KEEP_LINESconstant._ws_on_tool_callcallback function.This way the Feishu streaming output only contains the LLM reply text and is never interrupted by tool call status updates.
Impact
_handle_feishu_file) is unaffected (it never used tool status display).Logs / Screenshots
Relevant code in
backend/app/api/feishu.py:_TOOL_STATUS_KEEP_LINESconstant_tool_status_running/_tool_status_donestate dicts_ws_on_tool_callcallback (the main trigger)_build_card()tool status section rendering_flush_stream()CardKit path tool status concatenation