Skip to content

fix: mark timed-out tool calls as orange Timeout status - #100

Open
shichenshuo-star wants to merge 1 commit into
Cheerwhy:mainfrom
shichenshuo-star:fix/tool-timeout-status
Open

fix: mark timed-out tool calls as orange Timeout status#100
shichenshuo-star wants to merge 1 commit into
Cheerwhy:mainfrom
shichenshuo-star:fix/tool-timeout-status

Conversation

@shichenshuo-star

Copy link
Copy Markdown

Summary

Tool calls that time out currently render with a green Succeeded label in the Feishu card, because the injected gateway progress hook only forwarded preview (which is always empty for tool.completed events) and dropped the is_error/result kwargs. Ordinary tool errors are mislabeled the same way.

Changes

  • patcher.py / patch.py / controller.py — forward is_error and result from the gateway progress_callback kwargs through on_tool_updated into on_tool_update; error/timeout results are recorded as errors instead of successes.
  • streaming/tooluse.py — add ToolStatus.TIMEOUT with timed out text detection (_resolve_end_status); timeout steps carry no error block, ordinary errors show a readable message extracted from JSON-wrapped results (_extract_error_message).
  • cardkit/builder.py — render the timeout status as an orange Timeout label (the Feishu lark_md font tag only supports preset color names, so orange is used instead of #FFFF00).
  • Tests — hook kwarg forwarding, tracker status mapping (timeout/error/success), JSON error extraction, and card label rendering; full suite passes (507 tests).

Screenshots / verification

  • Reproduced with a 1s-timeout terminal call; the tool step now shows Run command (1.3 s) · Timeout in orange with no raw JSON block attached.

The gateway's injected progress hook only forwarded `preview` (always
empty for tool.completed events) and dropped the `is_error`/`result`
kwargs, so tool timeouts (and ordinary errors) were recorded as success
and rendered with a green "Succeeded" label.

- Forward is_error/result from the injected progress hook through
  patch.on_tool_updated to controller.on_tool_update
- Add ToolStatus.TIMEOUT with "timed out" text detection in tooluse.py
- Render timeout steps with an orange Timeout label and no raw result
  JSON block; ordinary errors show red Failed with a readable message
  extracted from the JSON-wrapped result
- Add unit tests for the hook forwarding, tracker status mapping, and
  card label rendering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant