Repository navigation
fix(oauth): improve Cursor auto-import reliability on macOS - #4552
Merged
diegosouzapw merged 1 commit intoJun 21, 2026
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- macOS now probes both `Cursor/` and `Cursor - Insiders/` paths for `state.vscdb`, fixing a false "Cursor database not found" on Macs where only Cursor Insiders is installed. - When the DB exists but cannot be opened (e.g. WAL lock because Cursor is currently running), the route now surfaces the real reason instead of returning a generic not-found. - Multiple known key names are tried for both the access token (`cursorAuth/accessToken`, `cursorAuth/token`) and the machine id (`storage.serviceMachineId`, `storage.machineId`, `telemetry.machineId`). - JSON-encoded string values are normalized. - A macOS-only fuzzy `LIKE` fallback guards against future Cursor schema renames. Linux and Windows code paths are unchanged — all new behavior is gated behind `platform === "darwin"`. The token/path extraction helpers are factored into pure functions (`normalizeVscDbValue`, `extractCursorTokensFromRows`, `fuzzyExtractCursorTokensFromRows`, `cursorDbCandidatePaths`) and unit- tested without mocking SQLite or `fs`. Inspired-by: decolua/9router#161 Co-authored-by: Aakash Thakkar <thakkaraakash@hotmail.com>
diegosouzapw
force-pushed
the
fix/port-pr-161-cursor-macos-autoimport
branch
from
June 21, 2026 21:23
9d3dc1f to
e71b150
Compare
This was referenced Jun 21, 2026
Merged
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…inference#4552) Integrated into release/v3.8.33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens
/api/oauth/cursor/auto-importon macOS so it stops returning a false "Cursor database not found" or a silent failure in three real-world scenarios:~/Library/Application Support/Cursor/...and~/Library/Application Support/Cursor - Insiders/...and uses the first readable one.state.vscdbexists but cannot be opened (e.g. WAL lock because Cursor is running) — the route now surfaces the actual reason:Found Cursor database at <path> but could not open it: <message>, instead of the generic "Cursor database not found".itemTable— the route now tries multiple known names for both the access token (cursorAuth/accessToken,cursorAuth/token) and the machine id (storage.serviceMachineId,storage.machineId,telemetry.machineId), normalizes JSON-encoded string values, and as a last resort runs a macOS-only fuzzyLIKElookup (%cursorAuth/%,%machineId%,%serviceMachineId%) so a single key rename in a future Cursor release doesn't silently break auto-import.Linux and Windows code paths are completely unchanged — all new behavior is gated behind
platform === "darwin".The token/path extraction is factored into pure helpers (
normalizeVscDbValue,extractCursorTokensFromRows,fuzzyExtractCursorTokensFromRows,cursorDbCandidatePaths) so it can be unit-tested without mocking SQLite orfs.Test plan
tests/unit/oauth-cursor-auto-import.test.ts(Node native runner) — cover value normalization, exact-key extraction (incl. all alt key names), JSON-encoded value unwrapping, fuzzy fallback (case-insensitive), and per-platform candidate path resolution.npx eslint src/app/api/oauth/cursor/auto-import/route.ts tests/unit/oauth-cursor-auto-import.test.ts— cleancheck-docs-sync+check:any-budget:t11) — cleanInspired-by: decolua/9router#161
Co-authored-by: Aakash Thakkar thakkaraakash@hotmail.com