fix(feishu): catch thrown SDK errors for withdrawn reply targets#33515
fix(feishu): catch thrown SDK errors for withdrawn reply targets#33515MunemHashmi wants to merge 1 commit into
Conversation
Greptile SummaryThis PR fixes a silent failure in the Feishu integration where the SDK could throw an exception when a reply target message has been withdrawn or deleted. The fix wraps Confidence Score: 4/5
Last reviewed commit: 95f5376 |
The Feishu Lark SDK can throw exceptions (SDK errors with .code or AxiosErrors with .response.data.code) for withdrawn/deleted reply targets, in addition to returning error codes in the response object. Wrap reply calls in sendMessageFeishu and sendCardFeishu with try-catch to handle thrown withdrawn/not-found errors (230011, 231003) and fall back to client.im.message.create, matching the existing response-level fallback behavior. Also extract sendFallbackDirect helper to deduplicate the direct-send fallback block across both functions. Closes openclaw#33496
95f5376 to
ad0901a
Compare
|
Thanks again for this work. This PR is being closed as part of an AI-assisted PR merge/triage workflow. This landed indirectly via the synthesized PR #33789, and your contribution is credited in the changelog and as a co-author on the merge commit. Closing this PR as superseded by #33789. If anything here looks incorrect or incomplete, reply to reopen and we can reassess. |
|
Closing as superseded by #33789. |
Summary
client.im.message.reply()in try-catch in bothsendMessageFeishuandsendCardFeishuto catch thrown withdrawn/not-found errors (codes 230011, 231003) and fall back toclient.im.message.create(). ExtractedsendFallbackDirecthelper to deduplicate the direct-send fallback block. Removed overly broad error message matching fromisWithdrawnReplyError(only matches specific error codes now).shouldFallbackFromReplyTargetis untouched.updateCardFeishu,editMessageFeishu, andsendMarkdownCardFeishuare unaffected.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Feishu replies that fail due to withdrawn/deleted target messages now automatically fall back to a direct send instead of silently failing. No config changes.
Security Impact (required)
NoNoNo(replaces a failed reply with a direct send)NoNoRepro + Verification
Environment
Steps
Expected
client.im.message.create()and the user receives the response.Actual (before fix)
Evidence
4 new tests added to
send.reply-fallback.test.ts:falls back to create when reply throws a withdrawn SDK error(text,.code: 230011)falls back to create when card reply throws a not-found AxiosError(card,.response.data.code: 231003)re-throws non-withdrawn thrown errors for text messages(.code: 99991400)re-throws non-withdrawn thrown errors for card messages(.code: 99991401)Human Verification (required)
send.test.ts+ 7send.reply-fallback.test.ts)Compatibility / Migration
YesNoNoFailure Recovery (if this breaks)
isWithdrawnReplyError)Risks and Mitigations
isWithdrawnReplyErrorcould miss unknown SDK error shapes without.codeshouldFallbackFromReplyTargetstill catches those cases when the SDK returns (doesn't throw). Code-only matching avoids false positives on unrelated thrown errors.