Skip to content

Apply access-control changes to the currently running turn #32612

Open

Description

@simon-ami

What variant of Codex are you using?

App

What feature would you like to see?

When the access-control or permissions setting is changed while an agent turn is already running, Codex should apply the new setting to that active turn rather than waiting until the next user turn.

At the moment, the UI allows the user to change the access-control mode during an active run, but the running agent continues using the permission context with which the turn originally started. The new setting only becomes effective when another user message starts the next turn.

Additional information

Current behavior

  1. Start an agent turn with a restricted access mode, such as read-only or workspace access.
  2. While the agent is still running, change the access-control setting to Full Access.
  3. The UI immediately shows the newly selected mode.
  4. The active agent nevertheless continues using the old access restrictions.
  5. The new setting only takes effect after the current turn finishes and the user sends another message.

The reverse direction appears to behave similarly: lowering access during an active turn does not immediately restrict the permissions already assigned to that turn.

Expected behavior

Changing the access-control setting during an active turn should update the effective permissions of that running turn.

For example:

  • Changing from read-only or workspace access to Full Access should allow subsequent tool calls in the same turn to use Full Access.
  • Changing from Full Access to a more restrictive mode should prevent subsequent tool calls in the same turn from using the previously granted permissions.
  • The permission mode displayed in the UI should match the permission mode currently enforced by the runtime.

If applying the change immediately is not technically or safely possible, the UI should make this explicit, for example by displaying:

Applies starting with the next turn

Currently, the control looks like an immediate runtime setting even though it behaves as a next-turn setting.

Why this matters

Long-running Codex turns can last for several minutes or considerably longer. During such a run, the agent may discover that it needs permissions which were not granted when the turn started.

The user can already change the setting in the UI, so it is natural to expect that this unblocks the running agent. Instead, the user must currently:

  1. interrupt or wait for the active turn,
  2. send another message,
  3. ask the agent to resume the same work.

This interrupts the workflow, may lose execution continuity, and is especially inconvenient for long-running agent, Goal, orchestration, or background-command workflows.

It is also a security and trust issue in the opposite direction. If the user lowers permissions while an agent is running, the UI suggests that access has been reduced even though the active turn may retain its original permissions.

Suggested semantics

It may make sense to distinguish between permission reductions and permission increases.

Permission reduction

A reduction in access should ideally take effect immediately for all subsequent tool calls in the active turn.

Examples:

  • Full Access → workspace access
  • workspace access → read-only

Already-running processes may need separate handling, but no new privileged operation should begin after the restriction is applied.

Permission increase

An increase in access could either:

  1. update the active turn’s runtime permission context immediately, or
  2. pause the active turn at the next permission boundary and resume it with the new permission context.

Examples:

  • read-only → workspace access
  • workspace access → Full Access

The model may also need updated permission guidance so that it knows the newly available operations are permitted.

Possible implementation direction

The active turn appears to retain a permission or sandbox snapshot created when the turn starts, while settings changed through the UI are applied as next-turn thread settings.

A possible implementation could:

  • update the active thread settings,
  • propagate the new approval policy, reviewer, sandbox policy, and permission profile to the active turn,
  • refresh the model-visible permission guidance where necessary,
  • ensure that subsequent tool executions use the updated permission snapshot,
  • emit a runtime event confirming that the active turn has adopted the new mode.

If active-turn mutation would introduce consistency problems, Codex could instead perform an internal pause-and-resume operation without requiring a new user message.

Acceptance criteria

  • Changing access control during an active turn affects subsequent tool calls in that same turn.
  • The effective runtime mode always matches what the UI displays.
  • Reducing permissions prevents new operations that would violate the new setting.
  • Increasing permissions allows the agent to continue without requiring a new user turn.
  • Resumed, delegated, Goal, and compacted turns preserve the updated permission context.
  • If active-turn updates are unsupported, the UI clearly states that changes apply only to the next turn.

Additional context

This is different from existing reports about stale or incorrect permission propagation across resumed turns or Goal continuations. In this case, the next turn receives the newly selected permissions correctly. The requested feature is specifically for applying a permissions change to a turn that is already running.

Activity

  1. added
    appIssues related to the Codex desktop app
    sandboxIssues related to permissions or sandboxing
    on Jul 12, 2026
  2. github-actions commented on Jul 12, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. simon-ami commented on Jul 12, 2026

    @simon-ami
    Author

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

    * [Goal and reasoning selectors can show off/high while resumed task remains Ultra and proactive #32596](https://github.com/openai/codex/issues/32596)
    

    Powered by Codex Action

    Reviewed this, but it's not a duplicate

  4. BGMLAI commented on Jul 14, 2026

    @BGMLAI

    Applying a weaker or stronger policy mid-turn needs explicit semantics. The safe rule is monotonic restriction: tighter access takes effect immediately and cancels pending operations that no longer qualify; broader access applies only to future tool calls after the runtime acknowledges a new permission_context_id. Already-issued approval prompts should be invalidated when the context changes. The UI should show the active generation separately from the next-turn selection so users can see whether a running action is still governed by the old profile.

  5. HuangYincan commented on Oct 15, 2026

    @HuangYincan

    Observed the same behavior with Codex TUI reporting version 0.162.1 on macOS, using /permissions on 2026-10-15. This also affects switching the approval reviewer to Approve for me, not just changing sandbox access.

    Observed sequence

    The following is a sanitized summary of local session and runtime logs (all times UTC):

    16:53:05  Turn A starts:
              approval_policy = on-request
              approvals_reviewer = user
              sandbox_policy = workspace-write
    
    16:54:49  The same thread receives a thread_settings operation:
              approval_policy = OnRequest
              approvals_reviewer = AutoReview
    
    16:58:20  A subsequent manual ExecApproval is recorded for Turn A.
              The user still had to approve command execution after changing the setting.
    
    17:22:25  The thread receives another thread_settings operation:
              approval_policy = Never
              permission_profile = disabled (Full Access)
    
    17:22:38  Turn B starts with:
              approval_policy = never
              sandbox_policy = danger-full-access
    

    Messages sent while Turn A was running remained within that execution; they did not produce a new turn_context with the updated permissions. The later fresh turn did record the updated Full Access settings.

    This supports the interpretation that the setting change was received, but the active turn continued using its earlier approval context. It is evidence from one observed session, not a controlled reproduction or confirmation of the underlying implementation. We did not test reducing permissions mid-turn.

    User impact / expected behavior

    The permissions control lets the user select “Approve for me” or “Full Access,” yet the running task can continue asking for manual command approval. This makes a successful settings change look broken.

    Ideally, subsequent tool calls should adopt the updated settings at a defined safe boundary. If changes only apply to a new turn, the UI should explicitly show “Applies to the next turn; the current turn still uses [previous mode]”, and offer a stop-and-resume action. Pending approval requests should also clearly identify which permission context they use.

  6. rqas-git commented on Oct 17, 2026

    @rqas-git

    Confirmed the CLI reviewer-switch case on Codex 0.163.0, macOS arm64 (Darwin 25.4.0). The backend already supports a live reviewer update; the CLI does not send it.

    A sanitized runtime sequence from October 17 (UTC):

    • 20:56:29: backend receives thread_settings with reviewer AutoReview.
    • 20:56:40 and 20:56:51: newly issued commands still prompt for manual approval in the original turn.
    • 20:56:58: a fresh turn starts with auto_review; Guardian subsequently approves the escalation.

    The source trace narrows the cause:

    • sync_override_turn_context_settings sends only thread/settings/update. The profile-selection path in config_persistence.rs also calls only that endpoint.
    • Standalone thread settings intentionally affect future turns. The existing turn/settings/update API supports changing the active turn's reviewer for subsequent settings captures, while preserving already captured steps and pending approvals.

    A proposed CLI fix is available in commit bda6d98: persist defaults, then publish the reviewer to the originally captured active turn. Both CLI selection paths are covered; a finished target is harmless, and live-update errors explain that the setting was saved for future turns.

    Validation: 9 relevant CLI tests and 2 backend integration tests passed with RUST_MIN_STACK=8388608, including reviewer changes in both directions, idle chats, omitted reviewer fields, and a stale active-turn ID. Formatting and whitespace checks passed.

    This addresses the reviewer-switch portion of this issue. It does not implement live changes to sandbox boundaries or the approval policy.

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

    appIssues related to the Codex desktop appenhancementNew feature or requestsandboxIssues related to permissions or sandboxing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions