Windows Desktop: archiving existing local threads fails with os error 2
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Summary
On Codex Desktop for Windows, archiving valid local threads repeatedly fails with:
failed to archive session: thread-store internal error: failed to archive thread: 系统找不到指定的文件。 (os error 2)
The rollout file exists at the exact path recorded in state_5.sqlite, and %USERPROFILE%\.codex\archived_sessions also exists. Restarting Codex and archiving one thread at a time do not help.
Environment
- Codex Desktop package:
26.814.5517.0 - App-server client version in logs:
26.814.41957 - Windows:
10.0.26200.9168 - Local Windows threads; affected projects include a repository on a non-system drive
- Thread store under
%USERPROFILE%\.codex
Steps to reproduce
- Open Codex Desktop on Windows.
- Select an older local project thread.
- Choose Archive from the thread menu.
- Repeat after restarting Codex or with a single thread rather than batch archive.
Actual behavior
The thread remains unarchived. The thread/archive RPC shuts down the loaded thread and clears its listener, but then returns os error 2.
The database row remains:
archived = 0
archived_at = NULL
The recorded rollout path has the Windows extended-length prefix:
\\?\C:\Users\<user>\.codex\sessions\YYYY\MM\DD\rollout-...jsonl
Independent checks confirm:
- the source rollout file exists and is readable;
- the destination archive directory exists;
- no destination file with the same name exists;
- the same failure occurs across multiple threads and rollout sizes;
- restarting the app does not change the result.
Representative log sequence:
thread <id> was active; shutting down
Shutting down Codex instance
Agent loop exited
clearing thread listener during thread-state teardown
failed to archive thread: The system cannot find the file specified. (os error 2)
Expected behavior
A valid rollout under the configured sessions directory should be moved to archived_sessions, and the thread row should be updated to archived = 1.
Diagnostic workaround that succeeded
After first backing up state_5.sqlite, manually moving the exact rollout to archived_sessions and updating archived, archived_at, and rollout_path made the thread disappear from the active list. A subsequent thread/archive call then returned success.
This suggests a Windows path-resolution or source-path/state mismatch inside the normal archive implementation, possibly involving the \\?\ path prefix. No conversation content or project files are included in this report.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the thread/archive RPC and the archive implementation that moves the recorded rollout path, then reproduce the failure on Windows using a local thread with the extended-length path prefix. Compare source and destination path handling and the state_5.sqlite row during the operation. Done means a valid rollout moves to archived_sessions, the row is updated to archived = 1 with its archive metadata, and the RPC succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sqlite
- Domain
- backend, databases, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100