🐛 Bug Description
Both cancel_commit_callback and cancel_handler call context.user_data.clear(), which removes ALL keys including the running auth_task reference. The background _poll_device_auth task continues running as an orphan with no way to track or cancel it.
🔁 Steps to Reproduce
- Start the
/auth GitHub Device Flow.
- Cancel the flow via cancel button before it completes.
- Observe that the background polling task continues running.
✅ Expected Behavior
Cancelling the auth flow should properly cancel the background polling task.
❌ Actual Behavior
The orphaned polling task may still send success/failure notifications to the user long after cancellation. The task reference is lost so it cannot be properly managed.
🌍 Environment
| Field |
Value |
| OS |
Any |
| VS Code version |
Any |
| GitPhone extension version |
Any |
| Python version |
3.11+ |
📋 Additional Context
File: backend/bot.py:1228, 1234-1239, 1241
Fix: Cancel the auth task explicitly before clearing user data.
🐛 Bug Description
Both
cancel_commit_callbackandcancel_handlercallcontext.user_data.clear(), which removes ALL keys including the runningauth_taskreference. The background_poll_device_authtask continues running as an orphan with no way to track or cancel it.🔁 Steps to Reproduce
/authGitHub Device Flow.✅ Expected Behavior
Cancelling the auth flow should properly cancel the background polling task.
❌ Actual Behavior
The orphaned polling task may still send success/failure notifications to the user long after cancellation. The task reference is lost so it cannot be properly managed.
🌍 Environment
📋 Additional Context
File:
backend/bot.py:1228, 1234-1239, 1241Fix: Cancel the auth task explicitly before clearing user data.