Skip to content

fix(codex): resume sessions from authoritative homes - #8288

Closed
bbingz wants to merge 10 commits into
stablyai:mainfrom
bbingz:bbingz/split-7950-sessions-native-chat
Closed

bbingz wants to merge 10 commits into
stablyai:mainfrom
bbingz:bbingz/split-7950-sessions-native-chat

Conversation

@bbingz

@bbingz bbingz commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Replacement slice for #7950, limited to Codex session discovery/resume and Native Chat decoding.

  • discover and stream-read cold .jsonl.zst rollouts; prefer a plain sibling before applying result limits
  • decode paginated item_completed TurnItems for AI Vault and Native Chat
  • resolve compressed rollouts in Native Chat and update the current Codex slash-command catalog
  • prefer repository-scoped skills when duplicate names exist
  • decode transcript Buffer streams across UTF-8 chunk boundaries while keeping file offsets and safety limits measured in raw bytes
  • discover each host, custom, managed-runtime, and WSL Codex session home as an independent authority
  • bind AI Vault resume to the exact CODEX_HOME that owns the selected rollout
  • remove local and WSL writable session mirroring (hardlinks and copies)

Why this is separate

#7950 mixed startup, hooks, auth/rate limits, and session behavior. This PR contains only the session lifecycle/read path so its data-safety policy can be reviewed independently.

Session authority model

Codex owns a rollout as a namespace pair (.jsonl / .jsonl.zst), not as one stable inode. Compression and resume may create, delete, or replace either directory entry. A hardlink or copy in a second CODEX_HOME therefore cannot remain a correct writable alias.

This revision removes the bridge entirely:

  • AI Vault scans Orca's managed runtime home and the original host/custom Codex home directly.
  • On Windows it also scans each discovered WSL distro's default Codex home, or its configured custom home, through the host-readable UNC path.
  • Every discovered Codex session records its owning home explicitly, including the default ~/.codex home.
  • Resume launches with that owning CODEX_HOME, so .jsonl to .jsonl.zst transitions stay in one authoritative namespace.
  • Legacy copy markers remain read-only scan compatibility. Orca does not create, refresh, migrate, or delete session aliases.

Existing aliases from earlier builds are intentionally not deleted automatically because Orca cannot prove they have not diverged.

Transcript byte-safety

StringDecoder carries incomplete UTF-8 across Buffer chunks and flushes once at EOF. Raw 0x0A boundaries drive JSONL line settlement, so malformed bytes that decode to U+FFFD cannot inflate a persisted watch offset or weaken byte limits. Plain file readers and incremental watches keep data as Buffers until this boundary; the string-stream compatibility path carries a trailing high surrogate across string chunks.

Testing

  • synced with origin/main@1b3f281ff
  • authority/resume focused gate: 3 files / 90 tests
  • full repository Vitest: 2,826 passed files / 29,757 passed tests (6 files / 41 tests skipped)
  • pnpm lint (all repository gates passed; only pre-existing warnings)
  • pnpm build:desktop (Node/CLI/web typecheck, relay, CLI, Electron/Vite, and web builds)
  • oxfmt --check on touched TypeScript files
  • git diff --check origin/main...HEAD
  • regression coverage for no local/WSL session copies, .jsonl to .jsonl.zst namespace transitions, default/custom host authorities, and default/custom WSL authorities
  • Windows/WSL live smoke
  • Electron GUI/E2E interaction tests

Verification used the repository-declared Node 24 toolchain. CI remains the authoritative full-platform verifier.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds support for discovering, reading, parsing, and caching plain and zstd-compressed Codex rollouts, including paginated turn items. Adds filesystem markers, preservation, replacement, migration, refresh, rollback, and WSL bridging for Codex sessions. Updates native chat transcript resolution, decoding limits, caching, and watching for compressed and paginated files, deduplicates skill suggestions by source priority, and expands Codex slash-command suggestions.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers summary, rationale, model, and testing, but it omits required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections, especially Screenshots, AI Review Report, Security Audit, and Notes, and briefly note any platform-specific follow-up.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the PR’s main change: Codex sessions now resume from the authoritative owning home.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/ai-vault/session-scanner-parse-cache.ts (1)

53-57: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use isCodexCompressedRolloutPath instead of inline .endsWith.

The inline .endsWith('.jsonl.zst') duplicates isCodexCompressedRolloutPath from session-scanner-codex-paths.ts, which is already used consistently in session-scanner-codex-rollout-read.ts and transcript-reader.ts. Using the shared helper keeps the compressed-path detection logic in one place.

♻️ Proposed refactor
     case 'codex':
       // Why: byte offsets only describe plain append-only JSONL. Cold zstd
       // sessions must be decompressed from the beginning after each change.
-      return candidate.file.path.endsWith('.jsonl.zst')
+      return isCodexCompressedRolloutPath(candidate.file.path)
         ? null
         : () => createCodexSessionResumeState(candidate.file, candidate.codexHome)

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 82c4dfbe-81cb-4445-a9ac-a118675dfdec

📥 Commits

Reviewing files that changed from the base of the PR and between ff8192a and 22db9241c5ad5e827a13d46881dd2236e91c66a5.

📒 Files selected for processing (29)
  • src/main/ai-vault/session-scanner-codex-discovery.ts
  • src/main/ai-vault/session-scanner-codex-parser.test.ts
  • src/main/ai-vault/session-scanner-codex-parser.ts
  • src/main/ai-vault/session-scanner-codex-paths.ts
  • src/main/ai-vault/session-scanner-codex-record-consume.ts
  • src/main/ai-vault/session-scanner-codex-rollout-read.ts
  • src/main/ai-vault/session-scanner-codex-zstd.test.ts
  • src/main/ai-vault/session-scanner-discovery.ts
  • src/main/ai-vault/session-scanner-parse-cache.ts
  • src/main/ai-vault/session-scanner-source-discovery.ts
  • src/main/codex/codex-session-bridge-link.ts
  • src/main/codex/codex-session-bridge.test.ts
  • src/main/codex/codex-session-bridge.ts
  • src/main/codex/codex-session-copy-markers.ts
  • src/main/codex/codex-session-file-listing.ts
  • src/main/codex/codex-session-preserved-copies.ts
  • src/main/codex/codex-session-preserved-install.ts
  • src/main/codex/wsl-codex-session-bridge.test.ts
  • src/main/codex/wsl-codex-session-bridge.ts
  • src/main/native-chat/session-file-resolver.test.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/transcript-codex-turn-items.ts
  • src/main/native-chat/transcript-line-decoders-codex.ts
  • src/main/native-chat/transcript-reader.test.ts
  • src/main/native-chat/transcript-reader.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.test.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.ts
  • src/shared/native-chat-slash-commands.test.ts
  • src/shared/native-chat-slash-commands.ts

Comment thread src/main/ai-vault/session-scanner-codex-rollout-read.ts
@AmethystLiang AmethystLiang self-assigned this Jul 11, 2026
@AmethystLiang
AmethystLiang self-requested a review July 11, 2026 16:47
@bbingz
bbingz force-pushed the bbingz/split-7950-sessions-native-chat branch from 22db924 to 598ce95 Compare July 12, 2026 00:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1fb7c96b-1c75-48d8-ab0b-40450ddd132f

📥 Commits

Reviewing files that changed from the base of the PR and between 22db9241c5ad5e827a13d46881dd2236e91c66a5 and 598ce9545f99a66c5fe8eecff2542f6b89b58253.

📒 Files selected for processing (36)
  • src/main/ai-vault/session-scanner-codex-discovery.ts
  • src/main/ai-vault/session-scanner-codex-parser.test.ts
  • src/main/ai-vault/session-scanner-codex-parser.ts
  • src/main/ai-vault/session-scanner-codex-paths.ts
  • src/main/ai-vault/session-scanner-codex-record-consume.ts
  • src/main/ai-vault/session-scanner-codex-rollout-read.ts
  • src/main/ai-vault/session-scanner-codex-zstd.test.ts
  • src/main/ai-vault/session-scanner-discovery.ts
  • src/main/ai-vault/session-scanner-parse-cache.ts
  • src/main/ai-vault/session-scanner-source-discovery.ts
  • src/main/codex/codex-session-bridge-link.ts
  • src/main/codex/codex-session-bridge.test.ts
  • src/main/codex/codex-session-bridge.ts
  • src/main/codex/codex-session-copy-markers.ts
  • src/main/codex/codex-session-file-listing.ts
  • src/main/codex/codex-session-preserved-copies.ts
  • src/main/codex/codex-session-preserved-install.ts
  • src/main/codex/wsl-codex-session-bridge.test.ts
  • src/main/codex/wsl-codex-session-bridge.ts
  • src/main/native-chat/session-file-resolver.test.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/transcript-codex-turn-items.ts
  • src/main/native-chat/transcript-line-decoders-codex.ts
  • src/main/native-chat/transcript-read-cache.test.ts
  • src/main/native-chat/transcript-read-cache.ts
  • src/main/native-chat/transcript-reader.test.ts
  • src/main/native-chat/transcript-reader.ts
  • src/main/native-chat/transcript-stream-lines.ts
  • src/main/native-chat/transcript-watch.test.ts
  • src/main/native-chat/transcript-watch.ts
  • src/main/runtime/rpc/methods/native-chat.test.ts
  • src/main/runtime/rpc/methods/native-chat.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.test.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.ts
  • src/shared/native-chat-slash-commands.test.ts
  • src/shared/native-chat-slash-commands.ts
🚧 Files skipped from review as they are similar to previous changes (23)
  • src/main/ai-vault/session-scanner-codex-discovery.ts
  • src/main/ai-vault/session-scanner-discovery.ts
  • src/shared/native-chat-slash-commands.test.ts
  • src/main/ai-vault/session-scanner-codex-parser.test.ts
  • src/main/native-chat/transcript-line-decoders-codex.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.ts
  • src/main/codex/wsl-codex-session-bridge.test.ts
  • src/main/ai-vault/session-scanner-codex-rollout-read.ts
  • src/main/ai-vault/session-scanner-parse-cache.ts
  • src/main/codex/codex-session-preserved-copies.ts
  • src/shared/native-chat-slash-commands.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.test.ts
  • src/main/ai-vault/session-scanner-codex-zstd.test.ts
  • src/main/ai-vault/session-scanner-codex-paths.ts
  • src/main/codex/codex-session-file-listing.ts
  • src/main/codex/codex-session-preserved-install.ts
  • src/main/codex/codex-session-bridge.ts
  • src/main/codex/codex-session-copy-markers.ts
  • src/main/ai-vault/session-scanner-source-discovery.ts
  • src/main/codex/codex-session-bridge-link.ts
  • src/main/ai-vault/session-scanner-codex-record-consume.ts
  • src/main/native-chat/transcript-codex-turn-items.ts
  • src/main/codex/codex-session-bridge.test.ts

Comment thread src/main/native-chat/transcript-stream-lines.ts
@bbingz
bbingz force-pushed the bbingz/split-7950-sessions-native-chat branch from 598ce95 to 1c0082b Compare July 12, 2026 01:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 703ebb5e-f963-4a93-980d-0b0ab4f8a791

📥 Commits

Reviewing files that changed from the base of the PR and between 598ce9545f99a66c5fe8eecff2542f6b89b58253 and 1c0082b.

📒 Files selected for processing (37)
  • src/main/ai-vault/session-scanner-codex-discovery.ts
  • src/main/ai-vault/session-scanner-codex-parser.test.ts
  • src/main/ai-vault/session-scanner-codex-parser.ts
  • src/main/ai-vault/session-scanner-codex-paths.ts
  • src/main/ai-vault/session-scanner-codex-record-consume.ts
  • src/main/ai-vault/session-scanner-codex-rollout-read.ts
  • src/main/ai-vault/session-scanner-codex-zstd.test.ts
  • src/main/ai-vault/session-scanner-discovery.ts
  • src/main/ai-vault/session-scanner-parse-cache.ts
  • src/main/ai-vault/session-scanner-source-discovery.ts
  • src/main/codex/codex-session-bridge-link.ts
  • src/main/codex/codex-session-bridge.test.ts
  • src/main/codex/codex-session-bridge.ts
  • src/main/codex/codex-session-copy-markers.ts
  • src/main/codex/codex-session-file-listing.ts
  • src/main/codex/codex-session-preserved-copies.ts
  • src/main/codex/codex-session-preserved-install.ts
  • src/main/codex/wsl-codex-session-bridge.test.ts
  • src/main/codex/wsl-codex-session-bridge.ts
  • src/main/native-chat/session-file-resolver.test.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/transcript-codex-turn-items.ts
  • src/main/native-chat/transcript-line-decoders-codex.ts
  • src/main/native-chat/transcript-read-cache.test.ts
  • src/main/native-chat/transcript-read-cache.ts
  • src/main/native-chat/transcript-reader.test.ts
  • src/main/native-chat/transcript-reader.ts
  • src/main/native-chat/transcript-stream-lines.test.ts
  • src/main/native-chat/transcript-stream-lines.ts
  • src/main/native-chat/transcript-watch.test.ts
  • src/main/native-chat/transcript-watch.ts
  • src/main/runtime/rpc/methods/native-chat.test.ts
  • src/main/runtime/rpc/methods/native-chat.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.test.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.ts
  • src/shared/native-chat-slash-commands.test.ts
  • src/shared/native-chat-slash-commands.ts
✅ Files skipped from review due to trivial changes (1)
  • src/shared/native-chat-slash-commands.ts
🚧 Files skipped from review as they are similar to previous changes (32)
  • src/shared/native-chat-slash-commands.test.ts
  • src/main/codex/codex-session-file-listing.ts
  • src/main/ai-vault/session-scanner-discovery.ts
  • src/main/ai-vault/session-scanner-codex-parser.test.ts
  • src/main/ai-vault/session-scanner-codex-zstd.test.ts
  • src/main/ai-vault/session-scanner-parse-cache.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.test.ts
  • src/main/native-chat/transcript-line-decoders-codex.ts
  • src/main/ai-vault/session-scanner-codex-paths.ts
  • src/main/native-chat/transcript-reader.ts
  • src/main/native-chat/transcript-read-cache.test.ts
  • src/main/ai-vault/session-scanner-source-discovery.ts
  • src/main/ai-vault/session-scanner-codex-rollout-read.ts
  • src/main/native-chat/transcript-codex-turn-items.ts
  • src/main/codex/codex-session-copy-markers.ts
  • src/main/codex/codex-session-preserved-copies.ts
  • src/main/runtime/rpc/methods/native-chat.test.ts
  • src/main/ai-vault/session-scanner-codex-discovery.ts
  • src/main/codex/wsl-codex-session-bridge.test.ts
  • src/main/native-chat/session-file-resolver.test.ts
  • src/main/native-chat/transcript-watch.ts
  • src/main/ai-vault/session-scanner-codex-record-consume.ts
  • src/main/native-chat/transcript-reader.test.ts
  • src/main/runtime/rpc/methods/native-chat.ts
  • src/main/native-chat/transcript-stream-lines.ts
  • src/main/codex/codex-session-preserved-install.ts
  • src/main/native-chat/transcript-read-cache.ts
  • src/main/codex/codex-session-bridge-link.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/codex/codex-session-bridge.test.ts
  • src/main/ai-vault/session-scanner-codex-parser.ts

Comment thread src/main/codex/wsl-codex-session-bridge.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/main/codex/wsl-codex-session-bridge.ts (2)

108-138: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the sourceSize-clamping semantics.

write_copy_marker deliberately overwrites source_size with target_size (line 116) before recording it as "sourceSize" in the marker, and copy_marker_matches mirrors this by building marker_prefix with the current target_size in place of the real source size (line 132). This means the marker's "sourceSize" field is not the literal size of the source file but the amount actually verified-copied — a non-obvious design choice (accounting for sources that may still be growing) that isn't explained anywhere nearby.

As per coding guidelines, "When code is driven by a design document or non-obvious constraint, add a brief one- or two-line comment explaining why it behaves that way, without restating the implementation."

📝 Suggested addition
+    // Why: "sourceSize" records the verified-copied byte count, not the
+    // literal source size, since the source may still be growing.
     'write_copy_marker() {',

Source: Coding guidelines


92-208: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoff

Consider deduplicating repeated full-file SHA-256 hashing.

A single refresh_copy call for an existing target can hash the same file content up to ~4 times: once inside copy_marker_matches, then target_fingerprint_before, target_fingerprint_after, and preserved_fingerprint. For larger rollout files and a periodic sync, this is avoidable I/O — e.g. copy_marker_matches could surface its computed fingerprint for reuse as target_fingerprint_before instead of recomputing.

Given the safety-critical, already heavily-reviewed nature of this script and that rollout files are typically modest-sized JSONL logs, this is a nice-to-have rather than urgent.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5b123b28-9eff-433f-8168-e72b1465d2da

📥 Commits

Reviewing files that changed from the base of the PR and between 1c0082b and a33d90cc9d265fcd0cad8d8ac0f0dda88c069297.

📒 Files selected for processing (1)
  • src/main/codex/wsl-codex-session-bridge.ts

@bbingz
bbingz force-pushed the bbingz/split-7950-sessions-native-chat branch from a33d90c to bd57186 Compare July 12, 2026 02:26
@bbingz

bbingz commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Followed up on the current-head review in amended commit bd5718651 (superseding the documentation-only a33d90cc9). The bridge now also explains that marker sourceSize is the verified copied prefix rather than the source file’s current full size because an active rollout can still grow.

I did not deduplicate the repeated SHA-256 calls. That suggestion is explicitly a poor-tradeoff nitpick: these rollout files are normally modest, while threading a cached fingerprint through copy_marker_matches, before/after replacement checks, and preserved-record creation would couple independent safety checks and make this heavily reviewed shell protocol harder to audit. Keeping each check locally recomputed favors correctness and reviewability over a small periodic I/O saving.

Focused bridge tests: 9/9; targeted lint/format, max-lines, and diff checks pass under Node 24.

@bbingz

bbingz commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AmethystLiang

Copy link
Copy Markdown
Contributor

reviewing

@bbingz
bbingz force-pushed the bbingz/split-7950-sessions-native-chat branch from 16df9fa to d529b25 Compare July 14, 2026 00:04

@AmethystLiang AmethystLiang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The writable per-file session bridge needs an architectural redesign before this can merge.

The bridge assumes that hardlinking an individual rollout makes the system and Orca-managed CODEX_HOME share one logical Codex session. That invariant does not hold for current Codex. A rollout is managed as a path-level .jsonl/.jsonl.zst pair: resume materializes a compressed rollout by creating a new .jsonl and removing the .jsonl.zst in that home, while background compression creates the sibling .jsonl.zst and removes the plain path. Hardlinks share an existing inode, but they do not mirror those namespace transitions. After either transition, the two homes can silently retain different histories. The cross-volume copy fallback forks even earlier. Marker, fingerprint, preservation, and race machinery cannot make two independently mutated namespaces coherent.

Please replace the writable bridge with an explicit ownership model: use one authoritative Codex persistence namespace, make import/continuation a clearly one-way fork into the managed home, or integrate through Codex thread/resume APIs and let Codex own the migration. The compressed-rollout discovery and reader work is still useful and can be retained independently.

There are also two correctness issues to address:

  1. Paginated Codex rollouts currently decode both persisted response_item messages and event_msg.item_completed TurnItems. Current Codex persists the raw response and then emits ItemCompleted, so realistic paginated transcripts duplicate both user and assistant messages. Parsing needs to be history_mode-aware or deduplicate canonical items.

  2. The remote transcript seed is described as a tail, but reading always begins at byte zero under a 64 MiB total decoded-content ceiling. Once a transcript exceeds that ceiling, the seed fails and the subscription advances to EOF, yielding no initial history. Plain JSONL needs a newline-aligned suffix read; compressed rollouts need an explicit bounded strategy.

Finally, the branch currently conflicts with main in transcript read/watch code. Conflict resolution must preserve the newer retryable notFound / first-flush behavior from #8401.

@AmethystLiang
AmethystLiang requested a review from Jinwoo-H July 14, 2026 00:34
@AmethystLiang

Copy link
Copy Markdown
Contributor

Thanks @bbingz for putting this PR together and for all the work here. I have handed the next review pass to @Jinwoo-H. Once the requested changes are ready, please ping @Jinwoo-H here for re-review.

@bbingz
bbingz force-pushed the bbingz/split-7950-sessions-native-chat branch from d529b25 to 9e6e9b3 Compare July 14, 2026 00:38
@bbingz
bbingz force-pushed the bbingz/split-7950-sessions-native-chat branch from 9e6e9b3 to f07fd6f Compare July 14, 2026 00:58
@bbingz bbingz changed the title fix(codex): recover and read bridged sessions safely fix(codex): resume sessions from authoritative homes Jul 14, 2026
@bbingz

bbingz commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested architecture change in 57318f85f (after syncing current main in 62d17500f).

The review is correct that a hardlink/copy cannot preserve Codex's .jsonl / .jsonl.zst namespace transitions. I removed both the local and WSL session bridges rather than trying to extend their race handling.

The replacement model is authority-based:

  • AI Vault scans the managed runtime home and original host/custom home directly.
  • Windows also scans default and configured WSL homes through UNC paths.
  • Every Codex session now carries an explicit owning codexHome, including ~/.codex.
  • Resume uses that exact CODEX_HOME, so compression/resume mutations occur only in the owning namespace.
  • Legacy copy markers are read-only compatibility; no session alias is created, refreshed, migrated, or automatically deleted.

Regression coverage includes the .jsonl -> .jsonl.zst transition without a managed alias, no WSL session copies, and default/custom host and WSL authority discovery.

Verification on Node 24:

  • focused authority/resume tests: 90/90
  • full Vitest: 2,826 passed files / 29,757 passed tests
  • pnpm lint
  • pnpm build:desktop
  • git diff --check origin/main...HEAD

Windows/WSL live smoke remains for CI or a Windows host. Ready for re-review.

@bbingz

bbingz commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@Jinwoo-H The requested bridge-architecture redesign is ready for re-review at exact head 57318f8.

The writable local and WSL session bridges were removed. AI Vault now discovers each authoritative Codex home directly, sessions carry their owning codexHome, and resume runs against that exact CODEX_HOME. Legacy copy markers are read-only compatibility only.

Verified at this head: focused authority/resume tests 90/90, full Vitest 2,826 files / 29,757 tests, pnpm lint, pnpm build:desktop, and git diff --check origin/main...HEAD. Windows/WSL live smoke remains for CI or a Windows host.

@Jinwoo-H

Copy link
Copy Markdown
Contributor

Thanks for the work here. Since @brennanb2025 is already migrating CODEX_HOME back to its standard location, I think the cleanest path is to hand this area over to that effort rather than continue developing this PR independently.

The bridge-removal and single-authoritative-home direction is still valuable, particularly avoiding writable aliases and preserving exact session ownership. The migration should also account for existing bridges, WSL ownership, compressed/plain rollout transitions, and Native Chat/usage discovery.

I’m going to leave this PR unmerged so @brennanb2025 can reuse any relevant pieces while implementing the consolidated approach. Thanks again for pushing the investigation and implementation forward.

@bbingz

bbingz commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

Closing following the maintainer handoff decision in this thread. The bridge-removal, authoritative-home, compressed-rollout, and Native Chat findings remain useful reference material, but this PR is no longer the intended merge vehicle. The consolidated CODEX_HOME work is proceeding through #8802, #8828, #8921, and #9179; closing this PR records that ownership transfer rather than discarding its investigation or credit.

@bbingz bbingz closed this Jul 18, 2026
@bbingz
bbingz deleted the bbingz/split-7950-sessions-native-chat branch August 1, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants