Codex desktop resumed continuing chat with wrong workspace/cwd and AGENTS.md
Summary
A continuing Codex desktop chat for [WORK_PROJECT_REPO] was resumed/routed with the wrong workspace context: [PERSONAL_FOLDER].
The prompt was typed in an existing project chat, but the model context for the next turn loaded cwd and AGENTS.md from an unrelated personal folder. The assistant then attempted Git/repo operations in that unrelated folder before the mismatch was noticed.
Environment
- App: Codex desktop
- App version:
26.519.5221.0 - OS: Windows
10.0.26200.8457 - Time observed:
2026-05-28 11:02 +08:00
Expected behavior
A continuing chat thread should preserve the original workspace binding and load the cwd / AGENTS.md associated with that thread's project.
If the app cannot safely restore the original workspace, it should warn the user or ask for confirmation before injecting a different workspace into the model context.
Actual behavior
The continuing chat was presented to the model with:
cwd = [PERSONAL_FOLDER]AGENTS.md instructions for [PERSONAL_FOLDER]
This did not match the ongoing conversation, which was about [WORK_PROJECT_REPO].
Impact
- Private local folder names can be exposed in model context and assistant replies.
- The assistant may run Git or filesystem commands in an unrelated workspace.
- The user can lose trust that a continuing project chat is still attached to the intended project.
Privacy note
I am intentionally redacting local paths, repository names, and user-identifying folder names from this public report. I can provide sanitized logs or further details privately if needed.
Mitigation attempted
I added a local global instruction telling Codex to verify that cwd matches the project implied by the conversation before running Git/filesystem/project commands. This is only a mitigation; the underlying issue appears to be in desktop thread/workspace routing or context restoration.
3 Comments
Clarification: the
[WORK_PROJECT_REPO]and[PERSONAL_FOLDER]labels in the original report are only privacy-preserving placeholders, not the essence of the bug.The more general failure mode appears to be: a continuing chat that originally belonged to one workspace can be resumed with the
cwdandAGENTS.mdfrom a different currently active/running project or selected workspace. In other words, the issue is not specific to work vs personal folders; the concern is that the desktop app may bind a resumed thread to the wrong active project context.Expected behavior: each continuing chat should remain bound to its original workspace, or the app should explicitly warn/ask before switching that thread to any different active workspace.
Privacy/wording correction: please treat the earlier placeholder
[PERSONAL_FOLDER]only as a redacted stand-in foranother workspace. A better generic framing is:[ORIGINAL_WORKSPACE]: the workspace the continuing chat originally belonged to[OTHER_ACTIVE_WORKSPACE]: a different currently active/running/selected workspace whosecwdandAGENTS.mdwere injected insteadThe issue should not depend on, or reveal, whether either workspace is personal, work-related, or any other category.
Adding a macOS reproduction and a non-destructive workaround that successfully repaired one existing thread.
Environment
26.820.609400.150.0-alpha.826.6.2, arm64Observed state
cwd.session_metacontained the old path.turn_contextrecords used the correct path for approximately 407 turns.cwdat a turn boundary and stopped applying the intended workspace'sAGENTS.md.I avoided editing
state_5.sqlite, rollout JSONL, or Desktop global state directly.Single-thread recovery that worked
cwdstate_5.sqlitethreads.cwdturn_context.cwdAll four locations matched the corrected path. The original thread ID and history were preserved. No new thread, symlink, or direct state-file edit was required.
Important notes
thread ... already has an active writer.A first-party Desktop recovery action would still be preferable: detect an invalid or mismatched
cwd, let the user select the correct project root, update the loaded thread safely, and verify persistence after restart.