fix(linux): restore Cursor app authentication - #3539
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb8657cb00
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #endif | ||
|
|
||
| #if os(macOS) | ||
| #if os(macOS) || os(Linux) |
There was a problem hiding this comment.
Honor HOME when resolving the Linux Cursor database
When XDG_CONFIG_HOME is unset and the CLI runs with HOME different from the account’s passwd home (common in containers, systemd services, or isolated environments), the newly enabled Linux store defaults home from NSHomeDirectory(), which ignores the process HOME value on Linux. It therefore looks under the passwd home’s .config directory instead of $HOME/.config, so a valid Cursor login is reported as missing; derive the fallback from the supplied environment’s absolute HOME before falling back to NSHomeDirectory().
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 9:01 AM ET / 13:01 UTC (Revision 2). ClawSweeper reviewWhat this changesRestores Linux Cursor authentication using the signed-in app’s local token, preserves cookie precedence, and adds path-resolution tests, documentation, and runtime evidence. Merge readiness✅ Ready for maintainer review The previous HOME blocker is resolved, and no actionable introduced defects remain. Current main and v0.58.0 still lack this Linux authentication path, so the PR remains useful. Priority: P2 Review scores
Verification
How this fits togetherCodexBar’s Cursor provider resolves local credentials and requests account usage from Cursor. The resulting usage windows feed CLI JSON and cards, including the optional Grok Bot allowance. flowchart TD
A[CLI source and cookie settings] --> B[Credential selection]
C[Manual or cached cookies] --> B
D[Cursor local database] --> E[Check token expiry]
E --> B
B --> F[Cursor usage endpoints]
F --> G[Usage JSON and cards]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Reuse the shared token reader and usage endpoints while retaining Linux cookie precedence, explicit web isolation, and environment-aware database discovery. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure: current main excludes the app-token reader on Linux and rejects automatic mode without manual cookies. This review did not execute a failing current-main run. Is this the best way to solve the issue? Yes. Reusing the existing authentication and usage machinery is a focused restoration, and the revised HOME handling resolves the prior review’s concrete defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7fdc17636f16. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Prefer process HOME over NSHomeDirectory when XDG_CONFIG_HOME is unset so redirected-home environments still find Cursor app credentials.
|
@clawsweeper re-review Addressed the P2 HOME fallback: absolute |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Cursor Linux app-auth PR draft
Summary
Restore Linux Cursor usage through the signed-in Cursor app token, including the Grok Bot allowance, while preserving
manual-cookie precedence and keeping explicit web mode independent of app credentials.
Reference: upstream PR #1908, merged at
7807679535394caa78b75526caf433057377648f.Thanks @DonnieFi for the original contribution.
Maintainer improvements
main.webmode manual-cookie only.XDG_CONFIG_HOMEhandling, including a literal~/customregression case.Behavior
--source webrequires a manual cookie and never reads app credentials.Proof
make testpassed 94 tests in 9 suites (69 selections, 6 groups)./home/red/.local/bin/codexbar.The screenshot is the supplied redacted CLI card capture and shows Cursor, Third Party, and Grok Bot windows.
make checkreaches the repository checks but cannot complete on Debian because its installer regression requires macOSAppleScript. The Linux lint lane reaches portable checks but SwiftLint cannot load Debian SourceKit.
Exact reviewed source head:
ca649a5850f14d39cc90b262b7b2749ea5836035(rebased onto upstreammainat7fdc176).