Migrating Codex History and Projects Between Windows User Profiles #46461
Muhengi
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I wanted to share, in the form of a practical guide, my own experience of moving the ChatGPT/Codex application environment completely from one Windows user profile to another on the same computer, with the help of AI during the process.
I went through the migration, troubleshooting, data recovery, Project migration, archived conversation handling, and history visibility problems myself. I hope this guide will be useful to others who are facing a similar situation and want to avoid unnecessary trial and error.
Purpose
This guide describes how to migrate a local Codex Desktop environment from one Windows user profile to another on the same PC while preserving:
Example profiles used throughout this guide:
The procedure is intentionally written so that it can also be given to an AI assistant and used as a technical specification for generating the required PowerShell commands and migration scripts.
1. Validated environment
The migration/recovery work described here was performed using:
The exact Codex Desktop application build was not recorded during the migration, so no specific Desktop version is claimed here.
Codex continues to evolve, so internal storage structures and migration behavior may change between releases.
Current Codex GitHub issues also document different Windows problems involving Project-to-thread associations, archived sessions, and history visibility. See the references at the end of this guide.
2. The key concept: Codex history is local
A Windows profile migration should not be treated as a normal account-login migration.
Codex keeps important local session data under the user's
.codexdirectory.For example:
and after migration:
An important distinction is:
The rollout JSONL files are especially important because they contain the underlying session history.
This means:
does not automatically mean:
Windows migration problems have been reported where local rollout/session data and thread records remained available while Project associations or UI visibility were lost. See openai/codex #36663.
3. Preserve the old profile
The first rule of the migration is:
Do not delete or modify the old profile during the migration.
The model should be:
Keep the original:
available until the new profile has been fully verified.
4. Prepare a fresh authenticated User2 profile
Under
User2:.codexdirectory.The new profile's authentication state should remain the authoritative authentication state.
Do not blindly replace:
with the old user's authentication file.
The goal is:
5. Back up the new User2 Codex directory
Before changing anything under:
create a complete backup.
For example:
Keep this backup until the migration has been completely verified.
6. Copy the actual session history
The first migration layer is the actual conversation/session data.
Copy:
to:
Also copy:
to:
Preserve the directory structure and file names.
Do not rename individual rollout files.
Do not rewrite the historical rollout JSONL just to update Windows usernames or paths.
Treat the rollout as historical source data.
7. Copy the session index
Copy:
to:
The session index contains discovery/index information such as session IDs, names and timestamps.
A useful mental model is:
The index and the SQLite state can become inconsistent after migration, so a conversation may still physically exist even when the UI does not display it correctly.
8. Projects are a separate migration layer
Copying:
does not guarantee that Codex Projects will be reconstructed correctly.
Projects and threads are represented separately in application state.
The relevant concepts include:
The important relationship is:
A migration can therefore preserve every conversation while still leaving Projects empty or leaving conversations unassigned.
This exact class of problem has been reported in openai/codex #36663, where local thread/session data survived but Project-to-thread associations were lost. A similar case is described in #42867, where Project and Thread records remained but thread Project assignments disappeared.
9. Project migration should use IDs, not names
Do not assume that this is sufficient:
The migration should preserve the actual Project relationships.
Conceptually:
Where necessary, maintain mappings such as:
and:
Do not infer Project membership from thread titles.
Do not infer Project membership from the current working directory alone if a reliable historical Project-to-thread assignment exists.
10. Remap workspace roots to the new Windows profile
A Windows username change normally changes paths such as:
into:
The migration process should therefore distinguish:
from:
For example:
Do not modify historical rollout data merely to change the path.
Update the Project/workspace configuration instead.
11. Handle global Project state separately
Codex global state can also contain Project and thread relationship information.
Conceptually, the migration may need to preserve:
Do not copy this information blindly if it contains paths belonging to
User1.The correct approach is:
The importance of this distinction is also demonstrated by #36663 and #42867, where Project migration state and thread assignments became inconsistent.
12. Archived conversations are not deleted conversations
Do not assume:
Archived sessions can remain under:
Current Codex Desktop versions also provide an Archived Chats area and an Unarchive action.
When possible, use:
instead of manually editing the database.
However, archive behavior has also had Windows-specific regressions. For example, #39150 documents an archive failure involving Windows rollout paths using the
\\?\prefix.13. Projectless conversations can still be valid
A thread can have:
without being corrupted or deleted.
This means:
Do not automatically assign such a thread to a Project based only on its title or directory.
If a reliable historical Project assignment exists, use that information.
14. Use one read-only diagnostic when something is missing
A migration guide should not require users to run dozens of forensic scripts.
If a conversation is missing or appears empty, ask an AI assistant to generate one read-only diagnostic PowerShell script.
That diagnostic should collect, for each affected thread:
The diagnostic should be:
The AI should classify the situation before generating any recovery script.
15. AI-assisted migration specification
If this guide is given to an AI assistant, the AI should interpret the task using the following rules.
Profile variables
Use generic variables:
Never hard-code a real user's name unless the user explicitly provides it.
Mandatory safety rules
The AI must:
OLD_CODEX_HOMEuntouched.NEW_CODEX_HOMEbefore migration.auth.jsonas part of a normal history migration.exitto close PowerShell.Recommended migration order
Recovery order
If a conversation is missing:
The AI should not jump directly from:
to:
16. Expected result
A successful migration should result in something like:
The goal is not merely that the files exist.
The target state is:
17. Migration checklist
18. Related Codex Issues and References
The technical distinctions in this guide are not based on a single migration experience. Similar behaviors have been independently reported in the public Codex repository.
Project and migration problems
openai/codex #36663 — Windows migration drops existing Codex project-to-thread associations
Describes a Windows migration where local session/thread data remained available but Project-to-thread associations were lost. ([github.com](#36663))
openai/codex #42867 — Projects disappear while threads move to Recents
Describes Projects and Threads remaining in SQLite while thread Project assignments disappear. ([github.com](#42867))
Session/index visibility
openai/codex #22452 — Local thread history/index drift
Documents cases where local Codex state and the visible thread list become inconsistent. ([github.com](#22452))
Archive behavior
openai/codex #39150 — Windows archive failure involving
\\?\rollout pathsDocuments a Windows archive failure caused by rollout path handling. ([github.com](#39150))
History projection
openai/codex #38762 — Migrated persisted subagent threads with empty projected history
Documents a case where a migrated subagent rollout remains non-empty while projected history appears empty because of the
subagent_history_start_ordinalboundary. ([github.com](#38762))openai/codex #41566 — Duplicate rollout ordinal freezes paginated history projection
Documents history projection becoming stuck because of a duplicate ordinal in the rollout. ([github.com](#41566))
openai/codex #42027 — Interrupted turn causes duplicate ordinal and breaks history projection
Documents a related projection failure after an interrupted turn. ([github.com](#42027))
The issue list above is not exhaustive and may change as Codex evolves.
AI disclosure
This guide was prepared with the assistance of an AI system and was subsequently reviewed and structured for practical use.
It was created from technical experience gained during a Codex migration/recovery process. Relevant Codex GitHub issues that is found by AI have also been added as references to the guide.
This is not an official migration procedure; it is a personal experience and knowledge-sharing guide.
The information described here may change between Codex versions. Always create an independent backup before modifying an existing Codex profile.
All reactions