Skip to content

Codex desktop: permission state (activePermissionProfile/approvalPolicy/writableRoots) silently degrades to :workspace + sandbox_approval: false over successive read-only turns in the same task #40698

Open

Description

@gibney0164

Summary
Within a single Codex desktop task, the effective permission state (activePermissionProfile, approvalPolicy, approvalsReviewer, writableRoots) silently degrades over successive turns — even when no files, settings, or the model are changed, and even though the on-disk config.toml defaults never change. Over three consecutive read-only status requests in one task, the state went from the correct configured profile down to bare :workspace with sandbox_approval: false and almost all writable roots removed.
This was independently confirmed by reading .codex-global-state.json directly, not just from the app's own self-reported status — the per-thread heartbeat entry in the state file matches the degraded values exactly.
Environment
Platform: Windows, Codex desktop app (please fill in exact build number from Settings → About — omitted here since it wasn't captured during the investigation)
Account: authenticated via ChatGPT; no organization-managed requirements.toml or managed_config.toml present at any documented system/user location
config.toml throughout this entire test: approval_policy = "on-request", approvals_reviewer = "user", default_permissions = "husum-property-files" — unchanged at every turn
Steps to reproduce
Start a new Codex task with a profile that has an explicit default_permissions set in config.toml (in this case, a custom profile husum-property-files).
Ask for a read-only status report of activePermissionProfile, approvalPolicy, approvalsReviewer, sandbox approval status, and writable roots.
Without making any file changes, permission changes, or model changes, ask for the identical read-only status report again.
Repeat once more.
Observed behavior (this run)
Turn 1 Turn 2 Turn 3
activePermissionProfile husum-property-files (extends :workspace) null / missing :workspace
approvalPolicy "on-request" "on-request" {"granular": {"sandbox_approval": false, "rules": false, "skill_approval": false, "request_permissions": true, "mcp_elicitations": true}}
approvalsReviewer "user" "user" "user"
writableRoots 7 entries, including the task folder, F:\Pictures\My Pictures, two OneDrive project folders, and .codex\memories same 7, plus an unrequested broader root (C:\Users\Dave Gibney\Documents\Codex, the parent of the task folder) only the task's own temp visualization directory — all 6 other roots gone, including F:\Pictures\My Pictures
Turn 3's values were independently verified against .codex-global-state.json → electron-persisted-atom-state.heartbeat-thread-permissions-by-id["<thread-id>"] directly on disk, and match the app's self-report exactly:

{
  "activePermissionProfile": { "id": ":workspace", "extends": null },
  "approvalPolicy": {
    "granular": {
      "sandbox_approval": false,
      "rules": false,
      "skill_approval": false,
      "request_permissions": true,
      "mcp_elicitations": true
    }
  },
  "approvalsReviewer": "user",
  "sandboxPolicy": {
    "type": "workspaceWrite",
    "writableRoots": ["C:\\Users\\<user>\\.codex\\visualizations\\2026\\08\\25\\<thread-id>"],
    "networkAccess": false,
    "excludeTmpdirEnvVar": false,
    "excludeSlashTmp": false
  }
}

Expected behavior
A task's effective permission profile, approval policy, reviewer, and writable-root allowlist should not change between turns unless the user, the config, or the model changes. Three plain read-only status requests in the same task should return identical values each time.
Additional related finding (separate but adjacent bug)
Before the above was reproduced, a different desync was found and had to be manually patched: two host-scoped keys in the same state file — electron-persisted-atom-state.agent-mode-by-host-id.local and electron-persisted-atom-state.preferred-non-full-access-agent-mode-by-host-id.local — remained stuck at "guardian-approvals" (left over from earlier "Approve for me" usage) even after permission-selection-by-host-id:local was cleared and config.toml correctly specified approvals_reviewer = "user". As long as those two keys held "guardian-approvals", new tasks' approvalsReviewer came back as auto_review regardless of config.toml. This suggests the app keeps more than one on-disk representation of "current permission mode" per host, and they can desync from each other and from config.toml. Setting agent-mode-by-host-id.local to "auto" and preferred-non-full-access-agent-mode-by-host-id.local to null (matching a known-good backup from earlier the same day) resolved that specific symptom — approvalsReviewer correctly held at "user" through all three turns of the test above, even while the separate per-turn degradation (this report's main subject) still occurred.
Impact
Permission-dependent file operations (in this case, work on personal photo files) cannot be safely performed partway through a task, since the writable-root allowlist and sandbox approval behavior cannot be trusted to hold steady even across read-only turns. The only currently-known-reliable point is the first turn of a brand-new task.

Activity

  1. added
    bug
    app
    windows-os
    sandbox
    session
    on Aug 25, 2026
  2. github-actions commented on Aug 25, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. gibney0164 commented on Aug 25, 2026

    @gibney0164
    Author

    Related: this looks like the same underlying issue as #33702 (macOS) and #23958 (Linux) — permission/reviewer/sandbox state desyncing or drifting mid-session without an explicit user action. Neither has a response either. Cross-platform (Windows/macOS/Linux) and going back to at least May suggests this is a core app-server bug, not something OS-specific

  4. shevvek-chatgpt commented on Nov 2, 2026

    @shevvek-chatgpt

    Additional Windows Desktop evidence from November 1–2, 2026: the current project can disappear from effective write permissions between turns while the named profile and model remain unchanged. This appears to match the disappearing-root aspect of this issue; I have not established a common root cause.

    Environment:

    • Rollout metadata: originator Codex Desktop, bundled runtime 0.166.0-alpha.5.1.
    • Native Windows, reported OS build 26100; PowerShell.
    • Model gpt-6.1-sol.
    • Managed named permission profile; approval_policy=on-request, approvals_reviewer=auto_review.
    • Current configuration selects [windows] sandbox = "mxc". The exact Desktop application version and actual enforcement backend for each historical command were not independently verified.

    Configuration versus runtime state:

    • The inspected user config.toml selects the named profile through
      default_permissions. It contains neither sandbox_mode nor
      approvals_reviewer; workspace-write above is the recorded runtime
      sandbox_policy.type, not an observed global sandbox_mode setting.
    • The app's persisted local permission selection has kind = "agent-mode"
      and agentMode = "guardian-approvals". Its local agent-mode preference
      agrees. This is consistent with the runtime automatic reviewer, but I have
      not traced how the UI selection and named profile are combined.
    • The named profile applies "." = "write" and ".git" = "write" under
      filesystem.":workspace_roots". Thus those project grants depend on the
      effective workspace-root set. Other workspace directories have direct
      path grants, which remain after the runtime-root list shrinks.

    I inspected two local chats' persisted thread_settings_applied events and turn_context records:

    Chat (anonymized) Last recorded project write grant, UTC First turn context without it, UTC
    A: existing development chat 2026-11-02 01:24:28.249 2026-11-02 01:32:17.552
    B: newly created diagnostic chat 2026-11-02 05:13:00.886 2026-11-02 05:16:42.687

    In both chats:

    • cwd remains <PROJECT>.
    • runtime_workspace_roots shrinks from the project, two additional workspace directories, and the chat's visualization directory to only the visualization directory.
    • The managed permission_profile.file_system.entries loses the explicit write grants for <PROJECT> and <PROJECT>\\.git.
    • The same named active_permission_profile.id, model, approval policy, and reviewer remain recorded.
    • The sandbox label remains workspace-write; the whole sandbox does not change to read-only. Other configured write paths still exist.

    The corresponding settings events already contain the reduced roots at 01:32:15.324 and 05:16:39.058 UTC, respectively. The current heartbeat-thread-permissions-by-id entries in .codex-global-state.json independently corroborate the missing project Git write root for both chats.

    Chat B is particularly small: its first turn only searched documentation and public issues; the next turn requested log inspection and a sanitized report. There was no model switch, configuration mutation by the assistant, or request to reduce permissions in that interval. The current config file's modification timestamp predates both of B's turns. This is an observed sequence, not a deterministic minimal reproduction or proof of the initiating cause.

    In chat A, a later project-local Copy-Item at 02:26:31 UTC returned access denied for two documentation destinations. Reads and writes to separately authorized workspace directories continued. This blocked saving completed project work.

    No raw rollouts, task contents, usernames, actual project paths, profile names, or chat identifiers are included here. Diagnosis was read-only with respect to configuration and security settings. Please investigate why applying per-chat settings can discard runtime workspace roots and their derived project grants while retaining the same named permission profile.

  5. fallenleavesgocrunch commented on Nov 3, 2026

    @fallenleavesgocrunch

    Additional macOS evidence: a fresh Plan-mode chat loses its project root and write grant on the first follow-up, while the named permission profile remains unchanged.

    Environment: macOS; bundled Codex runtime 0.166.0-alpha.5.1; Local chat in a saved project; Plan mode; managed permission profile workspace-development extending :workspace. Desktop app version was not independently checked.

    Reproduction:

    1. Start a Local chat in a saved project with the checkout explicitly included.
    2. Submit a planning request and allow read-only repository inspection.
    3. Answer the agent's clarification question without changing project folders, permissions, or mode.
    4. Inspect the next turn's workspace roots and filesystem sandbox policy.

    Expected: The checkout remains included and retains its existing write grant across turns.

    Actual: The checkout disappears from workspace_roots and its explicit filesystem write entry disappears. cwd still points to that checkout. Plan mode and the active permission profile remain unchanged. The visualization root and Docker grant remain. A folder-boundary instruction then blocks further inspection. In another affected chat, test-report directory creation failed with PermissionError: [Errno 1] Operation not permitted.

    Filtered log evidence (UTC, 2026-11-03; paths and chat IDs anonymized):

    • Chat A, 04:59:50.727Z, rollout turn_context line 10: cwd=PROJECT_ROOT, mode=plan, profile={id:workspace-development, extends::workspace}; preceding world_state includes PROJECT_ROOT in workspace_roots, and filesystem entries include {path:PROJECT_ROOT, access:write}.
    • Chat A, 05:02:11.287Z, turn_context line 84: cwd, mode, and profile unchanged; preceding world_state omits PROJECT_ROOT from workspace_roots; its explicit write entry is absent.
    • The corresponding turn_input log records requested_settings: ThreadSettingsOverrides { approval_policy: None, approvals_reviewer: None, sandbox_policy: None, permission_profile: None }.
    • Chat B independently loses the same grant between 02:33:46.632Z and 02:39:30.306Z (turn_context lines 10 and 94).

    Only read-only inspection preceded the fresh reproduction: no tests, edits, mode switch, or worktree creation. Manually re-adding the project folder restored access in the earlier chat. The logs locate the transition but do not establish the underlying cause. Please investigate workspace-root propagation across turn submissions.

  6. iamswain25 commented on Nov 3, 2026

    @iamswain25

    Also seeing this on macOS: the current worktree loses write permission on a later turn while cwd remains unchanged. Codex then requests escalation or proposes a temporary worktree.

    Update (2026-11-11): The latest macOS release, 26.1106.51428 (build 26605), does not appear to address this issue. The affected follow-up workspace-root handling is still present in that build. I'm currently using a customized Codex app with this bug patched locally.

  7. codestation commented on Nov 4, 2026

    @codestation

    Same on Linux with the ChatGPT app 26.1029.61003

  8. dougludlow commented on Nov 23, 2026

    @dougludlow

    I reproduced the worktree write-root loss on macOS in Default collaboration mode. Desktop 26.1117.41037 (build 29803), bundled runtime 0.171.0-alpha.13, macOS 27.3 on Apple Silicon. The chat used a local managed Git worktree and a named permission profile extending :workspace.

    Redacted excerpts from Desktop's Reasoning summary turn-start config resolved log, with selected fields:

    Initial turn
    useAppServerPermissionDefault=false requestRuntimeWorkspaceRootCount=0
    requestPermissionProfile=<named-profile> requestSandboxPolicyType=null
    
    First follow-up
    useAppServerPermissionDefault=true requestRuntimeWorkspaceRootCount=1
    requestPermissionProfile=null requestSandboxPolicyType=null
    

    The request counts describe overrides sent by Desktop. The app server's persisted thread_settings_applied records show the effective runtime roots going from the worktree plus four related checkout roots to only <chat-visualization-dir>. The cwd, active named profile, workspace-write sandbox mode, and Default collaboration mode stayed the same. The worktree lost its write grant, fixed Git metadata and cache grants persisted, and four later turns retained the one-root configuration.

    Isolated reproduction. I ran the root-selection expression from the installed Desktop bundle in memory with synthetic paths and stubbed helpers. The fixture represents a local project-backed follow-up using the app server's permission defaults. In each case, the repository cwd and project roots are known.

    Runtime roots in the client's current permission state Optional visualization root Runtime root override emitted
    Absent Present [<chat-visualization-dir>]
    [<managed-worktree>, <related-checkout>] Present [<managed-worktree>, <related-checkout>, <chat-visualization-dir>]
    Absent Absent No override

    The first case matches the request shape and effective root in the live records. The in-memory test isolates how the client can send the replacement root. Why the live client failed to carry forward its roots and whether the same code path explains the earlier reports are still unverified. I did not replay the full Desktop interaction. A no-selection Page snapshot appeared near the transition, but the directory already existed on the first turn and this code path can add it independently of Page selection.

    Cross-reference for the macOS report: #63435.

  9. TonyGravagno commented on Nov 24, 2026

    @TonyGravagno

    Additional reproduction: Windows Codex Desktop -> WSL2 remote app-server, Codex 0.171.0

    I'm experiencing what appears to be the same loss of effective workspace write permissions, but with the Windows Codex desktop app connected to a WSL2 Ubuntu instance via the Codex app-server.

    Environment

    • Windows 11 Codex desktop app connected to WSL2 Ubuntu 24.04 via the remote Codex app-server.
    • Codex CLI 0.171.0, updated November 20, 2026.
    • Custom common-project permission profile, with the project workspace configured for write access using :workspace_roots.
    • Project files are owned by the executing Linux user.

    Observed behavior

    A fresh desktop session initially had write access to the project workspace. During subsequent tool executions, the shell's working directory unexpectedly changed from the project directory to a Codex-managed visualization directory under ~/.codex/visualizations/.

    The assistant subsequently reported that the visualization directory was its current workspace and that the original project directory was read-only.

    An actual filesystem write operation confirmed the failure:

    touch: cannot touch '<project-directory>/.codex-write-test': Read-only file system
    

    No child-agent spawn was observed in this reproduction.

    Mount observations

    Three successive shell executions ran in separate Linux mount namespaces:

    1. Initial execution: The project workspace had an effective writable mount. The write probe succeeded.
    2. Second execution: The working directory had changed to the visualization directory, which had a writable mount. The write probe succeeded, but targeted the current working directory rather than the original project workspace. Consequently, the project's write status at this point is unknown.
    3. Third execution: The project workspace no longer had an effective writable mount. It was covered by a read-only ancestor mount, and an absolute-path write probe failed with EROFS.

    Separate mount namespaces are expected with per-command sandbox construction. The significant observation is that the project's writable mount disappeared between executions.

    This suggests inconsistent propagation or reconstruction of effective workspace permissions rather than a change to the underlying filesystem's ownership or permissions.

    Follow-up investigation

    A Codex 0.171.0 diagnostic session completed several additional tests:

    • Initial absolute-path write probe: passed.
    • Write probe after rg and sed source inspection: passed.
    • Write probe after an explicit temporary-directory working-directory change: passed.
    • Direct codex sandbox --permission-profile common-project testing: inconclusive. Configuration resolution initially failed with default_permissions requires a [permissions] table. An inline-profile retry reached Bubblewrap but could not complete because the enclosing sandbox had masked /tmp/codex-daemon-1000.

    The investigation did not reproduce the original failure again or identify its exact trigger.

    Potential cause

    The Codex 0.171.0 app-server code appears to allow runtime workspace roots to be replaced during turn processing. If the replacement list contains only the visualization directory, a named permission profile using :workspace_roots could retain its profile identity while losing the project write grant.

    Relevant source:

    https://github.com/openai/codex/blob/rust-v0.171.0/codex-rs/app-server/src/request_processors/turn_processor.rs#L843-L862

    Version 0.171.0 also includes PR #61195, preserving permission profiles across CWD updates. The observed failure occurred with 0.171.0 installed.

    This is a hypothesis, not a confirmed root cause.

    Expected behavior

    The project's authorized writable workspace root should remain available throughout a session, regardless of read-only tool executions, CWD transitions, or the addition of a visualization directory.

    Remaining investigation

    An independent standalone CLI versus desktop/app-server comparison has not yet been completed. I don't think this is necessary given the evidence direct from the CLI and local app-server, but this is where I first noticed the anomaly. This report may help establish that the permission-loss behavior reported in this ticket also affects remote WSL Linux sandbox execution, with observable changes to the effective mount layout.

    HTH

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugsandboxsessionwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions