fix(scripts): team_chat login keeps the token when the browser closes the tab first #2671

Closed
github-sync wants to merge 1 commit from github/pr/2671 into main
Owner

@dankman42 opened this pull request on GitHub · 2026-11-12 05:28 UTC · original
Merged on GitHub in 87991bc8b2

Signing in to the team chat on Windows can print a ConnectionAbortedError (WinError 10053) traceback, and the sign-in can be lost: the browser closes the connection before the "Signed in" page is sent, and the listener only saved the login token after sending it.

What changed

  • scripts/team_chat.py: the listener keeps the token as soon as the request arrives, then sends the page; if the browser has already gone, the reply is dropped quietly.
  • tests/test_team_chat.py: a sign-in whose reply fails with WinError 10053 still returns the token, with no traceback. It fails on main (the token is lost and the exact traceback from a real Windows sign-in prints) and passes with the change.

Tested

  • python -I -B tests/test_team_chat.py on Linux and in a Linux VM on Windows 11.
  • python -I -B tests/run_all.py on Linux: 416 passed, 2 failed, 72 skipped. The 2 (test_bake_ds, test_bake_portability) need zstd, absent on that machine, and fail the same on main.
  • Seen first-hand: the traceback appeared during a real Discord sign-in on Windows 11 (Python 3.12); the sign-in went through only because the browser asked again.

Not tested

  • The patched sign-in end to end on Windows (the account is already signed in).

🤖 Generated with Claude Code

> [@dankman42](https://github.com/dankman42) opened this pull request on GitHub · 2026-11-12 05:28 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2671) > **Merged on GitHub** in https://git.magicbean.dev/MagicBeanDev/Hookshot/commit/87991bc8b21c271f2dee3daf7f06fd006faa865c Signing in to the team chat on Windows can print a `ConnectionAbortedError` (WinError 10053) traceback, and the sign-in can be lost: the browser closes the connection before the "Signed in" page is sent, and the listener only saved the login token after sending it. **What changed** - `scripts/team_chat.py`: the listener keeps the token as soon as the request arrives, then sends the page; if the browser has already gone, the reply is dropped quietly. - `tests/test_team_chat.py`: a sign-in whose reply fails with WinError 10053 still returns the token, with no traceback. It fails on `main` (the token is lost and the exact traceback from a real Windows sign-in prints) and passes with the change. **Tested** - `python -I -B tests/test_team_chat.py` on Linux and in a Linux VM on Windows 11. - `python -I -B tests/run_all.py` on Linux: 416 passed, 2 failed, 72 skipped. The 2 (`test_bake_ds`, `test_bake_portability`) need zstd, absent on that machine, and fail the same on `main`. - Seen first-hand: the traceback appeared during a real Discord sign-in on Windows 11 (Python 3.12); the sign-in went through only because the browser asked again. **Not tested** - The patched sign-in end to end on Windows (the account is already signed in). 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- github-sync:item:2671 -->
Signing in on Windows can print a ConnectionAbortedError (WinError 10053)
traceback: the browser closes the connection before the "Signed in" page
is written, and the handler only recorded the token after that write, so
the token in that request was lost (login then depends on the browser
asking again, or waits out its timeout). The token is now kept before the
reply, and a reply to a browser that went away is dropped quietly.

tests/test_team_chat.py: a sign-in whose reply fails is still signed in,
with no traceback; it fails without the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MYKNiSo9t8ugZpwmqQ2F1Z
github-sync closed this pull request 2026-11-12 06:24:08 +00:00
Commenting is not possible because the repository is archived.
No description provided.