Repository navigation
Support multiple Codex homes in Vault - #4067
austinywang wants to merge 25 commits into
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds configurable additional Codex homes, persists and notifies changes, concurrently loads sessions per home (SQL and disk), labels entries with their source, updates UI to show source labels, and ensures resumed sessions set CODEX_HOME for configured homes. ChangesMultiple Codex Home Discovery and Display
Sequence DiagramsequenceDiagram
participant UI
participant SessionIndexStore
participant CodexSQLLoader
participant DiskScanner
participant ErrorBag
UI->>SessionIndexStore: loadCodexEntries(needle, offset, limit)
SessionIndexStore->>CodexSQLLoader: loadCodexEntriesViaSQL(home, dbPath?, sessionsRoot?, sourceLabel?)
SessionIndexStore->>DiskScanner: loadCodexEntriesFromDisk(home, sourceLabel)
CodexSQLLoader-->>SessionIndexStore: entries / localized errors
DiskScanner-->>SessionIndexStore: entries / localized errors
SessionIndexStore->>ErrorBag: record warnings/errors (home-labeled)
SessionIndexStore-->>UI: merged, sorted, paginated entries
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (3 errors, 1 warning, 1 inconclusive)
✅ Passed checks (12 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR extends Vault's Codex session discovery to scan multiple
Confidence Score: 4/5Safe to merge after addressing the session ID regression in the SQL fallback path. The SQL entry builder changes the fallback session ID format for default-home sessions whose Codex database row has no rollout_path, replacing the stable "codex:session-id" with "codex:/path/to/home:session-id". Any persisted session reference that relied on the old format would be orphaned on first launch. The rest of the change — multi-home aggregation, per-home source labels, CODEX_HOME resume injection, and the timer-backed debounce/expiry replacements — is well-structured and correctly actor-isolated. Sources/SessionIndexStore+CodexSQL.swift — the codexEntry(from:home:sourceLabel:) fallback ID construction at line 212. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Vault session load triggered] --> B[codexSessionHomes]
B --> C{Default ~/.codex exists & readable?}
C -->|yes| D[Add default home]
C -->|no| E[Skip silently]
B --> F[For each additionalHome setting]
F --> G{Home dir exists & readable?}
G -->|yes| H[Add additional home]
G -->|no| I[Warn + skip]
D & H --> J[withTaskGroup: query each home concurrently]
J --> K{state_5.sqlite present?}
K -->|yes| L[loadCodexEntriesViaSQL with home + sourceLabel]
K -->|no| M[loadCodexEntriesFromDisk with home + sourceLabel]
L & M --> N[Merge all entries]
N --> O[Sort by modified desc / apply offset+limit]
O --> P[SessionEntry with sourceLabel + codexHome in AgentSpecifics]
P --> Q{Resume?}
Q -->|default home| R[codex resume sessionId ...]
Q -->|additional home| S[env CODEX_HOME=path codex resume sessionId ...]
Reviews (19): Last reviewed commit: "merge: sync issue-4049 with main" | Re-trigger Greptile |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…odex-home-dirs # Conflicts: # Sources/SessionIndexModels.swift
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/SessionIndexStore.swift`:
- Around line 1552-1557: Update the user-facing warning constructed in
SessionIndexStore.swift so it includes 1–2 concrete recovery actions: change the
string built for format/message (the String(localized: ...) and the composed
message variable) to append guidance such as “Please check that the directory
still exists or remove/update this configured path in settings.” and then add
that combined message into errorBag.add; repeat the same change for the other
occurrence around the block referenced at lines 1614–1620 so both warnings offer
clear next steps to the user.
- Around line 1483-1495: The code may pass duplicate sourceLabel values when two
homes share the same displayName (homes → home.label), making merged session
lists ambiguous; before the withTaskGroup loop compute a frequency map of
homes.map { $0.label } to detect collisions and for any label with count > 1
generate a disambiguated label (e.g., append or replace with an abbreviated path
derived from home.path or home.identifier) and use that disambiguated value
instead of home.label when setting sourceLabel in the loop that calls
loadCodexEntries; ensure you still respect showSourceLabels logic (use nil when
labels are suppressed) and reference the existing symbols showSourceLabels,
homes, sourceLabel, home.label, and loadCodexEntries to locate and apply the
change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3b475dd4-33c0-4cc9-a971-54911ec9f919
📒 Files selected for processing (4)
Resources/Localizable.xcstringsSources/SessionIndexModels.swiftSources/SessionIndexStore.swiftcmuxTests/SessionIndexViewTests.swift
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/agent-hooks.md`:
- Around line 81-96: Add a short note to the Vault docs (after the cmux.json
example and the paragraph about sessions) clarifying error handling: state that
entries in "codex.additionalHomes" that do not exist, are unreadable, or are
empty are silently ignored and do not block discovery of sessions from other
homes; also mention that resuming a session still sets CODEX_HOME to the
matching valid directory and that invalid paths simply have no effect.
- Line 95: The sentence currently reads "Sessions from configured homes show
their source label in Vault" which is misleading; update that sentence in
docs/agent-hooks.md so it states that sessions from all homes show their source
label (e.g., "Sessions from all homes show their source label in Vault
(including the default home labeled 'Default Codex')"), replacing the existing
phrase to clarify that the default home is included.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0c4c5848-bb33-4c15-a8d5-b21ce0ca96ba
📒 Files selected for processing (5)
Resources/Localizable.xcstringsSources/KeyboardShortcutSettingsFileStore+Template.swiftSources/SessionIndexStore.swiftdocs/agent-hooks.mdweb/data/cmux.schema.json
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Resources/Localizable.xcstrings`:
- Around line 107125-107192: The four new localization keys
(sessionIndex.codexHome.defaultLabel, sessionIndex.codexHome.error.openDatabase,
sessionIndex.codexHome.error.unsupportedSchema,
sessionIndex.codexHome.warning.unavailable) only include "en" and "ja"; add
entries for the remaining locales (ar, bs, da, de, es, fr, it, ko, nb, pl,
pt-BR, ru, th, tr, uk, zh-Hans, zh-Hant) under each key, using the same
structure as existing localizations, set "state" to "translated" for each added
locale, and for lower-confidence locales supply the English fallback string as
"value" while providing higher-confidence translations where available (e.g.,
add a proper Korean translation for ko). Ensure the keys and JSON structure
exactly match the existing entries so tooling picks them up.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6bc7b582-a371-4ee8-9430-b89f2982eb32
📒 Files selected for processing (2)
Resources/Localizable.xcstringsSources/KeyboardShortcutSettingsFileStore.swift
|
@coderabbitai review Prior actionable threads have been addressed and resolved; please review the current head. |
|
✅ Actions performedFull review triggered. |
Stale automated review; inline threads were addressed/resolved and current CodeRabbit status is passing.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit be5a8f2. Configure here.

Summary
Closes #4049
Validation
Local app build/reload intentionally deferred until required CI is green.
Note
Medium Risk
Moderate risk because it changes Vault’s Codex session discovery/resume behavior (multi-source merge, new identifiers, new settings parsing) and adds new async/timer-based behaviors that could affect indexing/UI refreshes.
Overview
Vault now supports discovering Codex sessions from multiple CODEX_HOME directories: it always scans the default
~/.codexand can additionally scancodex.additionalHomesfromcmux.json(string or{path, displayName|name}), with paths normalized/deduped and settings changes triggering a reload.Codex session loading is updated to run SQL-first per home (with disk-scan fallback), merge results across homes, label entries with a per-home source label in the UI, and resume sessions from non-default homes by injecting
CODEX_HOMEinto the generatedcodex resumecommand. Error handling for unavailable homes/DB issues is localized and logged, tests are added for home labeling/resume behavior, and the config template/schema/docs are updated accordingly; additionally, drag expiration and search debounce switch fromTask.sleepto timer-backed implementations.Reviewed by Cursor Bugbot for commit d945ec2. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds support for multiple Codex homes in Vault, merging sessions across the default and configured homes with clear source labels and correct
CODEX_HOMEon resume. Also replaces sleep-based waits with timer-backed debounce/expiration and fixes drag hand-off.New Features
cmux.json: addcodex.additionalHomes(string or{ path, displayName|name }); paths are tilde-expanded, normalized, de-duped; settings allowlisted; schema/docs/template updated.~/.codexplus configured homes and shows per-home labels in rows/popovers/transcript previews (hidden when only one). Duplicate labels are disambiguated by showing the path; the default home is labeled “Default Codex.”CODEX_HOME.codex.additionalHomeschanges via a settings notification.Bug Fixes
sessionsdirectory return no results and no warnings.Task.sleepwith timer-backed debounce in the search popover and timer-based drag expiration.Written for commit d945ec2. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
New Features
Settings
Schema
UI
Documentation
Localization
Tests