feat: multi-environment Codex provider targets (Windows + WSL)#5668
feat: multi-environment Codex provider targets (Windows + WSL)#5668M1kasali wants to merge 15 commits into
Conversation
pnpm 11 requires explicit allowBuilds booleans. Approve esbuild postinstall (needed by Vite/Vitest) and keep msw ignored, matching onlyBuiltDependencies.
Add ADR-0002 and research notes for stable custom session buckets, align the design doc and CONTEXT with implemented history rewrite rules, and capture the Windows/WSL RC handoff snapshot for the multi-environment slice.
Improve WSL path/hash handling for provider projection writes and keep CREATE_NO_WINDOW coverage in inspection tests so UI actions do not flash console windows on Windows hosts.
Stop generating per-provider cc_switch_* runtime keys. Managed third-party providers and official unify injection share the stable custom model_provider bucket so Codex native history stays visible across channel switches.
Introduce per-Target explicit migration into the custom session bucket with backup ledgers for Windows and WSL, share the process-wide history op lock with official unify, surface partial-failure status, and expose Tauri commands for settings-driven migrate/restore.
Add settings APIs and Environment Targets history migrate/restore UX with managed-only gating, distinct skip toasts, and confirm-disabled while pending. Also disable Provider enable buttons during an in-flight switch to avoid duplicate WSL writes.
Scope Session Manager to the selected Managed Target for Codex. Windows targets use the host Codex home; WSL targets prefer a host-visible path (or UNC on Windows) and fall back to argv-safe WSL reads with wsl: sources for message load and delete. Query keys include targetId so UI state stays isolated per environment.
Enrich the environment selector with current Provider display names, resolve Provider IDs to names in the settings target cards, and collapse history migrate/restore behind an advanced section to reduce accidental clicks.
|
please remove the unnecessary documentation files |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ba6f0f45a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| created_at, | ||
| last_active_at, | ||
| source_path: Some(source_path_display.to_string()), | ||
| resume_command: Some(format!("codex resume {session_id}")), |
There was a problem hiding this comment.
Route WSL resume commands through their owning target
For metadata parsed from a WSL-backed session, this still exposes the generic codex resume <id> command. SessionManagerPage merely copies or launches that string and does not use targetId or the encoded WSL source, so running it from the Windows host targets the Windows Codex installation, where the WSL session is unavailable or an unrelated session with the same ID could be selected. Generate a target-aware command such as a wsl.exe -d ... -u ... invocation, or route resume through a backend command that resolves the recorded target.
Useful? React with 👍 / 👎.
| for linux_path in paths { | ||
| let Some(bytes) = self.read_file_bytes(distro, user, &linux_path)? else { | ||
| continue; | ||
| }; | ||
| let Ok(text) = String::from_utf8(bytes) else { |
There was a problem hiding this comment.
Avoid loading every complete WSL history file during scans
When a WSL target is not host-mounted, every session-list refresh starts a separate wsl.exe process and reads each entire JSONL transcript into a Vec and then a String, although the parser only uses the first 10 and last 30 lines. Codex transcripts grow with the full conversation, so targets with many or large sessions incur memory proportional to all history and can leave the session page loading for a long time. Fetch bounded head/tail data inside WSL or stream only the metadata needed for the listing.
Useful? React with 👍 / 👎.
Summary
Enable Windows CC Switch to manage Windows Codex and WSL2 Codex as separate Managed Targets without copying full config trees or merging cross-platform paths.
customroute: managed third-party (and unified official) Providers share Codex’s stable session bucket so native history stays visible when switching channels.wsl:sources).Non-goals (follow-ups)
Safety notes
auth.json, sessions, or move history.Test plan
pnpm typecheckEnvironmentTargetsPanel, switch mutation)cargo test --test target_history_migration --test managed_target_sessionscargo clippy --all-targets -- -D warnings/cargo fmt --checkauth.json/ Local Fields unchanged across switchesArchitecture references
docs/adr/0001-model-provider-management-as-environment-targets.mddocs/adr/0002-preserve-upstream-codex-unified-history-per-target.mddocs/handoff/windows-wsl-provider-customization-status-2026-07-23.md