Skip to content

fix: Matrix !relogin UnboundLocalError - #2516

Merged
RockChinQ merged 1 commit into
langbot-app:masterfrom
WODE25500:fix/stream-relogin-recovery-key
Sep 9, 2026
Merged

RockChinQ merged 1 commit into
langbot-app:masterfrom
WODE25500:fix/stream-relogin-recovery-key

Conversation

@WODE25500

@WODE25500 WODE25500 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What

!relogin crashed with UnboundLocalError for any configured Matrix bridge.

logout_cmd was assigned on a line after an unconditional continue inside the if not bridge.login_command or not bridge.dm_room_id branch. Because the continue always fired on that path, logout_cmd was never assigned, and the following lines.append(...) ran for the configured path, so any bridge with both login_command and dm_room_id raised UnboundLocalError and the admin command always crashed.

The fix moves the assignment above the if.

Tests

Added tests/unit_tests/test_matrix_relogin.py with four self-contained regression tests (no SDK / langbot_plugin dependency). All pass locally.

Notes

  • Rebased onto the latest master.
  • The Coze stream tail flush and Langflow tweaks default fixes from the earlier revision were split into separate PRs per review feedback.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅ 所有贡献者均已签署 CLA。
Posted by the CLA Assistant Lite bot.

@WODE25500

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

dadachann added a commit to langbot-app/cla that referenced this pull request Sep 7, 2026
@dadachann

Copy link
Copy Markdown
Collaborator

Thanks for the fixes, @WODE25500. The recovery-key/password-reset hardening has already been addressed in #2477, which is merged into master, so please drop the duplicate recovery-key changes.

Please rebase onto the latest master and keep this PR focused only on the Matrix !relogin fix and its regression test. Move the unrelated Coze and Langflow changes (including the Coze test) to separate PRs, and update the title and description accordingly.

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/langbot/pkg/platform/sources/matrix.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@WODE25500
WODE25500 force-pushed the fix/stream-relogin-recovery-key branch from 5df8885 to 0dac570 Compare September 7, 2026 17:37
@WODE25500 WODE25500 changed the title fix: Matrix relogin UnboundLocalError and stream tail loss fix: Matrix !relogin UnboundLocalError Sep 7, 2026
@WODE25500

Copy link
Copy Markdown
Contributor Author

@dadachann Done: rebased onto the latest master, dropped the duplicate recovery-key changes (already covered by #2477), and split the unrelated fixes into separate PRs:

This PR now contains only the Matrix !relogin fix and its regression test.

@RockChinQ
RockChinQ merged commit fc1c998 into langbot-app:master Sep 9, 2026
10 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants