fix(matrix): stop retry loop on token introspection auth errors - #57150
fix(matrix): stop retry loop on token introspection auth errors#57150tianma-if wants to merge 1 commit into
Conversation
Competing with #56547 for the same issue #56532. #56547 adds |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for covering the Matrix sync retry failure. The premise remains live on current main: plugins/platforms/matrix/adapter.py:2335-2348 retries exceptions unless their text contains 401, 403, unauthorized, or forbidden, so the reported introspection message reaches the five-second retry branch.
Problems
- The new test covers the thrown-exception path, but the helper is also wired into the returned sync-object path. The existing object-path test at
tests/gateway/test_ws_auth_retry.py:115-153protects onlyM_UNKNOWN_TOKEN, not the new introspection marker.
Suggested changes
- Add a returned-object regression with
.message = "Unable to introspect the access token"and assert one sync call. - Reconcile this marker classifier with related #57375 before salvage; its review discussion identifies a false-positive risk in the existing raw substring classification.
Automated hermes-sweeper review.
| @@ -187,6 +187,41 @@ async def run(): | |||
| asyncio.run(run()) | |||
| assert call_count == 1 | |||
|
|
|||
| def test_introspection_auth_error_stops_loop(self): | |||
There was a problem hiding this comment.
Please add a companion regression that returns a sync-result object with message = "Unable to introspect the access token". This PR also routes returned objects through the new helper, while this test only exercises the exception branch.
9465647 to
4012e2f
Compare
What does this PR do?
Fixes the Matrix sync loop so mautrix token introspection failures are treated as permanent auth errors instead of transient sync errors retried forever.
The adapter already stopped on 401/403/unauthorized/forbidden and unknown-token responses; this adds the observed
Unable to introspect the access tokenfailure mode to the same classification and shares that classification between returned sync error objects and thrown exceptions.Related Issue
Fixes #56532
Type of Change
Changes
Unable to introspect the access tokenas a permanent auth condition.How to Test
.venv/bin/python -m pip install aiohttp(local test dependency needed by existing Mattermost tests in the same file).venv/bin/python -m pytest tests/gateway/test_ws_auth_retry.py -q.venv/bin/python -m ruff check plugins/platforms/matrix/adapter.py tests/gateway/test_ws_auth_retry.pyscripts/run_tests.sh tests/gateway/test_ws_auth_retry.py -qpytest tests/ -qPlatform: macOS, Python 3.13, local
.venv.