Repository navigation
experiments: run the real cursor SDK login against a local backend - #150
Merged
Merged
Conversation
xxchan
force-pushed
the
cursor-login-experiment
branch
from
October 6, 2026 09:49
5352f6d to
eb765d4
Compare
5 of 6 tasks
xxchan
added a commit
that referenced
this pull request
Oct 7, 2026
Adds `login` and `authStatus` to the **cursor** runtime, under the contract #94 introduced for claude and codex (`contracts/login.ts`, `docs/spec/login.md`). #94 left cursor until its adapter moved to `@cursor/sdk`. The SDK has a login of its own (`Cursor.auth.login` / `status`), and OAR now uses it. So a host that finds cursor logged out can sign it in without a terminal, from another device. **The real login passed on a real account** (2026-10-06 and 2026-10-07, fresh Linux test machine, `@cursor/sdk` 1.0.36, commit `d6ece22`): the checklist below, steps 1 to 4. The optional race step was not run by hand; #150 pins that window against the real SDK with a mock backend. ## What - `runtimes/cursor/login.ts` (`cursorLoginWith(load)`) and `runtimes/cursor/auth-status.ts` (`cursorAuthStatusWith(load)`) follow claude's split. `createCursorRuntime` wires both in, and `CursorRuntime` now guarantees `login` and `authStatus`. - **login:** calls `Cursor.auth.login({ openBrowser: false, onLoginUrl, signal, store })`. The URL from `onLoginUrl` goes out as one `auth_url` event ("Open this URL on any device and sign in to Cursor; the login completes on its own."). There is no prompt: the SDK polls on the server side. - A resolved login is confirmed with `Cursor.auth.status`. - Deadline: 15 min. The SDK's own poll gives up after about 24 min, so OAR's deadline comes first. - **authStatus:** reads only `Cursor.auth.status()`, with `source: "Cursor.auth.status"`. - `logged-in` maps to `logged_in` with `account: { email?, expiresAt? }`. - `logged-out` maps to `logged_out`. - A throw, a timeout (20 s default) or an unreadable shape is `unknown` with a redacted detail. - **Installation:** cursor's installation is `{ via: "bundled" }`. The login checks for exactly that and does not use `loginExecutable`, which would wrongly answer `unsupported_installation`. - Any other installation is `unsupported_installation`. - An SDK without `Cursor.auth` or `FileCredentialStore` is `version_unsupported` (`@cursor/sdk 1.0.35 is required`). - A failed SDK load is `process_failed`. - **`CursorSdk` (sdk.ts):** gains `Cursor.auth?` (`login`, `status`) and `FileCredentialStore?`, narrowed to what is used. - Both are optional, so a host's own stand-in for the SDK keeps compiling. - When they are present, the host's compile still checks their shape against the real SDK. I checked that a wrong `status` or `FileCredentialStore` shape fails `sea-trial/harness/runtimes.ts` against the real module. - **CLI:** `oar login cursor` works through the existing command. `oar list` shows `login: true, authStatus: true` for cursor, and `--status` prints the expiry: `logged in as [email protected] (expires 2027-01-04T12:00:00.000Z)`. ### Contract addition: `LoginAccount.expiresAt?: UtcInstant` The SDK's `apiKeyExpiresAtMs` is carried as `LoginAccount.expiresAt`. The change is additive and documented on the field and in `docs/spec/login.md`. Why this place and this form: - **Why `LoginAccount`:** both `LoginResult.logged_in.account` and `AuthStatus.logged_in.account` already carry it. A login's result and the status both show the expiry, and no union variant changes shape. `LoginAccount` already describes the sign-in, not only the person: see `method`. A field on the `logged_in` AuthStatus variant only would have left it out of a login's result. - **Why `UtcInstant` and not raw ms:** the contracts already carry a runtime-reported instant as the branded ISO string `UtcInstant` (`AccountUsageWindow.resetsAt`). Converting the epoch ms is lossless (ms precision). - **Meaning:** the field is set only where the runtime reports an expiry for a credential it does not renew itself. Today that is only cursor's minted key, which lasts 90 days with no refresh. ## Reviewer rules and how each holds (evidence: `@cursor/sdk` **1.0.35**) The SDK ships minified with no public source. I read the installed bundle `dist/esm/index.js`, in the modules `Ne.auth`, `./src/agent/auth/login-flow.ts` and `./src/agent/auth/credential-store.ts`, together with their `dist/esm/auth/*.d.ts`. `dist/cjs` and `dist/bundled` contain the same code. **1. `openBrowser: false`; the URL reaches the host only through `onLoginUrl`; no paste-back prompt.** - `Cursor.auth.login` builds the handshake and calls `t.onLoginUrl?.(n.loginUrl)` first. Then `let s = void 0 !== t.onLoginUrl`, and with `openBrowser` false it skips the opener. The `process.stderr.write("Could not open a browser…")` runs only when `!s`, so with `onLoginUrl` set the SDK prints no URL. - OAR relays the URL as `auth_url` and asks no prompt. Test: `the URL reaches the host through onLoginUrl only…` asserts `openBrowser === false` and that no prompts were asked. **2. Cancel through `interaction.signal`; after a cancel, timeout or failure, `~/.cursor/sdk/auth.json` is not written.** What the SDK does: - **Poll:** `pollForLoginTokens({ signal })` checks `signal.aborted` before each attempt, passes `signal` to each `fetch`, and wakes the backoff sleep on abort. It then returns `null`, and `login` throws `AuthenticationError("Login was cancelled.")`. That is 150 attempts with a delay of `min(1000·1.2^n, 10000)` ms, about 24 min. - **Mint:** after the poll returns tokens, `mintUserApiKey` (`createUserApiKey`, then `getMe`) runs without the signal. - **Save:** then `if (null !== t.store) { const e = t.store ?? ut(); …; await e.save(n); clearStoredLoginCache() }` runs unconditionally. `ut()` is `new FileCredentialStore()`, and `FileCredentialStore.save` opens the file with `"w"`, mode 0600. - Nothing is written before that `save`, and login never calls `clear`. - **So the SDK alone does not meet the rule:** an abort that lands after the browser sign-in, during the mint, is ignored, and the file is written. How OAR guarantees it: - OAR passes its own `store`. Its `save` hands the SDK's credential object, unread, to the SDK's own `new sdk.FileCredentialStore()`: the same default path that `status()` reads. It does so only while the login is `waiting`. - Once OAR has ended the login (abort, deadline, or a throwing `onEvent`), `save` throws and writes nothing. OAR also aborts the signal it gave the SDK, which ends the poll. - The check-and-set is synchronous on both sides, so whichever comes first decides: - The save began first: the login stands. A later abort or deadline waits for the save and yields `logged_in`, as the contract's "success is final" requires. - The end came first: every later save is refused, so `cancelled` and `timed_out` always mean auth.json was not touched. - The gate's `clear` always throws (never log out first), and `load` returns nothing (login never reads its store). - Tests: a cancel while polling; a cancel while minting, where the fake ignores the signal like the SDK, and its late save is refused; the deadline in both phases; a stop while the save is held (`logged_in`). **3. `authStatus` only reads `Cursor.auth.status`; no key anywhere; expiry carried; `source` named.** - `status()` is `store.load()` on the file, then `logged-out` (missing, corrupt or expired) or `{ "logged-in", backendUrl, email, apiKeyExpiresAtMs }`. It never returns the key. - OAR reads that and nothing else (`source: "Cursor.auth.status"`). - A test feeds a status object that carries an `apiKey` and asserts the key appears nowhere in the result. **4. No token or code in an event, result, error or log; `detail` redacted.** - OAR types the SDK's login result as `unknown` and drops it unread. - Every `detail` is `LoginSecrets.line()`: the first line, with the `sk-…` and JWT shapes redacted, capped at 500 characters. - Tests: a mint error carrying a JWT gives `[redacted]`; a status error carrying an `sk-` token gives `[redacted]`; a leak check confirms the minted key is absent from events and results. **5. Contract semantics.** - Success is final (above). - A resolved login is confirmed via status: - `logged-out` is `failed / not_logged_in`. - A status that fails, or an aborted caller, gives `logged_in` without an account, per the contract text. - `failed` reasons come from the existing union: - Any SDK rejection is `rejected`: its own poll failing or running out, a refused key ("Login succeeded, but creating an SDK API key failed: …"), or a save that failed. - A failed load is `process_failed`. - A throwing `onEvent` is `interaction_failed`. - `unsupported` appears only for a non-bundled installation or an SDK without `Cursor.auth`. - **`CURSOR_API_KEY`:** the SDK's precedence (`resolveDefaultApiKey`) is an explicit key, then `process.env.CURSOR_API_KEY`, then the stored key, and `status()` ignores the variable. OAR does not guess. `authStatus` reports the stored login only. A login started with the variable set adds an `info` event: "CURSOR_API_KEY is set in this environment: cursor uses it, not the stored login, until it is unset." Only the variable's presence is checked; its value is never read. Documented on the runtime page. ## Not guaranteed / for the reviewer to decide - **A minted key can be left unsaved.** If a stop lands after the browser sign-in but before the save (the mint RPCs), the SDK has already minted a key on Cursor's side. OAR refuses to store it, so it stays in the dashboard's API-key list as `Cursor SDK login (<hostname>)` until it expires (90 days) or is revoked. The SDK has no revoke call. auth.json is untouched. This is documented. - **OAR returns at once on a stop.** An SDK mint already in flight finishes in the background, and its save is refused. OAR does not wait for it, because the mint takes no signal. - **One SDK warning reaches stderr.** When a backend has no `POST /auth/poll`, the SDK falls back to `GET` and writes a warning to stderr. It names the backend, not the verifier. OAR cannot suppress it (`onWarning` is not an option), and against production it should not occur. - **Cursor's key format is not redacted by shape.** The SDK does not document it, so there is no token shape for it in `LoginSecrets`. No path I found carries the key into a `detail`. - **Decisions:** - `expiresAt` as `UtcInstant` on `LoginAccount`, rather than raw ms or a field on `AuthStatus`. - `Cursor.auth` and `FileCredentialStore` as optional members of `CursorSdk` (doesn't break a host's stand-ins), rather than required (stricter drift check). - `authStatus` ignores `CURSOR_API_KEY`, and the login adds an `info` event about it. - A key stored against another `CURSOR_BACKEND_URL` reads `logged_in` from the SDK's status even though the SDK only uses it against that backend; OAR passes this through. - **Possible stronger evidence, not done (rule 8):** run the real SDK's `Cursor.auth.login` against a local mock backend (`CURSOR_BACKEND_URL`) with a temporary `HOME`, as an experiment pinning the cancel-during-mint window on the real code. It needs no account and touches no real credentials. Say if you want it. ## Tests `tests/login/cursor-login.test.ts`, `tests/login/cursor-auth-status.test.ts`, with a stand-in SDK (`tests/fixtures/fake-cursor-auth.ts`) that runs 1.0.35's order: `onLoginUrl`, a poll that honours the signal, a mint that ignores it, then `store.save`. Its `FileCredentialStore` writes what `status()` reads. No network, no real SDK. - the URL relayed; `openBrowser: false`; no prompt; success gives `logged_in` with `{ email, expiresAt }` from status; the key is written once and leaks nowhere - a cancel while polling gives `cancelled`: the SDK's signal is aborted, it throws `Login was cancelled.`, and nothing is written - a cancel while minting gives `cancelled`: the late save is refused, nothing is written, and the status still shows the previous login - the deadline, while polling and while minting, gives `timed_out` and nothing is written - a cancel or deadline while the save is held gives `logged_in` (without an account after an abort; with the account after a deadline) - SDK rejections (poll failure, mint failure with a JWT, save EACCES) give `rejected` with a redacted first line - the status after save reads logged out (`not_logged_in`) or throws (`logged_in` without an account) - a throwing `onEvent` gives `interaction_failed`, with the SDK aborted and nothing written - `CURSOR_API_KEY` set gives the `info` event, and its value appears nowhere - an already-aborted signal (SDK not even loaded), a non-bundled installation, an SDK without `Cursor.auth`, a failed load - the status: logged in with and without fields, logged out, a throw (redacted), no answer within `timeoutMs`, a non-bundled installation, no `Cursor.auth`, a failed load, unreadable shapes; never the key - CLI: `--status` renders the expiry `pnpm run check` passes: typecheck (including the CLI against the real `@cursor/sdk` 1.0.35), lint, 672 tests passed / 31 skipped, and mock sea-trial 19/19. `CI=1 pnpm vitest run` passes with snapshots enforced, and `pnpm run build` passes. Rebased on main `6386132` (v0.23.0, opencode). ## Real-login checklist (passed 2026-10-07) Don't print auth.json's contents: compare a hash prefix and the mtime only. Linux: `sha256sum ~/.cursor/sdk/auth.json | cut -c1-16; stat -c %Y ~/.cursor/sdk/auth.json`. macOS: `shasum -a 256 … | cut -c1-16; stat -f %m …`. Run in a shell where `CURSOR_API_KEY` is unset (`[ -z "${CURSOR_API_KEY+x}" ] && echo unset`). - [x] `oar login cursor --status`: note the state (and the expiry, if logged in). Note auth.json's hash prefix and mtime, if the file exists. - [x] `oar login cursor`: no browser opens on the machine and no paste prompt appears. Open the printed URL on another device and sign in. Expect `cursor logged in as <email> (expires <about 90 days from now>)`, exit 0. Then `--status` shows the same account and expiry, and the hash and mtime changed. - [x] `oar login cursor` again, and press Ctrl-C while it waits, before signing in. Expect `cursor login cancelled`, exit 130. auth.json's hash and mtime are unchanged, and `--status` is unchanged. - [x] `oar login cursor --timeout 30000` without signing in. Expect `login failed: timed_out (no sign-in within 30000 ms)`, with auth.json unchanged. - [ ] Optional (the window the store guards, hard to hit by hand): sign in on the other device and press Ctrl-C right as the page confirms. Expect either `login cancelled` with auth.json unchanged, or `logged in` with it changed; never `cancelled` with a changed file. A cancelled run may leave a `Cursor SDK login (<host>)` key in the dashboard: revoke it. - [x] (auth.json removed from the test machine; the minted `Cursor SDK login (cindytest)` key stays in the dashboard until revoked) Afterwards, if wanted: OAR has no logout. Remove `~/.cursor/sdk/auth.json` and revoke the test key in the dashboard. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: exe.dev user <[email protected]>
handing `Cursor.auth.login` a store that refuses the late save. That rests on how SDK 1.0.35 behaves (it stops polling on its signal, mints without it, and only then saves, through the store it is given), which #146 read from the minified bundle and pinned only with a stand-in SDK. An SDK upgrade that wrote the file directly, or before the store's save, would silently break the guarantee. `experiments/cursor-login/probe.ts` runs the real SDK through OAR's cursor `login` and `authStatus` against `mock-backend.ts`, which serves the endpoints the bundle calls (the login page, `POST /auth/poll` with a PKCE check, and the Connect `CreateUserApiKey` and `GetMe` RPCs). Each scenario has its own temporary HOME (XDG and Windows profile directories too), `CURSOR_API_KEY` is unset, and every TCP connection but the mock's is refused and fails the run; a first check proves the guard refuses fetch, node:http and net.connect. Keys and tokens are fake; auth.json is reported as a hash prefix, mtime and mode only. It needs no account, so it is meant to run on every `@cursor/sdk` upgrade: the experiment README, the index, the cursor runtime page and the version-check note in runtime-versions.ts say so. On 1.0.35 the guard check and all 9 scenarios pass (success; cancel and deadline while polling and while minting, each in an empty home and over a previous login). Handing the SDK its default store instead of OAR's fails the four mint-window scenarios with `auth.json changed after a stop`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The probe passed 9/9 again on @cursor/sdk 1.0.36, the version #152 pins. Co-Authored-By: Claude Opus 5.5 <[email protected]>
xxchan
force-pushed
the
cursor-login-experiment
branch
from
October 7, 2026 02:04
eb765d4 to
c253310
Compare
Merged
xxchan
added a commit
that referenced
this pull request
Oct 7, 2026
Release OAR and CLI 0.26.0. This PR changes only the two package version fields. **New** - cursor `login` and `authStatus` through the SDK's own `Cursor.auth` (#146): the URL is relayed as an `auth_url` event and the login ends on its own once the user signs in on any device; nothing is pasted back. `LoginAccount.expiresAt` (a `UtcInstant`) carries the expiry of cursor's minted key (90 days). Needs `@cursor/sdk` 1.0.36, which 0.25.0 already pins. Passed a real-account checklist on a fresh Linux machine. `oar login cursor` works through the existing command. - `experiments/cursor-login`: the real SDK login against a local mock backend, to run on every `@cursor/sdk` upgrade (#150). **Fixes** - Executable probes (`--version`, `--help`, login status) default to 15 seconds instead of 5, after repeated Windows `.CMD` start-up timeouts (#155, closes #57). - Account usage: a probe that times out or fails to start rejects instead of answering `unsupported` (claude, kimi); `timeoutMs` bounds the whole read, default 30 seconds for claude, kimi and grok (#156). - CLI: `oar installation`, `models`, `usage`, `skills`, `mcps`, `tools` and the MCP `runtimes` tool report a failing runtime in its own entry instead of losing every runtime's output; the exit code is 1 when any failed (#156). **Not host-facing**: live probe model defaults (#153), cursor docs (#157). Validation: `pnpm run check` passed locally on #146 after its rebase; all 13 checks passed on the final heads of #146 and #150. After this PR passes CI and merges, tag its exact squash commit as `v0.26.0` to trigger npm trusted publishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 2, 2026
stamp-build Bot
added a commit
that referenced
this pull request
Nov 2, 2026
…598) <!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_b069ca578f942ea2eea7df444945aa16"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> Weekly maintenance pass 2026-11-02, design and root README. Scope: 150 commits since the 2026-10-19 pass (0.68.1 to 0.83.0 plus unreleased #590 to #597 and #509). - `roadmap.md`: the shipped list adds placement (`Runtime.execution`, Pi RPC subprocess, `withPlacement`, no native runtime admitted to sharing), interrupt delivery, `userConfiguration: "exclude"` and login/logout/status environments. - `liveness.md`: the release record is shipped; links the record contract. - `system.md`: rule 1 now carries the observed OpenCode plugin and Grok stdio MCP child-environment counterexamples; rule 5 no longer lists per-runtime admission status (design pages hold positions; the evidence index and runtime pages hold status). - Root `README.md`: install, login, status and logout lists match the runtime registry (checked through the source registry); adds the login `env`/`userShellEnvironment()` note, interrupt delivery, `userConfiguration` (Claude, Cursor) and `oar orient`. Docs only. `CI=1 pnpm run check` on the combined pass branch: typecheck and lint pass; the only failures are the 10 `tests/grok/shared-session.test.ts` cases that fail on Linux arm64 on main as well (candidate platform gate; tracked separately as task #150). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 2, 2026
<!-- stamp:review:v1 --> <sup><img src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp" width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_67fc183681de318606f7a76def6b6e6a"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> On Linux arm64, the Grok candidate correctly opens isolated processes, but the shared-session fixtures assume shared placement and fail their PID and lifecycle assertions. Gate the shared-only cases with `grokCandidateRefusal(installation, process.platform, process.arch)` and add an unsupported-platform case that checks separate isolated PIDs, the exact explicit-sharing refusal, and continued use of an existing session. The existing fallback cases still run on every platform. This changes only `tests/grok/shared-session.test.ts`; the candidate platform list and product behavior are unchanged. Validation: - `CI=1 pnpm run check`: 2,984 tests and 18 mock behaviors passed. The final rebase adds only main's runtime documentation changes; all non-documentation files match the checked tree. - Focused shared-session and admission tests on Linux x64: 52 passed, 1 skipped. - Linux x64 worker with `process.arch` overridden to `arm64`: the two original shared-placement cases fail before the fix; the corrected shared-session file passes 5 cases and skips 11 shared-only cases. This exercises the unsupported-platform branch, not native ARM execution. Raft task #150. Co-authored-by: Otter <[email protected]>
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.
Stacked on #146. The base is
cursor-login, because #146 is not merged yet. Retarget this PR tomainonce #146 merges; this branch adds one commit on top of it.Cindy asked for this on #146: "the experiment that runs the real SDK against a local mock backend should be done, but not block this merge: open a separate PR putting it in experiments, and run it every time the cursor SDK is upgraded. It catches changes like the SDK bypassing the store and writing the file directly, and needs no account."
Why
#146 keeps a cancelled or timed-out cursor login from writing
~/.cursor/sdk/auth.jsonby handingCursor.auth.logina store that refuses a save once OAR has ended the login. That depends on how@cursor/sdk1.0.35 behaves:#146 read this from the minified bundle and tested it against a stand-in SDK only. An SDK upgrade that wrote the file directly, or before the store's save, would quietly break the guarantee. This experiment checks it on the real SDK.
What
experiments/cursor-login/containsprobe.ts,mock-backend.tsandREADME.md.The mock backend. It serves only the endpoints the 1.0.35 bundle calls:
GET /loginDeepControl?challenge=…&uuid=…, which the probe "opens" from theauth_urlevent, signing that uuid in;POST /auth/poll:404 Not founduntil the page has been opened, then tokens oncebase64url(sha256(verifier))matches the page's challenge (a PKCE check);aiserver.v1.DashboardService/CreateUserApiKeyandGetMe(binary protobuf over HTTP/1.1, field numbers from the bundle). The mint can be held open, so the scenarios can stop the login inside that window.The probe. It runs the real SDK through OAR's cursor
loginandauthStatus, nothing mocked on the OAR side. The SDK'sCursor.auth.loginis teed: OAR's options pass through unchanged and the SDK's own promise goes back to OAR. The probe keeps a copy of how it settled, because OAR drops that outcome after a stop.Isolation (no account, no network, no real credentials):
HOME,USERPROFILE, theXDG_*directories andAPPDATA/LOCALAPPDATApoint into a temporary directory, and every scenario gets its own home. Each scenario asserts that the SDK's owngetDefaultSdkAuthPath()resolves inside it.CURSOR_API_KEYand the proxy variables are unset.CURSOR_BACKEND_URLandCURSOR_WEBSITE_URLpoint at the mock.net.Socket.prototype.connect(fetch,node:http, http2, TLS), and any connection to something other than the mock is refused and fails the run. A first check proves the guard refuses fetch,node:httpandnet.connectto127.0.0.2. That check uses a port fetch does not block on its own: fetch refuses port 9 itself, before connecting.auth.jsonis reported only as a sha256 prefix, its mtime and mode, and the probe asserts that no key or token reaches an event or a result.Run on every SDK upgrade:
pnpm tsx experiments/cursor-login/probe.ts [--keep], about 40 s, exit 0 only if every line passes. This is documented in:experiments/runtime-versions.ts(the version-check step that says what to run for a changed version).There is no automated "run on SDK bump" list in the repo, so that header is where it is wired in. Experiments do not run in CI by convention.
Results (local, 2026-10-06,
@cursor/sdk1.0.35, Linux x64, Node 24)Negative control. I temporarily handed the SDK its default store instead of OAR's, which simulates "the SDK bypasses the store". The four mint-window scenarios then fail with
auth.json changed after a stop, and the other five still pass. So the experiment catches the regression Cindy described.Real SDK vs #146's assumptions: no contradiction.
GetMe, and only then saves, through the store it was given. OAR's refusal leavesauth.jsonabsent, or byte for byte and mtime as it was.onLoginUrlset andopenBrowser: falseit printed 0 bytes. It never fell back toGET /auth/poll, and it called no endpoint beyond the four.UnknownAgentError: …in its own rejection, which OAR ignores.Not found, or the SDK switches to the GET fallback, which puts the verifier in the URL.Not covered
Checks
pnpm run checkpasses: typecheck, which compiles the probe against the real SDK; lint; 672 tests passed, 31 skipped; and mock sea-trial 19/19.CI=1 pnpm vitest runpasses too. CI does not run the experiment itself, but it type-checks and lints it.🤖 Generated with Claude Code