fix(matrix): add accountId routing for multi-account message sending 🤖#23333
Closed
BadTurki wants to merge 4 commits into
Closed
fix(matrix): add accountId routing for multi-account message sending 🤖#23333BadTurki wants to merge 4 commits into
BadTurki wants to merge 4 commits into
Conversation
- Thread accountId through Matrix message actions and tool handlers - Add currentAccountId to ChannelThreadingToolContext for outbound routing - Plumb x-openclaw-message-to header as currentChannelId in gateway HTTP handler - Add fallback to toolContext.currentAccountId in message-action-runner Fixes an issue where Matrix channels with multiple accounts would incorrectly use the default/first authenticated account when sending images instead of the account bound to the agent.
Fix/matrix accountid routing
Contributor
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: extensions/matrix/src/actions.ts
Line: 86-99
Comment:
Other Matrix actions (react, edit, delete, read, pin, unpin) also resolve clients and could benefit from `accountId` routing for consistency. Consider adding `accountId: ctx.accountId ?? undefined` to these actions too.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
Author
|
Pulling this PR. Breaking changes made this PR no longer work. I will have to stick to my branch for now. |
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.
Summary
accountIdpropagation through the message tool chain (Matrix actions → tool handlers → threading context → message-action-runner).Change Type
Scope
Linked Issue/PR
User-visible / Behavior Changes
Security Impact
NoNoNoNoNoRepro + Verification
Environment
Steps
defaultandmuse)mainagent →defaultaccount,museagent →museaccountmuseagent in its Matrix DMExpected
museaccountActual (before fix)
defaultaccount, failing because that account isn't in the DMActual (after fix)
museaccountEvidence
Human Verification
Compatibility / Migration
YesNoNoFailure Recovery
Risks and Mitigations
AI Assistance Disclosure
🤖 AI-assisted: This PR was developed with AI assistance.
accountIdthrough the Matrix message sending pipeline so that multi-account setups route outbound messages through the correct account instead of always using the default/first authenticated account.Greptile Summary
Added
accountIdpropagation through Matrix message sending pipeline to fix multi-account routing. When multiple Matrix accounts are configured and bound to different agents, outbound messages (especially media) now correctly route through the agent's bound account instead of defaulting to the first authenticated account.Key changes:
accountIdfromChannelMessageActionContextthrough Matrix actions, tool handlers, and message runnercurrentAccountIdfield toChannelThreadingToolContexttype with JSDocaccountIdfrom HTTP headers (x-openclaw-message-to) to tool context in gatewaytoolContext.currentAccountIdbeforedefaultAccountIdin message action runnerWhat works:
accountIdthrough all layers for send actionIncomplete coverage:
ctx.accountIdfrom the action adapter inextensions/matrix/src/actions.ts:86-192, though they accept it viaMatrixActionClientOpts. This means these actions may still route to wrong accounts in multi-account setups.Confidence Score: 4/5
accountIdthrough the Matrix message sending pipeline. All changes are additive (optional parameters), maintaining backward compatibility. The code follows established patterns from previous multi-account fixes. Score is 4 (not 5) because other Matrix actions could have the same routing issue but aren't addressed in this PR.Last reviewed commit: 4977888
(2/5) Greptile learns from your feedback when you react with thumbs up/down!