Files
orca/config/knip.json
Brennan Benson 84f1c520a8 Keep one copy of Codex history shared by every account (#42614)
* Share Codex account history through folder links into ~/.codex

Each Codex account home keeps its login; its history folders become folder
links (junctions on Windows) into the user's ~/.codex, and Codex's databases
follow through a sqlite_home line in the account's own config. Migration is
automatic before the next launch in each home; the store's copy wins a name
conflict and the account's copy is kept beside it. The per-file history bridge,
its link pass and the WSL bridge are removed. Claude's merge-then-link moves to
a shared async module both providers use.

* Make account history moves safe under concurrency and keep the DB with the folders

Files move by link-then-unlink so a move never replaces an existing name, host
passes run one at a time per store, index markers are written before a move,
account-only folders are shared, lock folders are moved rather than deleted,
and sqlite_home is written only once a home's sessions are linked.

* Let the history pass own sqlite_home, link locks first, and index per store

The pass that links a home's folders now writes and removes its sqlite_home
line; the config mirror only carries it forward. thread-writer-locks is linked
before any history, index markers are kept once per store (hard-linked
duplicates included), WSL links the launched home before Codex starts, passes
queue per home in request order, and re-sharing after off then on works with
earlier conflicts still kept.

* Never overwrite on move, gate indexing on moves, and read the shared DB for backfill

Files move by link or exclusive copy; repeat conflicts get their own pending folder; secrets and
sandbox setup stay per home; the sqlite_home write retries against a concurrent mirror; indexing
waits until no move is running; backfill checks read the DB where sqlite_home puts it.

* Keep live writers' files, require both history links, and keep unmoved history on removal

Files move only by a new name for their inode; a home is shared only when sessions and
archived_sessions both link; reverted-thread rollouts get index markers; settled homes skip
repeat passes in either mode; account removal keeps a real history folder.

* Give resume test runtime-home mocks the account history step

* Keep unmoved WSL history on removal, prepare the launched home, and retry incomplete work

WSL account removal keeps real sessions/archived_sessions; a launch prepares the account it
returns even if the selection changed meanwhile; an incomplete unshare and a failed WSL index
pass stay eligible for a later launch; the guest helper rechecks the distro before each step.

* Keep pinned resumes reachable, finish interrupted unshares, and keep index work from racing moves

A pinned resume only shares; a launch re-prepares when the selection or setting changed; Orca's
sqlite_home line is read only at the config root; a writer-lock link elsewhere keeps the home
private; an unshare finishes its database move on retry; indexing keeps markers a newer move
recorded, retries an incomplete run on a later launch, and merges WSL marker lists.

* Move account history into a store one pass at a time and retry incomplete moves

Two homes merging into one store at once raced on its folders and stranded the second home's
history in its merge folder. Passes now run one at a time per store (host) and per distro (WSL),
a folder that appears mid-move is merged into, and a share with failed moves is not settled.

* Keep one rollout form in ~/.codex, record what sharing left behind, and guard Windows homes from older builds

- A rollout present as .jsonl and .jsonl.zst lands in the store in one form only; the other form moves to the home's .orca-set-aside-rollouts, never deleted.
- Each account home gets a versioned cleanup manifest: set-aside databases, left-behind rollouts with a background content check against the store, store twin pairs, and the shared streak.
- Native Windows homes get a renamed ownership marker before their first junction, so older builds refuse to use or delete them.
- Account removal keeps the set-aside rollouts and the manifest.

* Set a rollout form aside only beside its twin in the store, inventory leftovers off the launch path, and keep account databases on removal

- The .zst moves first and a form is kept out only when the store already holds its twin, so a failed move never leaves the store with neither form.
- The rollout inventory and store twin walk run in the detached check, not the awaited pass; manifest writes are serialized per home and a check applies only to unchanged files; checkpoints are time-spaced.
- A WSL check that runs out of budget resumes on a later launch instead of looping.
- The ownership check reads either marker in one step and the marker rename retries on Windows.
- Account removal keeps the account's Codex databases for the later cleanup release.

* Read the cleanup manifest through a type guard

* Read the cleanup manifest through a type guard over unknown

* Settle only a check's own request, skip queued WSL passes after quit, and validate manifest entries

- A pass finishing during a check keeps its new check request on host and WSL.
- A WSL pass queued before quit no longer starts guest work.
- Manifest rollouts must carry a path, size and mtime to be read.
- The store twin scan reuses the twin module's folder walk.

* Walk the store outside the manifest write and keep databases on removal only for shared homes

- The inventory writes only its own fields onto a freshly read manifest, so it never undoes a streak reset from another process and a launch never waits behind the walk.
- Account removal keeps the home's Codex databases only when the cleanup manifest shows the home was shared.

* Lock the cleanup manifest across processes and validate every field later passes read

- Manifest writes take a file lock, so a WSL check helper can't publish over another helper's streak reset.
- The guard also checks storePath, the content check's store facts, database entries and sharedPasses; anything else is rebuilt from disk.
2026-11-15 22:31:24 -08:00

80 lines
3.7 KiB
JSON

{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": [
"src/main/index.ts",
"src/preload/index.ts",
"src/preload/browser-guest.ts",
"src/preload/browser-system-dialogs.ts",
"src/main/daemon/daemon-entry.ts",
"src/main/plugins/workers/plugin-host-entry.ts",
"src/main/computer/computer-sidecar.ts",
"src/main/speech/stt-worker.ts",
"src/main/warp-themes/warp-theme-parser-worker.ts",
"src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry.ts",
"src/main/native-chat/agent-session-journal/journal-sql-worker-entry.ts",
"src/main/native-chat/agent-session-journal/journal-sql-reader-entry.ts",
"src/main/agent-hooks/identity/agent-identity-worker-entry.ts",
"src/main/ports/port-scan-command-worker-entry.ts",
"src/main/plugins/panels/plugin-source-transpile-worker-entry.ts",
"src/main/worker-thread-child-process/worker-thread-child-process-entry.ts",
"src/main/ipc/filesystem/watcher-process/parcel-watcher-process-entry.ts",
"src/main/hang-watchdog/main-thread-hang-watchdog-entry.ts",
"src/main/agent-hooks/installation/managed-agent-hook-controls.ts",
"src/main/claude-accounts/runtime-auth/keychain.ts",
"src/renderer/src/main.tsx",
"src/renderer/src/popout.tsx",
"src/renderer/src/web/main.tsx",
"src/renderer/src/component-fixtures/component-fixture-explorer.tsx",
"src/renderer/src/**/*.fixture.tsx",
"src/renderer/src/**/*.worker.ts",
"src/cli/index.ts",
"src/wsl-guest/wsl-agent-hook-relay.ts",
"config/scripts/**/*.{mjs,cjs,js,ts}",
"config/build-plugins/**/*.ts",
"electron.vite.config.ts",
"vite.web.config.ts",
"config/vitest.config.ts",
"config/i18next.config.ts",
"config/electron-builder.config.cjs",
"config/oxlint-plugins/**/*.{js,mjs,ts}",
"tests/**/*.{ts,tsx,mjs}",
"**/*.test.{ts,tsx,mjs}",
"src/preload/doc-preview-link.ts",
"src/preload/plugin-frame-guest.ts",
"src/main/plugins/testing/plugin-test-hooks.ts",
"src/main/plugins/testing/plugin-test-register.ts",
"src/main/ai-vault/scan-service/session-scanner-service-entry.ts",
"src/main/native-chat/transcript-filesystem/process/wsl-transcript-fs-process-entry.ts",
"src/main/usage/scan-worker/usage-scan-worker-entry.ts",
"src/main/workspaces/space-analysis/workspace-space-scan-worker-entry.ts",
"src/main/claude-accounts/profiles/setup/claude-profile-setup-worker-entry.ts",
"src/main/persistence/profile-state/backup/profile-state-backup-worker-entry.ts",
"src/main/persistence/profile-state/writer/profile-state-writer-worker-entry.ts",
"src/main/orcad/orcad-local-serve-selection-entry.ts",
"src/main/orcad/launcher.ts",
"src/main/claude-accounts/profiles/wsl/claude-profile-wsl-entry.ts",
"src/main/codex/history/shared-store/codex-account-history-wsl-entry.ts",
"src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process-entry.ts",
"src/wsl-guest/wsl-browser-network-relay.ts",
"src/renderer/src/space.tsx",
"src/**/*.bench.ts",
"src/**/*-electron-fixture.ts",
"src/**/*-test-fixture.ts",
"src/**/*.test-fixture.{ts,tsx}",
"src/main/runtime/rpc/dispatch/rpc-params-type-parity.ts",
"src/main/runtime/rpc/methods/client-state/ui-state-schema-parity-checks.ts",
"src/renderer/src/components/editor/monaco/monaco-internal-test-module-types.ts",
"mobile/**/*.{ts,tsx}",
"cloud/**/*.{ts,tsx,mjs}"
],
"project": [
"src/**/*.{ts,tsx}",
"config/scripts/**/*.{mjs,cjs,js,ts}",
"config/build-plugins/**/*.ts"
],
"ignore": ["mobile/**", "out/**", "dist/**", "node_modules/**", "resources/**"],
"ignoreDependencies": ["electron", "@types/*"],
"ignoreExportsUsedInFile": true,
"includeEntryExports": false
}