fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21#7848
Conversation
MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit 1850747) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes #7803
|
@BugBot review |
PR SummaryMedium Risk Overview Updates the Matrix test harness stub of Reviewed by Cursor Bugbot for commit de7253d. Configure here. |
Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty.
|
@BugBot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit de7253d. Configure here.
…trol backoff Merge upstream/main (3 commits): - fix(streaming): adaptive backoff + cursor strip to prevent message truncation (NousResearch#7683) Telegram flood control during streaming caused messages to be cut off. New: adaptive backoff (double interval on flood, cap at 10s), cursor strip on fallback entry, retry on fallback send, default edit_interval 1.0s. - fix: unify openai-codex model list from codex_models.py (NousResearch#7844) - fix(matrix): pass required args to MemoryCryptoStore for mautrix >=0.21 (NousResearch#7848) Add 33 tests for the new streaming flood control behavior: - TestIsFloodError (7): flood/retry/rate detection, false positives - TestSendOrEditReturnValues (9): bool return values for all scenarios - TestAdaptiveBackoffDirect (6): progressive backoff, strike tracking, reset - TestTryStripCursor (4): cursor cleanup on fallback entry - TestFallbackFinalRetry (1): retry on flood during fallback send - TestDefaultEditInterval (3): config defaults - TestFloodStrrikesState (3): initialization state Self-improve: automated improvement
NousResearch#7848) * fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21 MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit 1850747) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes NousResearch#7803 * fix: use consistent fallback for pickle_key derivation Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty. --------- Co-authored-by: Hermes Agent <hermes@nousresearch.com>
NousResearch#7848) * fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21 MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit 092359d) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes NousResearch#7803 * fix: use consistent fallback for pickle_key derivation Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty. --------- Co-authored-by: Hermes Agent <hermes@nousresearch.com>
NousResearch#7848) * fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21 MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit 092359d) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes NousResearch#7803 * fix: use consistent fallback for pickle_key derivation Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty. --------- Co-authored-by: Hermes Agent <hermes@nousresearch.com>
NousResearch#7848) * fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21 MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit 1850747) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes NousResearch#7803 * fix: use consistent fallback for pickle_key derivation Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty. --------- Co-authored-by: Hermes Agent <hermes@nousresearch.com>
NousResearch#7848) * fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21 MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit 2584709) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes NousResearch#7803 * fix: use consistent fallback for pickle_key derivation Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty. --------- Co-authored-by: Hermes Agent <hermes@nousresearch.com>
NousResearch#7848) * fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21 MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit 1850747) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes NousResearch#7803 * fix: use consistent fallback for pickle_key derivation Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty. --------- Co-authored-by: Hermes Agent <hermes@nousresearch.com>
NousResearch#7848) * fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21 MemoryCryptoStore.__init__() now requires account_id and pickle_key positional arguments as of mautrix 0.21. The migration from matrix-nio (commit a9a629d) didn't account for this, causing E2EE initialization to fail with: MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key' Pass self._user_id as account_id and derive pickle_key from the same user_id:device_id pair already used for the on-disk HMAC signature. Update the test stub to accept the new parameters. Fixes NousResearch#7803 * fix: use consistent fallback for pickle_key derivation Address review: _pickle_key now uses _acct_id (which has the 'hermes' fallback) instead of raw self._user_id, so both values stay consistent when user_id is empty. --------- Co-authored-by: Hermes Agent <hermes@nousresearch.com>
Summary
Fixes #7803 — the mautrix-python migration (commit
1850747) broke Matrix E2EE initialization becauseMemoryCryptoStore.__init__()gained two required positional arguments (account_id,pickle_key) in mautrix 0.21.Bug
Gateway refuses to connect to Matrix when
MATRIX_ENCRYPTION=true.Fix
gateway/platforms/matrix.py: Passaccount_id=self._user_idandpickle_key=f"{self._user_id}:{self._device_id}"toMemoryCryptoStore(). The pickle key reuses the sameuser_id:device_idderivation already used for the on-disk HMAC signature.tests/gateway/test_matrix.py: Update theMemoryCryptoStoretest stub to accept the new parameters.All 158 matrix-related tests pass.