feat(gateway/feishu): interactive clarify card#26332
Open
Restry wants to merge 1 commit into
Open
Conversation
Mirror the Telegram clarify-card pattern for Feishu so agents can ask questions via tappable buttons instead of forcing the user to type. - send_clarify renders one button per choice (max 4) plus an Other fallback that flips the card into text-capture mode - _handle_clarify_card_action authorizes the operator, looks up the question text via tools.clarify_gateway, and replaces the card with a resolved/awaiting variant - _resolve_clarify schedules unblock first and only then drops state, so a missing event loop leaves the entry recoverable - _escape_lark_markdown sanitizes user-controlled question/choice/user fields before they hit Lark markdown
Collaborator
This was referenced May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Feishu support for the existing
clarifyprimitive — agents can ask the user a question and render up to 4 tappable buttons (plus an✏️ Otherfallback) instead of forcing a typed reply. Mirrors the existing Telegram/Discord implementation; reusestools/clarify_gateway.pyend-to-end.What
send_clarify(...)builds an interactive card with one button per choice. Picking a choice resolves the clarify; pickingOtherflips the card into text-capture mode so the next message becomes the response. Open-ended (no choices) renders as plain markdown and the existing text-intercept handles it._handle_clarify_card_action(...)authorizes the operator (_is_interactive_operator_authorized), looks up the question viatools.clarify_gateway._entries, and replaces the card with a resolved/awaiting variant._resolve_clarify(...)schedules the unblock first and only then drops state, so a missing event loop leaves the entry recoverable on retry._escape_lark_markdown(...)sanitizes**,_,[,],`in user-controlledquestion/choice/user_namefields before interpolation into Lark markdown.Why
Feishu was the only major adapter without
send_clarify, so any clarify call from an agent fell back to the plain-text path even though Feishu cards render great. CARD-ONLY workflows now stay structured all the way through.Notes
hermes_clarify_action(avoids collision with the existinghermes_actionapproval namespace).gateway/platforms/feishu.py(+236 lines).clarify_gateway.Test plan
Manual on a live Feishu deploy:
Otherflips to awaiting card; next typed message resolves.**,_,[ ],`renders intact (escape verified).