fix(line): add CommandAuthorized to inbound context (#26996)#28286
fix(line): add CommandAuthorized to inbound context (#26996)#28286Glucksberg wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes a critical bug where LINE channel silently rejected all slash commands ( Root Cause: The normalization logic in The Fix:
Test Coverage: Added 3 new tests verifying Code Quality: The implementation is consistent with other channels (Telegram at Confidence Score: 5/5
Last reviewed commit: 043b24f |
|
Superseded by #32546, which consolidates this LINE workstream into the merged canonical fix set. |
Summary
/new,/model,/status, etc.) by adding missingCommandAuthorizedfield to the inbound contextCommandAuthorizedviaresolveControlCommandGate(), causingfinalizeInboundContextto coerce it fromundefinedtofalse, which silently blocked all commandsDetails
The root cause was in
src/line/bot-message-context.tswhere thefinalizeInboundContext()call did not include aCommandAuthorizedfield. Ininbound-context.ts, the normalizationnormalized.CommandAuthorized = normalized.CommandAuthorized === trueturnsundefinedintofalse, which then causesresolveCommandAuthorizationto deny all commands.The fix:
src/line/bot-handlers.ts:shouldProcessLineEvent()now returns aLineAccessDecisionobject with bothallowedandcommandAuthorizedfields (previously returned justboolean). It computescommandAuthorizedviaresolveControlCommandGate()using the same pattern as Telegram, Discord, Slack, and other channels.src/line/bot-message-context.ts:buildLineMessageContext(),buildLinePostbackContext(), andfinalizeLineInboundContext()now accept and thread through thecommandAuthorizedparameter, including it in thefinalizeInboundContext()payload.src/line/bot-message-context.test.ts: Added tests verifyingCommandAuthorizedis correctly set totrueandfalsefor both message and postback contexts.Closes #26996
Test plan
pnpm check(format + lint + typecheck) passes/newvia LINE DM withdmPolicy: "pairing"and nocommands.allowFromconfigured -- command should now be processed instead of silently ignored