Skip to content

[upstream #10394] feat(codex-accounts): import existing CODEX_HOME without re-login - #58

Open
innocarpe wants to merge 10000 commits into
mainfrom
feat/import-existing-codex-home
Open

innocarpe wants to merge 10000 commits into
mainfrom
feat/import-existing-codex-home

Conversation

@innocarpe

@innocarpe innocarpe commented Jul 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds Import CODEX_HOME next to Add Account in Settings → Codex Accounts
  • Copies an already-authenticated external CODEX_HOME into Orca managed storage and registers it as a normal managed account without running codex login again (issue Option B)
  • Validates auth.json, resolves OAuth identity (email required), refuses import from Orca managed storage or WSL slots (host only for now)

Closes stablyai#10366

Motivation

Power users keep isolated homes (~/.codex-work, device-auth flows, enterprise login). Today every extra account must go through Orca's browser login, so those homes cannot be reused.

Implementation

  • CodexAccountService.importAccountFromExistingHome(sourceHomePath, target?)
  • Shared helpers in import-existing-codex-home.ts (validate, copy, ownership marker)
  • IPC codexAccounts:importExistingHome + preload API
  • UI: folder picker → import; disabled for remote / WSL scope
  • Applies the OAuth provider policy to the imported config when no canonical config exists

Test plan

  • Unit: import helpers (auth.json required, reject managed storage, copy + marker)
  • Unit: service imports without spawn/codex login, rejects API-key-only and WSL target
  • Full service.test.ts + helper tests (72 pass, including custom-provider import rejection)
  • Manual: Settings → Codex Accounts → Import CODEX_HOME → pick ~/.codex-* with prior codex login → account appears and becomes active without browser login

Notes

  • Host runtime only; WSL import can follow if needed
  • Source directory is left intact (copy, not move)

ELI5

You can import an already-logged-in CODEX_HOME into Orca managed accounts without running codex login again. Handy if you keep separate Codex homes for different workflows.

@innocarpe
innocarpe force-pushed the feat/import-existing-codex-home branch from 8c7f046 to 234a00c Compare August 6, 2026 03:56
@innocarpe

ghost commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Sync update (234a00cb86)

Rebase onto latest upstream/main: import existing CODEX_HOME alongside addAccountFromHome CLI path.

@innocarpe

ghost commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Sync update (5efcc8e251)

Addressed CodeRabbit review: enforce the OAuth provider policy against an imported CODEX_HOME config when no canonical config exists, and add regression coverage for a custom model_provider. Validation: 72 Codex account service tests, typecheck, native/type-aware Oxlint, and Oxfmt pass.

@innocarpe
innocarpe force-pushed the feat/import-existing-codex-home branch from 5efcc8e to ca54ef3 Compare October 29, 2026 08:46
Neil and others added 24 commits November 9, 2026 00:59
…ablyai#40152)

After a recipe provisions a VM, run the environment doctor on the VM's own
server (new environment.doctor RPC) before creating the workspace. The VM
create sheet shows Provision VM, Check environment and Create workspace; a
failed step gets Fix with agent, Retry, Edit recipe, and (for checks) Open
anyway, which keeps the VM. Older VM servers skip the checks; dismissing
aborts a running check and destroys the VM as before.
* wip

* Polish agent picker interactions
…ce (stablyai#40205)

Deleting a recipe workspace from the phone removed only its checkout and
left the VM this desktop created for it running. Only the desktop window
ran the destroy.

The relaying desktop now tags the rows of workspaces whose VMs it created
with the environment's name, and says whether deleting will destroy it.
The phone's delete sheet names the environment, and its delete asks for
the destroy (`destroyHost: true`). The desktop then owns that removal:
- it runs as a workspace lifecycle delete
- the environment's Orca removes the checkout and must answer positively.
  An older Orca that answers on acceptance is polled until the workspace
  is gone.
- the VM is destroyed through the shared cleanup, behind any running wake
  or suspend, and only when no other workspace remains on it
- the result reports host.state truthfully: destroyed, kept, or
  left-running (no destroy step)

The environment's own error codes reach the phone unchanged, and a failed
removal shows its message on the phone instead of only a haptic.

Removals that don't ask for the destroy (older phones, the CLI, other
clients) keep today's behavior. No CLI API changes.

Based on stablyai#39235 by jutaz, a port of stablyai#28435.

Co-authored-by: Justas Brazauskas <[email protected]>
…te limit with a notice (stablyai#40240)

* fix(dictation): stop a phone's cloud dictation at the 10-minute limit with a notice

* test(dictation): pin the cap flag on every phone chunk reply

* perf(dictation): skip decoding phone audio the host will drop past the cloud cap
)

onorca.dev offers an opt-in 'mirror link' (https://downloads.onorca.dev)
next to the GitHub download for when GitHub release downloads 5xx.
Upload the onorca.dev download assets there right after each stable
desktop release and each Android release, instead of polling.

- config/scripts/release/publication/mirror-release-to-r2.sh: retrying,
  resumable download from GitHub, size + sha256 check, S3 multipart
  upload to R2 (no 300 MiB wrangler cap)
- release-mirror-r2.yml: reusable + manual backfill
- release-cut: run after publish-release for stable vX.Y.Z tags only
- mobile-android-release: run before bump-apk-download so the site's
  mirror link never points at a missing APK (success not required)
…stablyai#40080)

* Fix hosted review selection, conversations and optional job failures

Co-authored-by: Mahedi Hasan Emon <[email protected]>

Co-authored-by: Victor GALISSON <[email protected]>

* Retain complete review history within provider bounds

* Declare optional membership retention policy

* Narrow hydrated revision metadata without a cast

* Preserve completed check presentation through the shared classifier

* Read malformed revision metadata without retaining it

* Exercise legacy alternate discovery after local absence

* Preserve observable remote review routing coverage

* Keep optional GitLab job warnings consistent in details

* Reuse the optional job presentation color

---------

Co-authored-by: Victor GALISSON <[email protected]>
…tic refails (stablyai#40055)

* fix(native-chat): continue every usage-limited chat at once and stop after five automatic refails

The automatic continue sent one chat per 10 s sweep, so chats stopped by the same limit resumed one by one. Its retry budget belonged to the cut, so a continuation that hit the limit again started a fresh budget and could repeat indefinitely.

Send every due chat in one pass, one at a time. Count consecutive automatic continues that ended in another usage limit from the journal: each continue's message id names the cut it answered, and the next cut's turn is joined to that submission through its key or provider item. After five, the chat shows that Orca won't continue it automatically.

* fix(native-chat): read the usage-limit continue chain from the tail, not the whole conversation

The chain walk built a map over every journal row and rescanned history for each link. Walk back from the end instead, so the work is the chain's own rows; add an N/10N contract. Replace the fan-out test's casts with typed fixtures.

* test(native-chat): count a Claude echo-opened continue in the usage-limit chain

* fix(native-chat): derive the usage-limit continue chain once per cut

A status rebuild for the same cut reuses the chain it already derived, since only history before the cut decides it; the turn's limit is read without copying its rows.

* fix(native-chat): skip slash-command turns when walking a usage-limit continue chain

A /compact run after a usage limit sits between the cut and its automatic continue; the latest-turn read skips it, so the chain walk must too. Count visited rows in the perf contracts with typed getters.

* test(native-chat): type-guard the recorded Claude capture events

* fix(native-chat): recompute the usage-limit chain when a late receipt attributes its opener

Reuse across rebuilds is keyed on the cut, its turn row's revision and the newest send, so a late attribution that completes a join is counted instead of keeping a stale zero.

* test(native-chat): guard usage-limit chain reuse at the status projection

Drives StructuredAgentSessionJournalProjections.read through real journal invalidations at 100 and 1000 turn rows: one chain derivation for an unchanged cut, again for a new cut or epoch, and a recount when a late receipt attributes the continue's opener.

* fix(native-chat): reuse a usage-limit chain only while everything it read is unchanged

The chain walk now reports the turn rows it looked up and the oldest submission it examined; the status projection keys reuse on their revisions and join evidence, so a late receipt for any link, not just the newest send, recounts the chain.

* fix(native-chat): derive the usage-limit chain fresh on each status rebuild

Reuse across rebuilds kept missing inputs the walk reads (late receipts, revised failure rows) and its key re-serialized settled history. The status projection's own cache still skips unchanged reads; each rebuild now walks only the chain's tail. Contract tests at the projection count total reads: independent of earlier history, linear in the chain's rows, one scan of the sends when no opener matches.

* fix(native-chat): find an echo-opened turn's opener without reading the turn before it

A Claude echo-opened turn names the provider's key while its opener row keeps the submission's, so the slash-command check scanned the whole previous turn and missed echo-opened commands. It now stops at the nearest root user row.
…t, and show it on the phone (stablyai#40231)

* fix(dictation): store Auto as Toggle plus hold-to-record so older builds keep a working shortcut

* test(mobile): type the Auto mode settings fake instead of casting

* fix(dictation): migrate a stored Hold without hold-to-record

* fix(dictation): keep phone mode segments typed and clear hold-to-record when a phone picks Hold

* refactor(dictation): reuse the shared mode settings in the migration and phone writes
…s' model setups (stablyai#39806)

* fix(agent-picker): list agents named by the search before other agents' model setups

Typing "codex" in the agent picker showed OpenCode/Cursor model setups
(e.g. "OpenCode · GPT-5 Codex") above the Codex agent itself, and Enter
picked the first setup. Direct agent matches now render first and are the
Enter target.

* test(agent-picker): assert search highlight and Enter target for named agent

* test(agent-picker): import fireEvent after rebase
…rds (stablyai#40258)

The compact sender name had no horizontal padding, so its hover fill hugged
the text. Add an inlineChip button size (inline height, px-1.5).
…er for long cloud dictations (stablyai#40238)

* fix(dictation): wait as long as the host's cloud deadline when a paired phone or browser stops

* fix(dictation): compute the host's cloud deadline from its exact sample count
…stablyai#40095)

* fix(terminal): end a dead preserved terminal host's PTYs as host loss

After an update Orca keeps the previous version's terminal host so agents
survive. That host has no respawn, so when it later died nothing ended its
PTYs: panes stayed connected on a frozen frame and input went nowhere.

Once every reconnect attempt finds its endpoint refused or missing, each of
its PTYs now ends as host loss with history kept, and the pane's restore is
no longer refused because the dead host cannot answer.

Fixes stablyai#38432

* fix(terminal): require process-exit proof on POSIX and keep checking until proven

Review follow-ups: an unproven attempt restarts the count instead of ending
the check; on POSIX the old host's pid must also be gone; a proven-gone host
answers 'not live' for every id; one throwing exit listener cannot strand
the remaining sessions.
…copy (stablyai#40266)

* fix(dictation): don't throw when the paired web client has no speech catalog

* feat(i18n): translate the dictation pill, error pill and queued-send copy

* fix(i18n): say Chinese queued sends happen automatically
Neil and others added 27 commits November 9, 2026 18:53
…owners (stablyai#40581)

* refactor(skills): group catalog, installation, sharing and freshness owners

* fix(skills): retarget inventory benchmark to catalog owner
…e typed query (stablyai#40487)

Commands render before skills in the slash menu, so typing an exact skill
name could leave a fuzzy command highlighted and Enter would pick the wrong
item. After each edit or caret move the picker now highlights the row whose
name ranks best against the query. Arrow-key navigation still owns the
highlight between edits, and a catalog refresh keeps the row the user
arrowed to (by id) instead of jumping.

Co-authored-by: Neil <[email protected]>
…ile state sync (stablyai#40381)

Refreshing a managed Claude profile copied the personal ~/.claude.json
groveChoiceSeenAt map over the profile's map, dropping the profile
account's Consumer Terms confirmation. Every new terminal then made
Claude wait on a network check before starting.

Merge groveChoiceSeenAt per account like projects and mcpServers, and
keep whichever timestamp is newer for accounts present on both sides.

Fixes stablyai#40380

Co-authored-by: Neil <[email protected]>
…tablyai#40605)

* refactor(automations): group authoring, host catalog, listing and run owners

* Preserve protected automation confirmation copy after owner moves
* fix(review): keep the active review linked through a rebase

A detached HEAD (rebase, bisect, checkout of a commit) is no longer treated
as a branch switch. Only an attached observation can clear the active
review and push target, judged against the branch that last proved
ownership: the in-session branch before the detach, else the owning host's
rebase verdict from the listing, else unknown (never cleared). linkedItems
are never cleared.

- shared rule (hosted-review-branch-ownership) used by the renderer writer
  and the runtime WorkspaceGitIdentity
- readRebaseOperation: spawn-free, fail-closed owner-side verdict; git am is
  not a rebase
- listings annotate detached rows with the verdict
- explicit push-target pushes refuse while a rebase is active or unverifiable
- opt-in verifyRebaseOperation status verdict gates review AI launches at
  the action boundary

* fix(review): gate mobile review actions and bound the rebase listing probe

- mobile fix-checks, resolve-comments and hosted conflict launches require a
  fresh owner-side rebase verdict after agent resolution; local conflict
  recovery and generic launches are unchanged
- the listing's detached-row rebase probe has a 2s budget; unread rows stay
  unknown, and a checkout whose read outlived its budget gets no new one
  until it settles
- an empty or malformed HEAD is unverifiable, not a proven detach
- the apply-backend real-Git test is gated on Git 2.26

* fix(mobile): let folder repo review actions launch without a Git verdict

Repo-backed folder workspaces have repo::path ids, so the mobile review-action
gate sent git.status for them and refused the launch. The gate now reuses the
repo the launch context already resolved and, like desktop's isFolderRepo
check, skips the verdict for folder repos; Git workspaces still need a fresh
'none'.

* fix(review): reconcile detached ownership per host and selection

* Fix review action rebase checks for the selected workspace

- Read fresh rebase state from the owning host without a full status scan.
- Rotate detached worktree probes so later worktrees receive checks.
- Avoid reopening the composer when a rebase check refuses launch.

* refactor(review): scope rebase fix to branch ownership

Preserve review associations through detached HEAD using the last confirmed attached branch. Keep unknown ownership conservative and retain host isolation and relink race protection.

Remove the background rebase scanner, rebase-verdict transport, and launch/push gating from this change. Keep the deferred gating work separately and replace the real-Git pipeline tests with focused metadata regressions.
…40586)

A shared test worker carried settings.test.ts's generation bumps into
jira-web-client-status.test.ts, which then read local#3 instead of local#0.
…ai#40614)

They reopen the WAL-backed dismissal row cache read-only after a
simulated restart, which Bun on macOS cannot, so the restarted store
reads no history.
…desktop instead of downloading all of them (stablyai#40519)

* perf(mobile): let newer phone shells fetch the language catalog from the desktop instead of downloading all of them

* fix(mobile): hash only the buildId fields so phone readers can recompute it

* fix(mobile): use the catalog chunk when the generation still has it

* fix(desktop): give catalog reads their own read-slot budget
…#40619)

* refactor(mobile): group native chat modules by feature owner

* refactor(mobile): consolidate concrete owner imports

* test(mobile): preserve pinned release source addresses

* refactor(mobile): import the recorded launch function type directly
* fix: clarify account usage reset display

* fix: address account usage accessibility review

* fix: localize account reset duration units
…d only (iOS rejects them with a red screen in development) (stablyai#40615)
…ces (stablyai#40606)

* feat(cmd-j): add an extra-results seam for non-workspace palette sources

Sources register through usePaletteExtraSources (empty here, so the palette is
unchanged). Each supplies a section label, rows ranked with the shared match
engine, an empty-query cap, a tie preference, and a placement hint relative
to Workspaces. A source may also hide workspaces it represents from the
Workspaces list while their tabs stay in Open Tabs and recents.

* fix(cmd-j): make extra-result rows keyboard-selectable

Selection skipped the new row type, so Enter could not reach a leading
extra row.

* fix(cmd-j): count extra-result rows in the announced result count

The live region counted only the built-in result kinds, so a query that
matched only extra rows announced zero results.
A search box finds agents and files; / moves into it from the list. The list keeps the default agent, Terminal, Browser, Markdown and Mobile emulator.
Allow Settings → Codex Accounts → Import CODEX_HOME to copy an already
authenticated external home into Orca managed storage and register it as
a normal managed account (issue stablyai#10366 Option B).
CodeRabbit: use statSync for type checks; async cp so large homes do not
block the Electron main process.
@innocarpe
innocarpe force-pushed the feat/import-existing-codex-home branch from ca54ef3 to 9a3d509 Compare November 10, 2026 05:14
@innocarpe innocarpe added the enhancement New feature or request label Nov 10, 2026
@innocarpe

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

Sync update (9a3d509ad4)

Rebased onto current main. Import CODEX_HOME now sits on the accounts codex section, and provider policy still applies to imported homes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Couldn't load reviewers.

Assignees

Couldn't load assignees.