fix: bridge device missing e2e_device_keys_json after recovery procedure (nas-pog5w1kc) #6
Labels
No labels
agent:felinus
agent:human
agent:maximus
priority:p0
priority:p1
priority:p2
priority:p3
status:blocked
status:needs-review
status:wip
type:chore
type:docs
type:feat
type:fix
type:perf
type:refactor
type:test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jmz/matrix-bridge#6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptoms
Maximus@nas device `nas-pog5w1kc` is invisible in `/_matrix/client/v3/keys/query` for `@claudius-maximus:matrix.ziefle.org`. Synapse-admin investigation (2026-05-02) found:
```
device_id: nas-pog5w1kc
display_name: Maximus@nas
last_seen_ts: 2026-05-02T12:35:26.798Z (active, syncing)
OTKs: 50 uploaded
identity_keys: MISSING from e2e_device_keys table ← the bug
```
The device has 50 one-time-keys uploaded — so it CAN receive Olm session establishment from peers who already have it cached — but with no `e2e_device_keys_json` row, new peers querying `/keys/query` don't see it and can't establish a fresh Olm session.
Probable cause
The "delete + re-INSERT into devices" recovery procedure documented in CLAUDE.md was run on this device at some point. The procedure deletes the device row but leaves `e2e_device_keys` orphaned, then re-INSERTs the device row without re-uploading device keys. Result: device exists, OTK upload still works (it's keyed on device_id), but identity-keys row is gone.
Why it matters
Fix options
Update the recovery runbook
The `delete + re-INSERT` procedure in CLAUDE.md should explicitly call out: after re-INSERT, restart the bridge process to trigger device-keys re-upload, and verify with `/keys/query`. The current procedure leaves the device in the broken state described here.
Discovered
While investigating mba-726dadit (issue #5) on Bear's request — Maximus@nas's `/keys/query` against `@claudius-maximus` returned only mba-726dadit and rpi5-0o3kuj3y, omitting itself. Synapse postgres `e2e_device_keys` table query confirmed the missing row.
Status update — today's bridge UTD fix path for rpi5 ↔ Tabby's Mac was unblocked by wedge-clear (#9), not by recovery-procedure improvements. The trust chain (PR #3/#4/#7/#8) was all genuinely necessary plumbing, but the final unblock was
DELETE FROM session WHERE sender_key = '<peer_curve25519>'+DELETE FROM outbound_group_session WHERE room_id = …to clear a wedged Olm channel, then respawn →/keys/claim→ fresh Olm + Megolm rebuilds.nas-pog5w1kcbootstrap-cross-signing remains a separate consistency item per Felinus's recommendation in the bridge thread — queued for NAS-Maximus's next invocation. No new evidence on the missinge2e_device_keys_jsonproblem from today's investigation; that pathology is independent of the wedge.Closing as obsolete — the broken device has been replaced.
Verified tonight (2026-05-27 ~23:42) via Synapse's public API:
The original device
nas-pog5w1kcfrom the issue is gone:Not just "no keys row" — the device is fully gone from Synapse. Was re-registered cleanly at some point after the issue was filed.
The current NAS bridge device
nas-gfw5uy4wis healthy:Exactly what the issue said was missing. New peers querying for
@claudius-maximus's NAS device get fulle2e_device_keysback and can establish fresh Olm sessions.This matches the live state: tonight's E2EE messages from this MBA (
mba-726dadit) to the bridge room got delivered + decrypted by all three Maximus devices, including the NAS one — which would have been impossible if the bug were still present.Small follow-up worth doing on the bootstrap path (not blocking, just hygiene):
nas-gfw5uy4whasdisplay_name: Nonein Synapse's device list. The bridge-client-setup runbook + bootstrap script should setdisplay_name: "Maximus@nas"on registration, to matchMaximus@mba/Maximus@rpi5. Helps when scanning the device list manually.Closing.