Skip to content

feat(codex): select named permission profiles in execution controls #2524

Description

@smsunarto

The workflow

While configuring a Codex thread, I want to select the same named permission profile I use in Codex, including :workspace or a custom managed profile.

The profile should remain provider-owned. BB should extend it only with the roots needed for the current environment, such as the workspace, Git metadata, thread storage, and configured host roots.

Existing Codex UI

Codex Desktop lists named permission profiles beside its built-in approval choices. The same workspace-dev profile defined in config.toml appears as a selectable option.

Image

What happens today

BB exposes generic permission modes in the composer. The Codex bridge translates those modes into workspace-write or danger-full-access and adds writable roots through sandbox_workspace_write.writable_roots.

The UI cannot discover or select Codex named profiles. Users must reproduce their policy through BB's generic modes or change Codex configuration outside the thread workflow.

For our use case, workspace-dev extends :workspace, then grants the developer cache and toolchain roots that sandboxed builds need:

default_permissions = "workspace-dev"

[permissions.workspace-dev]
description = "Workspace access plus developer caches and network access."
extends = ":workspace"

[permissions.workspace-dev.workspace_roots]
"~/.local/share/mise" = true
"~/Library/Caches/mise" = true
"~/.bun/install/cache" = true
"~/.cache" = true
"~/.npm" = true
"~/go/pkg/mod" = true
"~/.proto" = true
"~/.codex" = true

[permissions.workspace-dev.network]
enabled = true

Codex does not combine permission profiles with the legacy sandbox configuration that BB currently supplies:

sandbox_mode = "workspace-write"

[sandbox_workspace_write]
writable_roots = ["/path/to/additional/root"]

What you would expect

For providers that advertise named permission profiles:

  • The execution controls list the available profiles.
  • A selected profile becomes the provider-native permission policy instead of a competing sandbox mode.
  • BB overlays its required runtime roots without changing the stored profile.
  • The selection carries through thread creation, follow-ups, queued messages, forks, and project defaults.
  • The CLI and SDK can list and select the same profiles.

Providers without profile support should continue to use the existing permission modes.

AGENT GENERATED

Context and alternatives

No response

Checks

  • I searched open and closed issues for the same request.
  • If an agent wrote this, the body ends with > AGENT GENERATED.

Activity

  1. added
    providers
    on Aug 27, 2026
  2. added
    security
    cli
    provider-codex
    on Aug 27, 2026
  3. Ernxst commented on Sep 29, 2026

    @Ernxst

    Another case for this, from bb 0.43.4 with Codex CLI 0.157.1 on macOS.

    My default_permissions profile adds the tool caches that sandboxed builds write to:

    [permissions.repo-write]
    extends = ":workspace"
    
    [permissions.repo-write.filesystem]
    "~/.cargo" = "write"
    "~/.local/state/mise" = "write"
    "~/.bun/install/cache" = "write"
    "~/.npm" = "write"

    In a bb thread, the per-turn sandbox: "workspace-write" and sandbox_workspace_write.writable_roots replace that profile, so none of those roots are writable and ordinary commands fail:

    $ node -v
    mise ERROR Operation not permitted (os error 1)
    mise ERROR Version: 2026.9.12 macos-arm64 (2026-09-20)
    
    $ bun install --frozen-lockfile
    bun install v1.4.0 (34cbb9a40)
    error: bun is unable to write files to tempdir: EPERM
    

    The only workaround I found is moving the caches into roots bb does grant, through [shell_environment_policy.set], which bb merges rather than replaces:

    [shell_environment_policy.set]
    MISE_CACHE_DIR = "/tmp/mise-cache"
    MISE_STATE_DIR = "/tmp/mise-state"
    BUN_INSTALL_CACHE_DIR = "/tmp/bun-cache"

    With these set, node -v and bun install pass; unset them and both fail as above. Moving MISE_STATE_DIR also moves mise's trust records out of the user's state directory. With the profile honoured as this issue describes, none of this would be needed.

  4. fangerya commented on Dec 2, 2026

    @fangerya

    Another case, with pnpm 12, on bb 0.51.0 and codex-cli 0.173.0, on macOS and Linux.

    The Codex sessions bb starts get the workspace and the thread storage as writable roots. The user's sandbox_workspace_write.writable_roots from ~/.codex/config.toml is not applied, as the sandbox_policy in each session's rollout file shows. Our list there includes the pnpm store.

    pnpm 12 has a deliberate fallback for this. When no folder above the project accepts a hard link, it creates its store at <project>/node_modules/.pnpm-store. In a checkout installed from the shared store, the next install under Codex therefore switches stores. It empties node_modules and downloads every package again. With verifyDepsBeforeRun: install, a read-only pnpm <script> --help was enough to start this, and an interrupted run left node_modules half empty.

    Setting storeDir in pnpm's global config stops the switch, because pnpm can read that file inside the sandbox. A Codex thread still cannot add a package that is not in the store yet. The install fails with Failed to write cafs ... Operation not permitted. With the proposal here, bb would extend the user's Codex policy with its roots, and the store would stay writable.

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

    cliprovider-codexproviderssecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions