WSL Desktop cannot archive tasks stored under previous CODEX_HOME after home change

Open 💬 2 comments Opened Jul 17, 2026 by solankydev

Summary

Codex Desktop running its agent in WSL can still discover and read a task after the Desktop WSL app-server's CODEX_HOME changes, but archiving that task fails if its rollout remains under the previous CODEX_HOME.

The archive request fails with:

rollout path `/mnt/c/Users/<redacted>/.codex/sessions/.../rollout-...jsonl` must be in sessions directory

This is not a Windows-native task. It was created by the WSL agent while the WSL app-server used a Windows-mounted CODEX_HOME.

Environment

  • Codex Desktop for Windows: 26.715.2305.0
  • Bundled WSL Codex runtime recorded by the task: 0.145.0-alpha.18
  • Agent execution environment: WSL2
  • Task working directory: WSL-native Linux path
  • Old Desktop WSL CODEX_HOME: Windows-mounted path under /mnt/c/Users/<redacted>/.codex
  • New Desktop WSL CODEX_HOME: Linux-native path under /home/<redacted>/.codex
  • SQLite home remained Linux-native/shared

Steps to reproduce

  1. Configure Codex Desktop to run its agent in WSL.
  2. Start the WSL app-server with CODEX_HOME pointing to a Windows-mounted directory.
  3. Create and complete a task whose working directory is on the WSL-native filesystem.
  4. Change the WSL app-server's CODEX_HOME to a Linux-native directory and restart Codex Desktop.
  5. Observe that Desktop can still discover/read the old task by ID through the shared task index/state database.
  6. Attempt to archive the old task.

Actual behavior

The old rollout path is resolved successfully from stored task metadata, but thread/archive rejects it because it is outside the current CODEX_HOME/sessions.

The task remains unarchived and its rollout file remains intact.

Expected behavior

If Desktop can discover and read a task whose rollout is stored under a previously configured Codex home, it should also be able to archive it safely.

Possible approaches:

  • Resolve the owning sessions root from the stored rollout path and archive within that same Codex home.
  • Track the owning Codex home in thread metadata and route archive/unarchive operations accordingly.
  • Explicitly migrate or import old-home tasks into the current store.
  • If cross-home archival is intentionally unsupported, stop indexing those tasks as fully manageable and return an actionable error explaining how to archive them using the original home.

Suspected root cause

The current local archive implementation resolves the rollout through thread lookup/state metadata, then scopes it against:

store.config.codex_home/sessions

That creates an asymmetry: cross-home lookup/read succeeds, but archive validates against only the current home.

Relevant current code:

  • codex-rs/thread-store/src/local/archive_thread.rs
  • codex-rs/thread-store/src/local/helpers.rs::scoped_rollout_path

Related but distinct

  • #5290 reports the same error text on Windows, but it concerned path normalization while the rollout was reportedly inside the active sessions directory. It was closed as fixed in 2025.
  • This report concerns a valid stored rollout under a previous CODEX_HOME that remains discoverable after a deliberate home change.

Workarounds

A restart-based workaround is to temporarily restore the previous WSL app-server CODEX_HOME, restart Desktop, archive the old-home tasks, then restore the Linux-native home.

Recent Codex CLI versions also expose codex archive <session>; invoking it with a one-command CODEX_HOME override matching the rollout's original home may avoid restarting Desktop, but this should be documented or made unnecessary by cross-home routing.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗