Skip to content

fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21#7848

Merged
alt-glitch merged 2 commits into
mainfrom
fix/matrix-memorycryptostore-args
Apr 11, 2026
Merged

fix(matrix): pass required args to MemoryCryptoStore for mautrix ≥0.21#7848
alt-glitch merged 2 commits into
mainfrom
fix/matrix-memorycryptostore-args

Conversation

@alt-glitch

Copy link
Copy Markdown
Collaborator

Summary

Fixes #7803 — the mautrix-python migration (commit 1850747) broke Matrix E2EE initialization because MemoryCryptoStore.__init__() gained two required positional arguments (account_id, pickle_key) in mautrix 0.21.

Bug

MemoryCryptoStore.__init__() missing 2 required positional arguments: 'account_id' and 'pickle_key'

Gateway refuses to connect to Matrix when MATRIX_ENCRYPTION=true.

Fix

  • gateway/platforms/matrix.py: Pass account_id=self._user_id and pickle_key=f"{self._user_id}:{self._device_id}" to MemoryCryptoStore(). The pickle key reuses the same user_id:device_id derivation already used for the on-disk HMAC signature.
  • tests/gateway/test_matrix.py: Update the MemoryCryptoStore test stub to accept the new parameters.

All 158 matrix-related tests pass.

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
@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@BugBot review

@cursor

cursor Bot commented Apr 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes the Matrix encryption bootstrap path (connect() when MATRIX_ENCRYPTION is enabled), so mistakes could prevent encrypted Matrix connections from starting. Scope is small and isolated to crypto-store construction and its test stubs.

Overview
Fixes Matrix E2EE startup against mautrix-python ≥0.21 by constructing MemoryCryptoStore with the required account_id and pickle_key (derived from user_id/device_id) instead of calling it with no args.

Updates the Matrix test harness stub of MemoryCryptoStore to accept and store these new constructor parameters so the E2EE connect tests continue to run.

Reviewed by Cursor Bugbot for commit de7253d. Configure here.

Comment thread gateway/platforms/matrix.py Outdated
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.
@alt-glitch

Copy link
Copy Markdown
Collaborator Author

@BugBot review

@alt-glitch alt-glitch marked this pull request as ready for review April 11, 2026 17:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@alt-glitch alt-glitch merged commit 69f3aaa into main Apr 11, 2026
4 of 5 checks passed
forsonny pushed a commit to forsonny/hermes-agent that referenced this pull request Apr 11, 2026
…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
Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
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>
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
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>
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
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>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
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>
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
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>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
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>
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Switch to mautrix-python breaks matrix gateway integration

2 participants