Repository navigation
feat(runtimes): sign claude, codex and cursor out through their own logout - #196
Merged
Merged
Conversation
…ogout Adds the optional `Runtime.logout(installation, options?)` in the shape decided on #192, next to `login` and `authStatus`: - `LogoutResult`: `logged_out` | `failed` (`LogoutFailureReason`: `timed_out`, `rejected`, `process_failed`, and `still_logged_in`) | `unsupported` (login's `LoginUnsupportedReason`). - Only the runtime's own logout: `claude auth logout`, `codex logout` (both over pipes, stdin closed, own process group, nothing forwarded), and `Cursor.auth.logout()` with the SDK's own store. No credential file is deleted by OAR. - `authStatus` decides afterwards: `logged_out` only when it reads logged out (also when the runtime was logged out already); a logout that succeeded while the status still reads logged in (an API key in the environment) is `still_logged_in`, with what it read. Environment variables are never touched. Details are redacted as a login's are. - `oar logout <runtime>` (`--json`, `--timeout`), exit 0 when logged out, 1 otherwise; `oar list` shows `logout`. - Docs: the logout section of the login spec, each runtime page with its server-side behaviour (claude and codex revoke their OAuth token, best effort; cursor's minted key stays valid and the SDK cannot revoke it), capabilities, READMEs. - Tests with the fake claude and codex CLIs and the stand-in cursor SDK; the cursor probe now also runs the real SDK's logout in temporary homes. Refs #192 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…me's report Review on #196: when the runtime's logout succeeded and its status query cannot tell (`unknown`), the result is `logged_out` on the runtime's own report, as a login's success is `logged_in`; `process_failed` would read as a broken logout command. A status that reads logged in is still `still_logged_in`, and a failed logout is still its failure. The codex page now also says that codex goes on using `CODEX_API_KEY` / `OPENAI_API_KEY` after a `logged_out`. Refs #192 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
xxchan
added a commit
that referenced
this pull request
Oct 7, 2026
Release OAR and CLI 0.34.0. This PR changes only the two package version fields. **New** - `Runtime.logout` (#196, closes #192), next to `login` and `authStatus`, on claude, codex and cursor (absent on other runtimes; pi keeps its provider logout in `createPiProviderAuth`). `oar logout <runtime>` on the CLI. - Only each runtime's own logout runs: `claude auth logout`, `codex logout`, the Cursor SDK's `Cursor.auth.logout`. OAR never deletes a credential file itself, and never touches environment variables. - `authStatus` decides afterwards: `logged_out` when the status reads logged out (or, when it cannot tell, the runtime reported its logout succeeded); `failed` / `still_logged_in` when it still reads logged in (for claude, an `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN` in the environment), with what it read in `detail`. - Server side: claude and codex revoke their tokens (best effort); cursor only deletes its local `auth.json`, so the key it minted at login stays valid in the Cursor dashboard until it expires or is revoked there. codex keeps using `OPENAI_API_KEY` / `CODEX_API_KEY`, and cursor `CURSOR_API_KEY`, after a `logged_out`. - Floors: claude 2.1.41, codex 0.15.0, `@cursor/sdk` with `Cursor.auth.logout` (1.0.35+). Validation: all 13 checks passed on #196's final head (`e2b828e`); the real `@cursor/sdk` 1.0.36 logout probe passed in temporary homes, and real claude 2.1.292 / codex 0.160.1 logouts ran in temporary homes without network. A real-account checklist runs on a test machine after release. After this PR passes CI and merges, tag its exact squash commit as `v0.34.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]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 6, 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_0c93da2f9828c0a4252e8d3d71fe2ffb"><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 --> Windows Codex CI has unexplained preparation and wait delays, alongside separately reproduced fixture bugs. Add one manually dispatched comparison: default, two and one Vitest file workers on three Windows runners each, with Node 24.22.2, npm 11.19.1, pnpm 11.22.0 and Codex 0.167.0 fixed. The original behavior-suite predecessor and complete vendor suite remain. Experiment-only observers retain global preparation, fixture setup, warmup initialize/exit, session open, native boundaries and cleanup phases. A separate PowerShell sampler records CPU, memory, disk and process measurements without an extra CIM warmup. The analyzer preserves missing/duplicate runner slots, unfinished phases and failures. Existing CI, merge gates, assertions, per-case deadlines, snapshots and the eight-session concurrency regression are unchanged; no product source changes. [Protocol, evidence and limits](https://github.com/botiverse/oar/blob/ce89494f5fcb265844617c59c36e1717af756c67/experiments/windows-codex-ci/README.md) include a separate DSH installation finding: a successful Windows job could not save npm's download cache because both configured paths were absent. Querying `npm config get cache` is the proposed correction; `ci.yml` is not changed here, and no installation speedup is claimed. Validation on Linux with Node 24.19.0 and Codex 0.167.0: `CI=1 pnpm run check` passed (3,627 tests and 18 mock behavior cases); all 77 instrumented native Codex vendor checks passed; eight selected native checks passed at each explicit worker setting, including the eight-session case. Phase pairs and worker records were inspected, nonzero Vitest exit remained nonzero, actionlint 1.7.12 passed, and PowerShell 7.6.9 parsed the sampler. Windows counter execution and the nine-runner comparison remain pending. The vendor step is bounded at 60 minutes and the job at 90 minutes. A limit hit remains a recorded sample, without rerunning or increasing the limit. After collection, a separate change will remove the temporary workflow and framework instrumentation while retaining experiment materials and conclusions. After review/CI/merge registers the workflow on the default branch, dispatch this initial round once. Nine green samples will not establish a root cause; any regular CI concurrency change requires a separate result and decision. Task #196 remains in review through the comparison. --------- Co-authored-by: Otter <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 6, 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_a4a8013136af0fa3cc7f8db9bcdb191c"><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 --> The first Windows Codex worker comparison is complete. Preserve all nine original samples and their source digests, and remove the temporary workflow and shared fixture hooks as agreed. Remove the logger's four regular-suite tests too. The workflow and logger remain under `experiments/windows-codex-ci`; both shared fixture files return byte-for-byte to their pre-experiment contents. Default and two-worker groups each passed three jobs. The single-worker group passed two and timed out once during a 91.472-second directory removal after native completion and process exit. Median vendor durations were 308.735, 301.488 and 612.992 seconds. These samples do not establish a concurrency remedy; regular CI settings, assertions, deadlines and the eight-session regression are unchanged. The report also records the cleanup overlap and explicitly leaves the filesystem cause unknown. The results include a reproducible selector, the separate later PR #670 timeout evidence, and the npm-cache follow-up. Both first main DSH restores preceded the first main save, so no warm-cache speedup is claimed. Task #196 remains in review while later natural main usage supplies that measurement. Validation: complete check passed (3,623 unit tests and 18 mock behavior cases). Codex 0.167.0 native vendor checks passed (77), as did its behavior suite (16 passed, 3 unsupported skips), using the local provider on Linux. The selector reproduced the committed results JSON byte-for-byte, and both restored fixture files were verified against the pre-experiment commit. --------- Co-authored-by: Otter <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 6, 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_b98a90402d983de6c0277917bcfb4c61"><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 --> A Windows Codex comparison completed the native turn and observed process exit, then spent 91.472 seconds removing the fixture home and crossed the case's 60-second deadline. This change bounds only the fixture's wait for private-home deletion: it returns after removal settles or a five-second timer, while the same removal continues with its existing retry settings. Pending cleanup and eventual removal or failure retain the home identity, elapsed time and residue uncertainty in the existing trace and job log. Fast success stays quiet; errors remain observed and cannot replace an earlier native failure. This neither proves descendant cleanup nor establishes the cause of the Windows delay. Native session disposal, assertions, deadlines and CI concurrency are unchanged. The ordinary Codex fixture also adds exactly two `record()` calls around native warmup, including its failure outcome. They use the caller's existing trace and add no diagnostic switch; preparation before that trace opens is not retained. The reviewer counted 70 warmups in the full vendor run, of which 27 had an open trace. The earlier 58-second and 83-second preparation delays were in cases with traces; untraced warmups remain a known gap. This follows merged #671 and is rebased onto main `7da13f9b`. All temporary phase hooks are gone; the original retry rationale is preserved above `rm`. Validation: full check after rebase (3,640 tests and 18 mock behaviors), nine new controlled tests plus three existing warmup regressions, all 77 Linux Codex 0.167.0 vendor cases, and 16 Codex behaviors (three capability skips) passed. Reverting the fixture call to unbounded removal fails the controlled integration regression. The vendor traces contain 27 matched warmup start/end pairs. The retained Windows comparison was not rerun; the new change's Windows and macOS results remain for this PR's CI. The pre-rebase Windows check passed all nine new tests and the full unit suite, then failed during CodeBuddy installation after its unchanged 180-second limit. The original log is retained separately in task #196; the cause is unconfirmed. This rebase changes neither that installer nor its limit. 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.
Implements #192: a host can sign a runtime out the way it signs it in. This follows the shape @cindy decided in the issue ("Shape decided by @cindy"), and the patterns of #94 (claude, codex) and #146 (cursor).
API (
contracts/login.ts, besideloginandauthStatus)authStatusdecides afterwards. The result islogged_outonly when the status reads logged out after the logout ran. That includes a runtime that was logged out already: it answers in its own words, and the status decides.still_logged_in: the logout succeeded, yet the status still reads logged in.detailsays what the status read. The result is neverlogged_outin this case.ANTHROPIC_API_KEY,CURSOR_API_KEYand the like stay as they are.failedreasons reuse login's (process_failed,timed_out,rejected) and add onlystill_logged_in.unsupportedis only for the installation or the version.LoginSecrets.line).createPiProviderAuth. antigravity, grok, kimi and opencode have nologoutmember.docs/spec/login.md#logoutis the contract page.Per runtime
claude auth logoutover pipes, through the login's process machinery: its own process group, nothing forwarded, stdin closed,CLAUDECODEcleared.claude auth status --jsonthen decides.authLogout→performLogout): claude revokes the stored claude.ai OAuth refresh token (POST <token URL>/revoke, 5 s, best effort: a failed revoke is only logged). It then deletes~/.claude/.credentials.json(the Keychain on macOS) and the account in~/.claude.json.Logout failed: <msg>with exit 1 isrejectedwith<msg>.Successfully logged out from your Anthropic account.and exits 0. The result islogged_out.ANTHROPIC_API_KEY(a fake value) set: the status readsloggedIn: true,authMethod: "api_key",apiKeySource: "ANTHROPIC_API_KEY"before and after the logout, so the result isstill_logged_in(… still reads logged in (api_key, from ANTHROPIC_API_KEY)).CLAUDE_CODE_OAUTH_TOKENset: the status readsoauth_token.auth logoutarrived (changelog).codex logoutthe same way.codex login statusthen decides.openai/codexrust-v0.160.1:run_logout,logout_with_revoke,revoke.rs): codex revokes a ChatGPT login's refresh token, or its access token, atauth.openai.com/oauth/revoke(10 s, best effort; since 0.122.0, [codex] Revoke ChatGPT tokens on logout openai/codex#17825). It then deletesauth.jsonand the keyring entry. A stored API key is only deleted.Error logging out: …with exit 1 isrejected.CODEX_HOMEwith no network, codex 0.160.1:Not logged in, exit 0, so the result islogged_out.Successfully logged out;auth.jsonis gone and the status reads logged out.OPENAI_API_KEYandCODEX_API_KEYare invisible tocodex login status, so a logout with either set islogged_out. codex therefore never producesstill_logged_infrom the environment.codex logoutarrived (Add logout command to CLI and TUI openai/codex#1932).Cursor.auth.logout()with no options, so the SDK clears its own default store.Cursor.auth.statusthen decides.stubs.d.ts/auth/login.d.ts; 1.0.35 has the same):logout(options?: SdkLogoutOptions): Promise<void>, withSdkLogoutOptions { store?: SdkCredentialStore }.(store ?? new FileCredentialStore()).clear(), which isrm(~/.cursor/sdk/auth.json, { force: true }), thenclearStoredLoginCache(). It makes no request.Cursor SDK login (<host>)) until it expires (90 days) or is revoked there. The SDK has no revoke call; its own.d.tssays "Local-only". The cursor page says so.CURSOR_API_KEY: untouched. The status ignores it (feat(cursor): sign cursor in through the SDK's own Cursor.auth #146), so the result islogged_outwhile the SDK keeps using the variable. Documented.rejected. An SDK withoutCursor.auth.logoutisversion_unsupported;CursorAuth.logout?is optional, likeauth, so hosts' stand-ins keep compiling.CLI
oar logout <runtime>takes--jsonand--timeout <ms>.oar logout allis refused: it takes one runtime.oar listshowslogout.Decisions beyond the spec (for review)
unknownafter a successful logout islogged_outon the runtime's own report, as a login's success islogged_in(changed in review; wasprocess_failed). A status that reads logged in is stillstill_logged_in.logged_out. Example: claude cleared the credentials, then failed writing its config. A logout's own failure is reported only when the status doesn't read logged out.process_failedwithout a status read.timeoutMs. Logouts are short.version_unsupportedrather than an "unknown subcommand" failure.still_logged_indetail names claude'sapiKeySource. An internalreadClaudeAuthStatusreturns it next to theAuthStatus;AuthStatusis unchanged.LoginProcess.closeInput()closes a logout command's stdin.loginExecutablenow returns anExecutableRefusaltype that is valid for both results.registerLogoutCommandandclaudeAuthStatusare re-exported fromlogin.ts, to stay within the lint's import limit of 10.Tests
claude, against
fake-claude-login.mjs(newauth logoutmodes):ANTHROPIC_API_KEYgivesstill_logged_in;Logout failed:givesrejected;logged_out;process_failed, redacted;logged_outafter a success, the failure after a failure);codex, against
fake-codex-login.mjs:Not logged in;codex loginnever runs;Error logging out:givesrejected;still_logged_in;logged_out;cursor, against the stand-in SDK:
CURSOR_API_KEYuntouched;still_logged_in;rejected, redacted;Cursor.auth.logout, a non-bundled installation, and a failed load.CLI: rendering and exit codes.
Real SDK:
experiments/cursor-login/probe.tsgained two scenarios against the real@cursor/sdk1.0.36, in temporary homes:auth.json, reads logged out, and a second logout islogged_out;CURSOR_API_KEYset, the variable is left as it was.Neither makes a request or prints anything. The run passed 11/11, inside a network namespace with only loopback up.
End to end:
oar logout claude/oar logout codexagainst the fakes throughOAR_CLAUDE_BIN/OAR_CODEX_BIN, in a temporary HOME with no network.Gate:
pnpm run checkandCI=1 pnpm run checkpass (797 passed / 53 skipped, mock sea-trial 19/19), rebased on maine1f9177(v0.33.1).No real login or logout ran anywhere for this PR.
Real-login checklist for cindytest (not run yet)
Setup:
pnpm install && pnpm run build && alias oar="node $PWD/packages/cli/dist/index.js".ANTHROPIC_API_KEY,CLAUDE_CODE_OAUTH_TOKEN,CODEX_API_KEY,OPENAI_API_KEYandCURSOR_API_KEYunset:env | grep -E 'ANTHROPIC_API_KEY|CLAUDE_CODE_OAUTH_TOKEN|CODEX_API_KEY|OPENAI_API_KEY|CURSOR_API_KEY' | cut -d= -f1prints nothing.oar list:logout: truefor claude, codex and cursor.claude
oar login claude(the account owner pastes the code). Expectclaude logged in as <email> (claude.ai, <plan>).oar logout claude; echo $?. Expectclaude logged outand0. Thenoar login claude --statusshowsclaude logged out, andclaude auth statussaysNot logged in. Linux:ls ~/.claude/.credentials.jsonreports no such file.oar logout claude; echo $?again. Expectclaude logged outand0.ANTHROPIC_API_KEY=sk-ant-api03-not-a-real-key oar logout claude; echo $?. Expectclaude logout failed: still_logged_in (claude auth logout succeeded, yet claude auth status --json still reads logged in (api_key, from ANTHROPIC_API_KEY))and1. The key isn't validated, and no request uses it.codex
oar login codex(the account owner enters the device code). Expectcodex logged in as <email> (chatgpt, <plan>).oar logout codex; echo $?. Expectcodex logged outand0. Thencodex login statussaysNot logged in, andls ~/.codex/auth.jsonreports no such file.oar logout codex; echo $?again (codex itself answersNot logged in). Expectcodex logged outand0.CODEX_API_KEY=sk-not-a-real-key oar logout codex; echo $?. Expectcodex logged outand0:codex login statusignores the variable, so codex has nostill_logged_infrom the environment.cursor
oar login cursor(the account owner opens the URL on another device). Expectcursor logged in as <email> (expires <~90 days>).oar logout cursor; echo $?. Expectcursor logged outand0. Thenls ~/.cursor/sdk/auth.jsonreports no such file, andoar login cursor --statusshowscursor logged out.Cursor SDK login (cindytest)is still listed: the logout is local only. Revoke it there by hand.oar logout cursor; echo $?again. Expectcursor logged outand0.CURSOR_API_KEY=crsr-not-a-real-key oar logout cursor; echo $?. Expectcursor logged outand0; the status ignores the variable.Optional: server-side revocation for claude and codex is best effort. A login's token that was revoked shows up as the vendor's "revoked" error if it is reused; the checklist doesn't try that.
🤖 Generated with Claude Code