codex - 💡(How to fix) Fix Scheduled automations on Windows cannot rewrite `.codex/browser/sessions` policy files, breaking Chrome/X skills that pass manually

Official PRs (…)
ON THIS PAGE

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…

On Windows, the same Codex workflow succeeds when run manually in a desktop thread, but fails when fired by a scheduled automation because the automation sandbox cannot rewrite Codex-managed browser session policy files under C:\Users\carlos\.codex\browser\sessions.

This breaks automations that rely on a required preflight step to clear stale denied origins before attaching to the real Chrome extension session.

Error Message

UnauthorizedAccessException Set-Content : Access to the path 'C:\Users\carlos.codex\browser\sessions\019e5b05-3464-7883-b351-97928d45239c.toml' is denied.

Root Cause

On Windows, the same Codex workflow succeeds when run manually in a desktop thread, but fails when fired by a scheduled automation because the automation sandbox cannot rewrite Codex-managed browser session policy files under C:\Users\carlos\.codex\browser\sessions.

Code Example

C:\Users\carlos\.codex\browser\sessions\019e5b05-3464-7883-b351-97928d45239c.toml

---

UnauthorizedAccessException
Set-Content : Access to the path 'C:\Users\carlos\.codex\browser\sessions\019e5b05-3464-7883-b351-97928d45239c.toml' is denied.
RAW_BUFFERClick to expand / collapse

Summary

On Windows, the same Codex workflow succeeds when run manually in a desktop thread, but fails when fired by a scheduled automation because the automation sandbox cannot rewrite Codex-managed browser session policy files under C:\Users\carlos\.codex\browser\sessions.

This breaks automations that rely on a required preflight step to clear stale denied origins before attaching to the real Chrome extension session.

Environment

  • Codex Desktop: 0.133.0-alpha.1
  • Platform: Windows
  • Browser path used by workflow: real Chrome extension runtime
  • Execution mode: scheduled cron automations
  • Skill affected: local x-reply-engager workflow using Chrome/X and www.dostraders.com

What works

The exact same workflow works when run manually in a normal desktop thread, including:

  • attaching to the real Chrome extension profile
  • opening https://x.com/home
  • verifying identity as Carlos Mantilla / @mantillapb
  • opening https://www.dostraders.com/
  • publishing a real reply on X

So this does not look like a Chrome authentication problem or a site-specific problem.

What fails under scheduled automation

I reproduced this with two scheduler-fired smoke tests.

Smoke test 1

Observed in local files:

  • C:\Users\carlos\.codex\automations\x-reply-engager-smoketest\memory.md
  • C:\Users\carlos\.codex\sessions\2026\05\24\rollout-2026-05-24T20-25-33-019e5b05-3464-7883-b351-97928d45239c.jsonl

Behavior:

  • automation was started by the scheduler
  • preflight initially reported remaining_denied empty
  • later the run hit a denied browser-session policy file tied to the automation session id
  • retry preflight failed with UnauthorizedAccessException while trying to write:
C:\Users\carlos\.codex\browser\sessions\019e5b05-3464-7883-b351-97928d45239c.toml

Smoke test 2

Observed in local files:

  • C:\Users\carlos\.codex\automations\x-reply-engager-smoketest-2\memory.md
  • C:\Users\carlos\.codex\sessions\2026\05\24\rollout-2026-05-24T20-35-32-019e5b0e-5a7b-7c41-b332-823d3165b474.jsonl

Behavior:

  • automation was started by the scheduler
  • run stopped before any Chrome/X work
  • required preflight script failed immediately with:
UnauthorizedAccessException
Set-Content : Access to the path 'C:\Users\carlos\.codex\browser\sessions\019e5b05-3464-7883-b351-97928d45239c.toml' is denied.

Key finding

The scheduled automation session reports writable roots that do not include:

  • C:\Users\carlos\.codex\browser\sessions
  • C:\Users\carlos\.codex\skills\x-reply-engager

Even after explicitly adding those paths in the automation cwds, the effective automation sandbox still starts with writable roots limited to the automation folder, workspace, .git, and C:\tmp.

That means the required preflight cannot repair or normalize browser policy files in the place Codex itself stores them.

Why this looks like a Codex automation bug

  • Manual on-demand execution succeeds.
  • Scheduler-fired execution reproduces the failure.
  • Failure occurs inside the automation sandbox / permissions model.
  • The preflight script is required specifically to clear stale denied origins for the Chrome/X skill, but automation is denied write access to the folder it must modify.

Expected behavior

One of these should work:

  1. Scheduled automations should be allowed to rewrite Codex-managed browser session policy files when the workflow explicitly requires that preflight.
  2. cwds should actually expand the effective writable roots to include those Codex-managed paths.
  3. Codex should expose a first-class automation-safe policy repair API/mechanism so skills do not have to write .codex/browser/sessions/*.toml directly.

Impact

  • Scheduled x-reply-engager runs are not reliable.
  • The same task can succeed manually but fail in background automation.
  • Automations may repeatedly fail and send blocker emails even though the browser/session is usable on demand.

Relevant local files

  • C:\Users\carlos\.codex\skills\x-reply-engager\scripts\x_browser_policy_preflight.ps1
  • C:\Users\carlos\.codex\automations\x-reply-engager-smoketest\memory.md
  • C:\Users\carlos\.codex\automations\x-reply-engager-smoketest-2\memory.md
  • C:\Users\carlos\.codex\sessions\2026\05\24\rollout-2026-05-24T20-25-33-019e5b05-3464-7883-b351-97928d45239c.jsonl
  • C:\Users\carlos\.codex\sessions\2026\05\24\rollout-2026-05-24T20-35-32-019e5b0e-5a7b-7c41-b332-823d3165b474.jsonl

If useful, I can also attach the exact automation prompts and the effective writable-root snippet from the rollout logs.

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…

FAQ

Expected behavior

One of these should work:

  1. Scheduled automations should be allowed to rewrite Codex-managed browser session policy files when the workflow explicitly requires that preflight.
  2. cwds should actually expand the effective writable roots to include those Codex-managed paths.
  3. Codex should expose a first-class automation-safe policy repair API/mechanism so skills do not have to write .codex/browser/sessions/*.toml directly.

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 Scheduled automations on Windows cannot rewrite `.codex/browser/sessions` policy files, breaking Chrome/X skills that pass manually