codex - 💡(How to fix) Fix Codex Desktop session fails to open when git directives contain Windows paths

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error: invalid syntax at line 1 col 5:

1 cwd="D:\project\multiProject\XM00029\XM00029_software_Back-end" ^

Root Cause

Suspected root cause

Fix Action

Fix / Workaround

Workaround used

Code Example

::git-stage{cwd="D:\project\multiProject\XM00029\XM00029_software_Back-end"}
::git-commit{cwd="D:\project\multiProject\XM00029\XM00029_software_Back-end"}

---

Error: invalid syntax at line 1 col 5:

1  cwd="D:\project\multiProject\XM00029\XM00029_software_Back-end"
       ^

---

at S._token (.../app-server-manager-signals-*.js)
at Object.tokenizer (.../app-server-manager-signals-*.js)
at marked.esm-*.js
at Br (.../markdown-*.js)

---

thread/resume ... Failed to create shell snapshot for powershell:
Shell snapshot not supported yet for PowerShell

---

::git-stage{cwd="D:\project\repo"}

---

::git-stage{cwd="D:\project\repo"}

---

::git-stage{cwd=...}
::git-commit{cwd=...}

---

::git-stage{cwd="D:\project\repo"}
::git-commit{cwd="D:\project\repo"}
RAW_BUFFERClick to expand / collapse

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?

  1. Use Codex Desktop on Windows.
  2. Create or edit a session history so an assistant message contains a standalone line like:
::git-stage{cwd="D:\project\repo"}
  1. Close/reopen or resume the session.
  2. 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:

  1. Backing up the original session file.
  2. Parsing each JSONL line as JSON.
  3. Recursively removing standalone lines matching:
::git-stage{cwd=...}
::git-commit{cwd=...}
  1. Rewriting the JSONL.
  2. 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex Desktop session fails to open when git directives contain Windows paths