fix(feishu): guard channelRuntime inbound before dispatch fallback (fixes #93453)#93472
fix(feishu): guard channelRuntime inbound before dispatch fallback (fixes #93453)#93472xzh-icenter wants to merge 3 commits into
Conversation
When the gateway provides a partial channelRuntime object without the inbound sub-property, the dispatch path crashes with TypeError: Cannot read properties of undefined (reading 'run') because the nullish coalescing operator selects the partial object over the safe fallback. Check channelRuntime?.inbound before using it; when inbound is absent, fall back to getFeishuRuntime().channel which always provides the full runtime surface including inbound.run(). Fixes openclaw#93453
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 15, 2026, 11:28 PM ET / 03:28 UTC. Summary PR surface: Source 0. Total 0 across 1 file. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 67c80e941ecf. Evidence reviewedPR surface: Source 0. Total 0 across 1 file. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
|
checking~ |
|
Thanks for the focused fix. The fallback shape looks right, but this PR should include a narrow regression test for the exact missing case before merge. Please add a test that calls the Feishu message handling path with a truthy partial The focused local proof I ran was: So this is not a request for broad coverage, just the missing regression case for the reported crash path. |
|
I rechecked the earlier closed reports and this should be framed as a recurrence of the same symptom after the month-start fix, not as an isolated first-time bug. Earlier reports such as #88863 / #88889 / #89697 were closed because main had #93453 is different because it reports So the needed regression test is specifically the second-order case after There is already a sibling PR, #93466, with the same guard plus this regression test ( I would not use #93483 as-is for this specific failure mode: spreading the full plugin runtime does not help if the code still overrides |
Add a test verifying that handleFeishuMessage correctly falls back to getFeishuRuntime().channel when the gateway provides a partial channelRuntime object without the inbound sub-property. Covers the fix in openclaw#93472 for issue openclaw#93453.
|
@sliverp Thank you! The test has been added. Please have a look when you get a chance. |
|
93466 has merged |
Add a test verifying that handleFeishuMessage correctly falls back to getFeishuRuntime().channel when the gateway provides a partial channelRuntime object without the inbound sub-property. Covers the fix in openclaw#93472 for issue openclaw#93453.
Summary
Fixes #93453
After upgrading to 2026.6.6, the Feishu channel dispatch crashes with
TypeError: Cannot read properties of undefined (reading run)when the gateway provides a partialchannelRuntimeobject that lacks theinboundsub-property.Root Cause
In
bot.ts:737, the expressionchannelRuntime ?? getFeishuRuntime().channelselectschannelRuntimewhen truthy, even if it is a partial object withoutinbound. TheChannelGatewayContext.channelRuntimetype isChannelRuntimeSurface(only guaranteesruntimeContexts), butchannel.ts:1326casts it toPluginRuntime["channel"]viaas PluginRuntime["channel"]. When a partial runtime object withoutinboundreaches the handler, the unsound type assertion becomes a runtime crash atcore.channel.inbound.run().Fix
Check
channelRuntime?.inboundbefore using it; wheninboundis absent, fall back togetFeishuRuntime().channelwhich always provides the full runtime surface.Real behavior proof
Behavior or issue addressed: Feishu channel dispatch no longer crashes with TypeError when
channelRuntimelacks theinboundproperty.Real environment tested: Linux (WSL2), Node v24.16.0, commit 9725989.
Exact steps or command run after this patch: Verified the fix by checking the code change ensures
channelRuntime?.inboundis truthy before usingchannelRuntime, otherwise falls back togetFeishuRuntime().channel.Evidence after fix: Terminal output from code inspection:
The conditional
channelRuntime?.inbound ? channelRuntime : getFeishuRuntime().channelensures:channelRuntimehasinbound→ useschannelRuntime(same behavior as before)channelRuntimeis falsy or lacksinbound→ falls back togetFeishuRuntime().channel(always hasinbound)Observed result after fix: The crash path is eliminated by falling back to the registered runtime when
inboundis absent. The working path (whenchannelRuntimehasinbound) is unchanged. This is a purely defensive guard.What was not tested: Actual Feishu channel runtime behavior with partial
channelRuntimeobjects in production; the fix is based on code analysis of the type mismatch.Change Type
Scope
Security Impact
Compatibility
Fixes #93453