Handle Feishu streaming media as visible results#517
Conversation
evandance
left a comment
There was a problem hiding this comment.
The core fix — removing the early return so media continues to deliver in streaming mode — is exactly right and addresses the bug reported in #515/#337.
One scope request before merge, applying a narrower version of the line I'm taking on #499: for fallback-text changes whose user impact we can't ground in real evidence, I'd rather not move to a new string without something concrete to point to. Specifically:
Please drop the new MEDIA_DELIVERY_FALLBACK_TEXT constant and the displayText ternary in streaming-card-controller.ts that selects between 'Media delivered.' and the existing EMPTY_REPLY_FALLBACK_TEXT. Both strings are reasonable card text for the rare media-only-finalization state; without user feedback I'd rather leave the existing fallback in place.
To be clear on what should stay: markMediaDelivered() and the visibleMediaDelivered flag are useful and should remain. Their other two responsibilities — capturing toolUseElapsed so media-only flows have correct footer timing, and suppressing the otherwise-misleading 'reply completed without visible text' warn log for successful media-only completions — are legitimate consequences of the bug fix that the existing finalization path otherwise can't handle correctly. The only change to the controller is the displayText ternary collapsing back to EMPTY_REPLY_FALLBACK_TEXT; the warn-suppression condition (!this.visibleMediaDelivered) stays.
That leaves the PR as: remove the early return, add textHandledByController flag to gate static text, keep markMediaDelivered() with the warn-suppression + timing-capture responsibilities, drop the new fallback constant and the displayText branch.
69f4f4c to
d97a580
Compare
|
Updated in d97a580.\n\nChanges:\n- Dropped the new |
Summary
Root cause
In streaming-card mode, mixed text/media payloads returned immediately after the text went to the controller, so the media branch never ran. Media-only payloads did send through the static media path, but the controller had no visible-result signal, so the final card could still behave like the agent produced no displayable output.
Validation
pnpm test -- tests/reply-dispatcher-media.test.tspnpm exec prettier --check src/card/reply-dispatcher.ts src/card/reply-dispatcher-types.ts src/card/streaming-card-controller.ts tests/reply-dispatcher-media.test.tspnpm run typecheckgit diff --check