Codex Desktop session fails to open when git directives contain Windows paths
What version of the Codex App are you using (From "About Codex" dialog)?
26.513.31313
What subscription do you have?
Not relevant / not known.
What platform is your computer?
Windows 10.0.28000, x64
Runtime: Electron 42.0.1
Locale: zh-CN
Shell: PowerShell
Affected session source: vscode
What issue are you seeing?
Codex Desktop can fail to open an existing session when the session history contains assistant messages with raw git UI directives such as:
::git-stage{cwd="D:\project\multiProject\XM00029\XM00029_software_Back-end"}
::git-commit{cwd="D:\project\multiProject\XM00029\XM00029_software_Back-end"}
When reopening the session, the renderer attempts to parse these lines as Markdown directives and throws a syntax error. The session resume request appears to succeed on the backend, but frontend rendering fails, making the session unusable from the UI.
Related to #22956, but this report isolates the suspected trigger: standalone ::git-*{cwd="C:\..."} directive lines with Windows paths in historical assistant-visible Markdown.
The affected session characteristics:
- The session rollout file was valid JSONL and could be parsed line by line.
- The workspace path existed and was accessible.
- The session contained many assistant messages with raw git directives emitted as visible Markdown text.
- Some directive paths used Windows backslashes, for example
D:\project\.... - The same session could be repaired by removing standalone
::git-stage{...}and::git-commit{...}lines from rendered message text.
The app-side Sentry scope / renderer logs recorded this error:
Error: invalid syntax at line 1 col 5:
1 cwd="D:\project\multiProject\XM00029\XM00029_software_Back-end"
^
Stack trace excerpt:
at S._token (.../app-server-manager-signals-*.js)
at Object.tokenizer (.../app-server-manager-signals-*.js)
at marked.esm-*.js
at Br (.../markdown-*.js)
Backend resume logs showed only a PowerShell shell snapshot warning, which appears unrelated:
thread/resume ... Failed to create shell snapshot for powershell:
Shell snapshot not supported yet for PowerShell
No JSONL corruption was found.
What steps can reproduce the bug?
- Use Codex Desktop on Windows.
- Create or edit a session history so an assistant message contains a standalone line like:
::git-stage{cwd="D:\project\repo"}
- Close/reopen or resume the session.
- Observe that the renderer throws a Markdown directive syntax error while parsing the
cwd=...attribute.
What is the expected behavior?
Codex Desktop should open the session normally.
If a Markdown directive is malformed or contains unsupported attribute syntax, the renderer should degrade gracefully by rendering it as plain text or ignoring only that directive. A single parse error in historical assistant output should not make the entire session impossible to open.
What is the actual behavior?
The frontend Markdown renderer throws during parsing and the session cannot be opened normally.
Suspected root cause
There are likely two product-side issues:
- Codex-generated git directives are emitted into normal assistant Markdown history, rather than stored or handled as structured metadata that is safe to replay.
- The Markdown directive parser does not tolerate Windows paths/backslashes in directive attributes and allows a directive parse error to break rendering of the whole session.
The crash trigger appears to be standalone directive syntax with a Windows path:
::git-stage{cwd="D:\project\repo"}
Forward-slash paths such as D:/project/repo appear less risky, but the renderer should still not crash on invalid directive syntax.
Workaround used
The affected rollout JSONL was repaired by:
- Backing up the original session file.
- Parsing each JSONL line as JSON.
- Recursively removing standalone lines matching:
::git-stage{cwd=...}
::git-commit{cwd=...}
- Rewriting the JSONL.
- Re-validating that all JSONL lines parse successfully and no standalone git directive lines remain.
After this cleanup, the session file remained valid and the problematic rendered text was gone.
Suggested fix
- Make Markdown directive parsing fail-soft: malformed directives should render as text, not crash the conversation view.
- Escape, normalize, or disallow raw Windows paths in directive attributes before storing them in assistant-visible Markdown.
- Prefer storing git UI events as structured metadata instead of raw assistant message text.
- Add regression tests for replaying historical sessions containing:
::git-stage{cwd="D:\project\repo"}
::git-commit{cwd="D:\project\repo"}
Impact
This makes long-running Codex sessions unrecoverable from the UI even though their rollout files are not corrupt. Users may lose access to important project history unless they manually edit internal .codex session files.
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Independent confirmation from another Windows machine. This is the same root cause, and the local repair confirms the trigger is the stored git directive text rather than git/repo corruption.
Environment observed locally:
OpenAI.Codex_26.513.3673.0_x64__2p2nqsd0c76g026.513.31313cli_version:0.131.0-alpha.9C:\Users\<user>\Desktop\OG Websites\publicWhat happened:
npm.cmd run buildpassed.Local log evidence:
Stack fragments in the same error boundary:
In the affected rollout JSONL, the bad git directive block appeared in three persisted places:
event_msg.payload.messageresponse_item.payload.content[0].texttask_complete.payload.last_agent_messageLocal mitigation that fixed the thread:
Result: the thread rendered normally again. The repair log showed
Removed directive blocks: 3, and a follow-up scan found no remaining rendered Windows-path git directive block in that thread.Suggested product fix:
LocalConversationPage.cwdpath and abranchattribute.This confirms the issue is not caused by
git add,git commit,git push, or a corrupt repo. It is a replay/rendering failure for stored directive-shaped assistant text on Windows.Update after further local investigation and mitigation:
I found this was not limited to one broken transcript. On the affected Windows machine, the same renderer-triggering pattern existed across saved Codex history:
A local guard was also added so future assistant-visible output on that machine avoids emitting raw git action directive-shaped text with Windows paths. That prevents the local recurrence, but it is only a workaround. The app renderer can still be made unrecoverable by persisted historical chat/tool text that happens to look like one of these internal directives.
Updated suggested fix direction:
The important new finding is scale: once this pattern exists in saved history, fixing only the currently selected thread is not enough. Any old thread containing the same marker-shaped text can re-trigger the same generic “Oops, an error has occurred” screen later.
I made a small Windows-only local repair tool for this issue:
Repository: https://github.com/Nitmi/codex-session-doctor
Direct download: https://github.com/Nitmi/codex-session-doctor/releases/download/v1.0.0/Codex.Session.Doctor.exe
Release page: https://github.com/Nitmi/codex-session-doctor/releases/tag/v1.0.0
What it does:
::git-*{cwd="C:\..."}marker lines that trigger the renderer crash..exe; no Node.js, Bun, Go, or other runtime required.This is only a local workaround so users can recover existing broken sessions while waiting for the product-side fix. The product still needs to make Markdown/directive parsing fail-soft and avoid persisting UI git markers as assistant-visible Markdown.
I can reproduce what looks like the same issue on another Windows machine.
Environment:
Microsoft Windows NT 10.0.26200.0 x64OpenAI.Codex_26.513.3673.0_x64__2p2nqsd0c76g00.131.0-alpha.9User-facing symptom:
糟糕,出错了The local logs match the renderer failure described here. I see repeated
LocalConversationPageerror-boundary crashes with:Examples from separate affected workspaces on the same machine all fail with the same shape:
The stack also goes through the same renderer path:
I also see
thread/goal/get -> goals feature is disabledaround the same time, but the fatal failure is the frontend renderer error boundary while parsing thecwd="..."content.So this is an independent reproduction of the same Windows-path / directive-rendering failure mode, not just the generic error screen. I am omitting raw paths and full logs from the public comment, but sanitized excerpts above are from the local desktop logs.
We've issued a hotfix to address this. Please update to the latest version.