Skip to content

Fix auth invalidation during batch transcription - #7257

Merged
ComputelessComputer merged 1 commit into
mainfrom
fix/persist-auth-batch-recovery
Sep 2, 2026
Merged

Fix auth invalidation during batch transcription#7257
ComputelessComputer merged 1 commit into
mainfrom
fix/persist-auth-batch-recovery

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve the existing persisted session when Supabase refresh or transient account verification fails.
  • Synchronize explicit logout across every app window while continuing to ignore unsolicited SDK sign-out events.
  • Refresh Anarlog Cloud credentials before batch transcription and fall back to a still-valid current token when lookup or refresh is unavailable.

Validation

  • pnpm -F desktop test (431 files, 3695 tests)
  • pnpm -F desktop typecheck
  • pnpm fmt:check
  • pnpm exec oxlint --quiet --format=github apps/desktop/src/ (0 errors)

Note

High Risk
Broad changes to authentication persistence, multi-window sign-out, and when sessions are cleared—security-sensitive behavior with intentional relaxation of SDK-driven logout.

Overview
Fixes unexpected logouts during batch transcription and fragile Supabase refresh by making the desktop app own session persistence and treat SDK sign-out as non-authoritative unless the user (or main window) commits logout.

Session storage and startup: Tauri auth storage blocks the Supabase client from removing the primary session key; sessions are read back on cold start. Initial load falls back to the persisted session when getSession fails or returns empty, instead of clearing storage on “fatal” refresh errors (isFatalSessionError is removed).

Auth provider behavior: Unsolicited SIGNED_OUT from the SDK is ignored; explicit sign-out still runs the existing main/secondary coordination and now broadcasts anlg:auth-sign-out-committed so other windows clear only after a real logout. Transient cloudsync account verification failures keep the in-memory session rather than wiping auth.

API calls: New getSessionForRequest resolves a token for outbound requests (SDK lookup, proactive refresh within ~2 minutes, offline fallbacks). Batch transcription uses it for Anarlog Cloud / paid paths so jobs start with a fresh access token (existing 401 retry unchanged).

Reviewed by Cursor Bugbot for commit e31af0f. Bugbot is set up for automated code reviews on this repo. Configure here.

@netlify

netlify Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploy Preview for anarlog canceled.

Name Link
🔨 Latest commit e31af0f
🔍 Latest deploy log https://app.netlify.com/projects/anarlog/deploys/6a9843b8635e5400087d0ac8

Comment thread apps/desktop/src/auth/initial-session.ts Outdated
Comment thread apps/desktop/src/auth/context.tsx Outdated
Comment thread apps/desktop/src/auth/context.tsx
@ComputelessComputer
ComputelessComputer force-pushed the fix/persist-auth-batch-recovery branch from 56931ac to bc9a5e1 Compare September 2, 2026 12:07
@ComputelessComputer ComputelessComputer changed the title Keep auth persistent and recover stalled transcription Fix auth invalidation during batch transcription Sep 2, 2026
Comment thread apps/desktop/src/auth/context.tsx
Comment thread apps/desktop/src/stt/useRunBatch.ts Outdated
@ComputelessComputer
ComputelessComputer force-pushed the fix/persist-auth-batch-recovery branch from bc9a5e1 to 7068729 Compare September 2, 2026 15:29

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7068729. Configure here.

Comment thread apps/desktop/src/auth/context.tsx
Keep the existing persisted session unless the user explicitly signs out, and refresh cloud transcription credentials before starting a batch request.
@ComputelessComputer
ComputelessComputer force-pushed the fix/persist-auth-batch-recovery branch from 7068729 to e31af0f Compare September 2, 2026 15:41
@ComputelessComputer
ComputelessComputer merged commit 7629565 into main Sep 2, 2026
22 checks passed
@ComputelessComputer
ComputelessComputer deleted the fix/persist-auth-batch-recovery branch September 2, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant