TUI Supabase auth flow allows overlap and can hang indefinitely
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- supabase, typescript
- Domain
- authentication, cli
Research direction
Start in src/tui/dialog.tsx, reading runAuthFlow, startOAuth, closeDialog, setState, and the authorize() and callback() waits. Trace the dialog lifecycle and existing UI state before adding regression coverage for dismiss-then-retry overlap. Done means one active flow per session, explicit dismiss/retry behavior, and bounded timeout failures for both OAuth calls.
Written by the indexing model from the issue text.
Description
Summary
src/tui/dialog.tsx launches the Supabase OAuth flow as fire-and-forget work with no in-flight guard, no cancellation, and no timeout around the authorize() / callback() network calls.
This allows:
- overlapping auth attempts in a single session
- background auth work to continue after the dialog is dismissed
- retries that start a second flow while the first is still running
- dialogs that can hang forever if the callback path never resolves
Evidence
Fire-and-forget auth start
src/tui/dialog.tsx
178-186:startOAuth = () => runAuthFlow(...)195: idle stateonConfirm: startOAuth
No in-flight state is tracked outside the dialog UI state itself.
Dismiss only closes UI, not the network/auth flow
src/tui/dialog.tsx
139-145:closeDialog()setslifecycle.closed = trueand callsprops.onClose()147-175:setState()stops UI updates afterlifecycle.closed
This prevents stale UI changes, but it does not cancel the underlying runAuthFlow() promise or the host OAuth calls it is awaiting.
Retry can overlap a still-running attempt
src/tui/dialog.tsx
224-234: error dialogonConfirmdoesawait startOAuth()again
If a previous attempt is still running in the background, retry starts another flow.
No timeout around host OAuth calls
src/tui/dialog.tsx
65-68: waits onprovider.oauth.authorize(...)97-100: waits onprovider.oauth.callback(...)
Neither call has a timeout or abort path.
Reproduction
Overlap case
- Run
/supabase. - Confirm the dialog and let it reach "Waiting for authorization...".
- Dismiss the dialog before completing the browser callback.
- Re-open
/supabaseand start auth again. - Complete one or both browser flows.
Expected
At most one Supabase auth flow should be active per dialog/session/store, and retry should either cancel or await the existing attempt.
Actual
Multiple auth flows can overlap. The first one can continue running after the dialog is gone.
Hang case
- Run
/supabase. - Start auth.
- Make
authorize()orcallback()stall indefinitely (e.g. broken server path, unreachable host endpoint, unresolved callback).
Expected
User gets a bounded timeout and a recoverable retry path.
Actual
The dialog can remain stuck waiting indefinitely.
Impact
- Confusing UX with multiple browser tabs or competing flows.
- Last-finishing auth flow wins, even if it is not the one the user intended.
- Hanging auth requests have no bounded recovery path.
Suggested Fix
Recommended approach:
- Track a single in-flight auth promise for the dialog lifecycle.
- Block re-entry while one flow is active, or convert retry into "cancel then restart".
- Add timeout wrappers around
authorize()andcallback(). - If possible, thread cancellation/abort through the flow so dismiss actually cancels the work instead of only hiding the UI.
Acceptance Criteria
- User cannot start a second Supabase auth flow while one is already active.
- Dismiss/retry semantics are explicit and deterministic.
authorize()andcallback()fail with a clear timeout instead of hanging forever.- Regression coverage exists for dismiss-then-retry overlap.
Notes
This is mostly a reliability/UX issue, but it can indirectly affect correctness because multiple flows can race to update the same local auth store.
- Dominant language
- TypeScript
- Stars
- 35
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase-community/opencode-supabase
-
priority:p3 status:blocked status:triaged
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
enhancement priority:p3 status:triaged
Difficulty 4/5 3-5 days Newbie friendliness 48/100
supabase-community/opencode-supabase#46 · 1 comment ·
-
bug priority:p2 status:triaged
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
bug priority:p1 status:triaged
Difficulty 5/5 Over a week Newbie friendliness 35/100
supabase-community/opencode-supabase#37 · 1 comment ·
-
bug priority:p2 status:triaged
Difficulty 4/5 3-5 days Newbie friendliness 52/100
All issues in supabase-community/opencode-supabase
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·