Skip to content

user_data.clear() orphans running auth polling tasks #99

Description

@Vachhani-Tapan

🐛 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

  1. Start the /auth GitHub Device Flow.
  2. Cancel the flow via cancel button before it completes.
  3. 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.


Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds-triageAwaiting admin review

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions