Skip to content

fix: feishu output issues (topic_group, UTF-8 truncation, ThreadID)#4353

Open
haozicnm wants to merge 1 commit into
esengine:main-v2from
haozicnm:fix/feishu-output-issues
Open

fix: feishu output issues (topic_group, UTF-8 truncation, ThreadID)#4353
haozicnm wants to merge 1 commit into
esengine:main-v2from
haozicnm:fix/feishu-output-issues

Conversation

@haozicnm

Copy link
Copy Markdown

Summary

Fixes several issues found in the Feishu/Lark bot output code analysis.

Changes

🔴 Critical fixes

  1. handleMessage now recognizes topic_group chat type (2f80b50)

    • Webhook path previously only handled "group", missing Feishu topic groups (topic_group)
    • This caused topic group messages to be treated as DM, bypassing RequireMention gating
    • Now matches the SDK path (handleSDKMessage) which already had this
  2. UTF-8 safe tool output truncation (render.go)

    • Changed from byte-based len(output) > 500 to rune-based len([]rune(output)) > 500
    • Prevents garbled text when tool output contains multi-byte UTF-8 characters near the 500-byte boundary

🟡 Improvements

  1. Added ThreadID field to feishuMsgEvent struct

    • Webhook push events include thread_id but it wasn't being parsed
    • handleMessage now extracts and propagates ThreadID to InboundMessage
  2. Proper error handling in sendCard

    • json.Marshal error was silently ignored with _
    • Now properly returns the error with fmt.Errorf("feishu card marshal: %w", err)

Testing

  • All existing tests pass (feishu: 9/9, bot: 20/20, full bot suite: 4/4 packages)
  • Build verified with go build

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants