Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save keeran/c29210899eb15690d7b8d29e0a7c07b1 to your computer and use it in GitHub Desktop.

Select an option

Save keeran/c29210899eb15690d7b8d29e0a7c07b1 to your computer and use it in GitHub Desktop.

Codex Thread Project Reassignment Notes

Date: 2026-06-01

Goal

Explore whether an existing Codex Desktop thread can be reassigned from a projectless/public space into a saved project while preserving the same thread id and future execution behavior.

Target thread discussed by the user:

  • 019e7fad-654e-7283-b280-0152cce172f7
  • Current recorded cwd: /Users/keeran/Documents/Codex/2026-05-31/i-need-you-to-create-a
  • Desired project cwd: /Users/keeran/src/codex-flight-recorder

Stores Observed

~/.codex/state_5.sqlite

Primary durable thread index. Relevant table: threads.

Important columns:

  • id
  • rollout_path
  • cwd
  • title
  • archived
  • git_sha
  • git_branch
  • git_origin_url
  • created_at_ms
  • updated_at_ms

Changing threads.cwd and git columns alone is not enough. The database row changed, but read_thread continued to show the old cwd until JSONL metadata was also edited.

~/.codex/sessions/.../rollout-<timestamp>-<thread-id>.jsonl

This is not just transcript history; it carries execution context.

Relevant records:

  • First line session_meta.payload.cwd
  • First line session_meta.payload.git
  • Per-turn turn_context.payload.cwd
  • User-visible <environment_context><cwd>...</cwd></environment_context> response items

Updating only session_meta made read_thread and list_threads report the new cwd. It did not make future tool execution run in the new cwd.

~/.codex/.codex-global-state.json

Relevant keys:

  • electron-saved-workspace-roots
  • project-order
  • active-workspace-roots
  • projectless-thread-ids
  • thread-workspace-root-hints
  • thread-projectless-output-directories

Project threads do not appear to need per-thread entries here. Projectless threads do.

Removing a lab thread from projectless-thread-ids, thread-workspace-root-hints, and thread-projectless-output-directories was not enough to make future execution run inside the target project. The app later re-added projectless mappings.

~/.codex/config.toml

Contains trusted project path entries, but adding a [projects."..."] entry manually did not make create_thread accept that path as a saved project in the running app.

The thread tool's saved-project list appears to come from app state, not a hot reload of this TOML file.

~/.codex/session_index.jsonl

Contains title and update timestamp by thread id. No project/cwd association found.

~/.codex/logs_2.sqlite

Logs are keyed by thread_id, with no project/cwd association found.

Lab Threads Used

Projectless lab thread:

  • 019e807b-1d50-7440-b3a5-ae3db1641bcf

Project lab thread:

  • 019e807b-1e2a-7561-917a-1dca21cc5f4e

The project lab thread was created in /Users/keeran/src/codex-flight-recorder using the supported create_thread project target.

Reassignment Experiment

For the projectless lab thread, I changed:

  • state_5.sqlite.threads.cwd
  • state_5.sqlite git metadata columns
  • session_meta.payload.cwd
  • session_meta.payload.git
  • prior structured turn_context.payload.cwd
  • prior <environment_context> cwd text
  • removed projectless side mappings from .codex-global-state.json

Observed behavior:

  1. After updating SQLite only, read_thread still showed old cwd.
  2. After updating JSONL session_meta, read_thread and list_threads showed new cwd.
  3. Continuing the thread still executed in the original projectless cwd.
  4. Updating prior turn_context records did not fix execution while the thread was already loaded.
  5. Archive/unarchive unloaded the thread, but unarchive and later continuation re-derived projectless mappings.
  6. A later continuation ran in a generated projectless fallback directory with read-only sandboxing, not in the desired project.

Conclusion

There are at least two separate concepts:

  • Display/index placement, controlled by SQLite, JSONL metadata, and global projectless indexes.
  • Future execution placement, controlled by live app/runtime state that is not fully represented by the stores edited during this lab, or is not hot-reloaded safely.

A cosmetic move is possible by editing the durable stores. A reliable live move that preserves the thread id and makes future turns execute in the destination project was not proven safe.

Safe Recommendation

Do not perform a live reassignment of 019e7fad-654e-7283-b280-0152cce172f7 from inside a running Codex Desktop session.

The lowest-risk supported approach remains:

  1. Create a new thread in the desired project.
  2. Seed it with the important context from the old thread.
  3. Archive or leave the old thread as the source record.

An offline/cold reassignment may be possible after fully quitting Codex Desktop, backing up all stores, editing SQLite, JSONL, and global state together, then relaunching. That path was not executed because it would cross the stability line for this active setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment