fix(setup): check that the client's bearer is alive, not that one is cached #142
No reviewers
Labels
No labels
blocked
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
waiting-on-julian
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jlxq0/matrix-mcp!142
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "setup-liveness"
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?
He pasted a correct recovery key three times, twice at an airport, the third from an incognito browser with a clean SSO. It could not have worked, and neither could a fourth.
Why incognito changed nothing
/setup/recovernever uses the token a sign-in issues. It reuses the cached matrix-sdk client holding claude.ai's device-bound connector bearer, deliberately: routing/setup's unbound token in callsrefresh_token_if_needed→restore_sessionand panics matrix-sdk 0.17 withAlreadyInitializedError, taking the pod down, verified 2026-05-18. So nothing done in a browser touches the token that was failing.The gate asked the wrong question
MatrixClientCache::containsis true for a client whose bearer Synapse has already revoked. Presence, not liveness. A dead session passed the gate, the key form was shown, the import returned401 M_UNKNOWN_TOKEN, and the page attributed it to the key.It now asks
whoami, the cheapest authenticated call there is, and refuses before the key form rather than after the paste, so the cause is named while the key is still in the clipboard.The instruction was already written, on the branch he could not reach
The absent-client error has named the revoked connector bearer, the typical cause (signing the matrix-mcp device out from Element) and the exact remedy for eighteen months. The stale-client path said nothing about it. A right answer displayed only where the person who needs it cannot be is the same as not having it. One constant now, used by both branches.
The server cannot self-heal this, and the comment says so
Rebuilding the client needs a device-bound session and only claude.ai's grant issues one, so a retry cannot succeed however often it runs. Without that sentence in the code the next reader adds one.
Both gates were unreachable at first
Disabling either left the suite green, because each needs a live
Clientand aSetupState.setup_gateis a free function over two booleans for that reason, and the decision table is the test:The last row matters: an absence wins over any probe result, or a failed probe against nothing would tell someone to re-add a connector they had not yet used. Mutating the dead case to proceed, and the absent case to trust the probe, each reddens it.
Two claims, two commits
#141 stopped the message misleading. This stops the import failing, and its acceptance is a successful import rather than a better sentence.
Gates: fmt, clippy
-D warnings,303 passed; 0 failed, audit clean, deny ok.