Skip to content

Asks for permission to run command xcodebuild, even after permitting all xcodebuild commands #10321

Closed

Description

@bholmesdev

What version of Codex is running?

0.93

What subscription do you have?

Pro

Which model were you using?

Codex 5.2 (medium reasoning)

What platform is your computer?

MacOS

What terminal emulator and version are you using (if applicable)?

Warp

What issue are you seeing?

I granted permission to run all xcodebuild commands by selecting the "Yes, and don't ask again" option from the CLI. Then in future runs, even when running the same command with the same set of arguments, it still asks for sandboxing permissions. This persists even after quitting and restarting the codex CLI.

I am not running with dangerous permissions. I'm only running codex for my conversations.

Image

What steps can reproduce the bug?

  1. Prompt the agent to run the command xcodebuild -scheme Hubble -destination 'generic/platform=iOS' │ -quiet CODE_SIGNING_ALLOWED=NO build 2>&1.
  2. Notice the agent tries to run this command and receives a sandbox error (seems odd it doesn't ask me and intentionally needs to fail first)?
  3. Select option 2, "Yes, and don't ask again"
  4. On a future turn, prompt to run the same xcodebuild ... command again. The sandbox permissions error reoccurs unexpectedly.

What is the expected behavior?

I should not have to grant permissions again for the current session and all future CLI sessions.

Additional information

This is my Codex config:

[projects."/Users/benholmes/Projects/Hubble"]
trust_level = "trusted"

[projects."/Users/benholmes/Projects/simplestack-store"]
trust_level = "trusted"

[projects."/Users/benholmes/Projects/simple-stack"]
trust_level = "trusted"

[features]
unified_exec = true

Activity

  1. added
    bug
    on Feb 1, 2026
  2. added
    CLI
    sandbox
    tool-calls
    on Feb 1, 2026
  3. etraut-openai commented on Feb 1, 2026

    @etraut-openai
    Contributor

    Are subsequent commands exactly the same as the first one that you approved, or do they differ in their arguments?

  4. removed
    CLI
    tool-calls
    on Feb 1, 2026
  5. dylan-hurd-oai commented on Feb 1, 2026

    @dylan-hurd-oai
    Contributor

    @bholmesdev could you use /feedback and share the session id?

  6. bholmesdev commented on Feb 1, 2026

    @bholmesdev
    Author

    @etraut-openai I just confirmed that it is running with the exact same set of arguments. Andn @dylan-hurd-oai here is the feedback ID: 019c171d-d6a4-7690-a080-3994dbb86bda

  7. bholmesdev commented on Feb 1, 2026

    @bholmesdev
    Author

    To clarify, the command being run is xcodebuild -scheme Hubble -destination 'generic/platform=iOS' -quiet CODE_SIGNING_ALLOWED=NO build 2>&1. This is listed in my project rules file:

    Rules

    • Always run pnpm convex typecheck to check your work when updating convex files.
    • To check if the app builds, run an applicable variant of: xcodebuild -scheme Hubble -destination 'generic/platform=iOS' -quiet CODE_SIGNING_ALLOWED=NO build 2>&1
    • Don't commit code for me. I'll ask you to.

    Overview

    Hubble is an iOS/macOS app with a Convex backend. Built with XCode, with packages tracked in XCode.

    For permission updates, instruct user on what to update in Xcode (ex. add microphone permissions in Target > Info).

    Data Model

    • Note: Voice/text note with transcript
    • Lens: User-defined filter/tag for organizing notes
    • NoteLens: Join table linking notes to lenses (many-to-many)

    Conventions

    • Views in Views/, reusable components in Views/Components/, modifiers in Views/Modifiers/
    • Services handle external APIs, device managers, and AI features
    • Convex functions: queries for reads, mutations for writes, actions for AI/external calls
    • HTTP endpoints in convex/http.ts for streaming responses

    Folder Structure

    Hubble/
    ├── Hubble/
    │   ├── Models/             # Note, Lens, LocalModels, AgentResponse, SyncStatus
    │   ├── Views/
    │   │   ├── Components/     # Reusable (NoteRow, LensDropdown, QABubble, etc.)
    │   │   └── Modifiers/      # View modifiers (InnerShadow)
    │   ├── Services/           # ConvexService, SyncEngine, transcription, AI services
    │   ├── Helpers/            # MarkdownHelpers
    │   ├── ContentView.swift
    │   └── HubbleApp.swift
    ├── convex/
    │   ├── schema.ts           # DB schema (notes, lenses, noteLenses tables)
    │   ├── notes.ts            # Note queries/mutations
    │   ├── lenses.ts           # Lens queries/mutations
    │   ├── noteLenses.ts       # Note-lens relationship mutations
    │   ├── agent.ts            # AI agent with RAG (askHubble, continueHubble)
    │   ├── http.ts             # HTTP streaming endpoints
    │   ├── lib/auth.ts         # Auth helpers
    │   ├── migrations/         # Data migrations
    │   └── _generated/
    ├── Hubble.xcodeproj/
    ├── HubbleTests/
    ├── HubbleUITests/
    └── package.json
    

    Commands

    pnpm convex dev      # Start Convex dev server
    pnpm convex deploy   # Deploy Convex
    pnpm convex typecheck # Check types

    Local-First Sync Engine

    The app uses a local-first architecture with SwiftData for offline support. Data loads instantly from local storage; Convex syncs in the background.

    Key Files

    • Models/LocalModels.swift — SwiftData models (LocalNote, LocalLens) with sync metadata (serverId, syncStatus, lastModifiedLocally)
    • Models/SyncStatus.swift — Enum: .synced, .pendingCreate, .pendingUpdate, .pendingDelete
    • Services/NoteRepository.swift — Local CRUD, findByStableId(), upsertFromServer()
    • Services/LensRepository.swift — Same pattern for lenses
    • Services/SyncEngine.swift — Coordinates push/pull with Convex
    • Services/NetworkMonitor.swift — Detects connectivity changes, triggers sync on reconnect

    Sync Behavior

    On app launch:

    1. Load from SwiftData immediately (no auth required)
    2. Authenticate with Convex
    3. syncAll() → push pending changes, then start subscriptions

    On edit:

    1. Save to SwiftData with syncStatus = .pendingUpdate
    2. Push to Convex in background
    3. Subscriptions paused during push to prevent race conditions

    On reconnect (airplane mode off):

    1. NetworkMonitor detects connection restored
    2. Triggers syncAll() automatically

    Conflict Resolution

    Device always wins. Push happens before pull, so offline edits overwrite server. The lastModifiedLocally timestamp is compared against serverNote.updatedAt only for incoming pull data — if local has pending changes with a newer timestamp, server data is ignored.

    Schema Migrations

    SwiftData uses HubbleMigrationPlan for versioned schemas. On schema mismatch (dev only), the local store auto-deletes and re-syncs from Convex.

    Voice Input & AI

    The user can interact with the Hubble Agent through voice or text. This agent is managed in Convex.

    Transcription

    • Services/SpeechTranscriberManager.swift — Apple Speech transcription
    • Services/ParakeetTranscriberManager.swift — Enhanced local transcription
    • Services/TranscriptionSettings.swift — User transcription preferences
    • Views/VoiceNoteView.swift — Main recording flow
    • Views/Components/TranscriptSheet.swift, TranscriptCard.swift — Transcript display

    Live Q&A

    • Services/LiveQAService.swift — Detects questions during transcription to interact with the Hubble agent
    • Views/Components/QABubble.swift — Displays Q&A segments in transcript
    • Services/TranscriptRefiner.swift — AI-powered transcript cleanup (streaming)
  8. ykshev commented on Feb 11, 2026

    @ykshev

    any updates here? anybody knows how to fix it? this is insane that you have to approve it every 5 minutes. I've tried to add as set of rules, but it didn't work:

    prefix_rule(
        pattern = ["xcodebuild"],
        decision = "allow",
        justification = "Allow local build and test invocations without approval prompts.",
        match = [
            "xcodebuild -project table-ai.xcodeproj -scheme table-ai build",
            "xcodebuild test -project table-ai.xcodeproj -scheme table-ai -destination platform=macOS",
        ],
        not_match = [
            "xcrun xcresulttool get --path .build/DerivedData/Logs/Test/result.xcresult --format json",
        ],
    )
    

    what am i doing wrong?

  9. dasebasto commented on Feb 12, 2026

    @dasebasto

    I have the same issues with commands like this one:
    xcodebuild -workspace ./ProjectName.xcworkspace -scheme ProjectName -configuration Debug -destination 'id=F94783BB-3585-4762-B652-656912287576' build > /tmp/cw_settings_build.log 2>&1;

    When I instructed Codex to run "pure" xcodebuild commands instead, it seems to have fixed the issue.
    The following command was run unsandboxed without approval, as expected:

    xcodebuild -workspace ./ProjectName.xcworkspace -scheme ProjectName -configuration Debug -destination 'id=F94783BB-3585-4762-B652-656912287576' build

    So the bug might have something to do with the output redirects.
    While troubleshooting, I had also added this to my default.rules, but it did not work:

    prefix_rule(pattern=["xcodebuild"], decision="allow")

  10. polyrand commented on Feb 12, 2026

    @polyrand
    Contributor

    I have this issue in general with most commands. I have a rules file for all the commands I want to auto-approve. If I use --ask-for--aproval=untrusted, it still prompts me to accept the commands, even if my ~/.codex/rules/<cmd>.rules file allows it.

    Overall, this issue + my experience makes me think the rules and command approvals are not working as expected.

  11. polyrand commented on Feb 12, 2026

    @polyrand
    Contributor

    To reproduce:

    repro.sh:

    #!/usr/bin/env bash
    set -euo pipefail
    
    # Repro: .rules files don't auto-approve matching commands
    # Expected: "sample-command-foo" should be auto-approved by the rules file
    # Actual:   codex still prompts for approval
    
    RULES_DIR="$HOME/.codex/rules"
    BIN_DIR="$HOME/.local/bin"
    
    ###############################################################################
    # 1. Create a rules file that allows "sample-command-foo"
    ###############################################################################
    mkdir -p "$RULES_DIR"
    
    cat > "$RULES_DIR/sample-command-foo.rules" <<'EOF'
    # Sample command for repro
    prefix_rule(
        pattern = ["sample-command-foo"],
        decision = "allow",
        match = ["sample-command-foo", "sample-command-foo --help"],
        not_match = [],
    )
    EOF
    
    echo "[+] Created rules file: $RULES_DIR/sample-command-foo.rules"
    cat "$RULES_DIR/sample-command-foo.rules"
    
    ###############################################################################
    # 2. Create the sample-command-foo binary
    ###############################################################################
    mkdir -p "$BIN_DIR"
    
    cat > "$BIN_DIR/sample-command-foo" <<'SCRIPT'
    #!/usr/bin/env bash
    echo "sample-command-foo executed successfully"
    SCRIPT
    
    chmod +x "$BIN_DIR/sample-command-foo"
    
    echo ""
    echo "[+] Created executable: $BIN_DIR/sample-command-foo"
    ls -la "$BIN_DIR/sample-command-foo"
    
    # Make sure it's on PATH
    export PATH="$BIN_DIR:$PATH"
    echo "[+] Verify it runs directly:"
    sample-command-foo
    
    ###############################################################################
    # 3. Run codex with --ask-for-approval=untrusted and verbose
    ###############################################################################
    echo ""
    echo "=========================================="
    echo " Running codex exec (verbose)"
    echo "=========================================="
    echo ""
    
    
    # cd <some-git-repo>
    codex --ask-for-approval untrusted
    

    Then codex v0.99 still asks for permissions

    Image

    I know this is not the same as the issue reported. But I'm sharing this here instead of a new issue because it feels like the root cause is the same

  12. 5 remaining items

  13. added a commit that references this issue on Feb 17, 2026
    0fbe10a
  14. dylan-hurd-oai commented on Feb 17, 2026

    @dylan-hurd-oai
    Contributor

    Re-opening for now to confirm the fix

  15. davidgilbertson commented on Feb 17, 2026

    @davidgilbertson
    Contributor

    @dylan-hurd-oai you're great! I cleared all the rules and now it works. Although neither I nor ChatGPT could see any syntax errors.

  16. davidgilbertson commented on Feb 18, 2026

    @davidgilbertson
    Contributor

    Actually it's happening again now, asking every time to run tests, and the only thing in my rules file is:

    prefix_rule(pattern=["npm", "test"], decision="allow")
    

    So the current state of things on Windows is quite bad. You can't use the new sandbox because then Codex can't even read files. With the older sandbox, Codex can't run tests in a sandbox because of the EPERM issue. It can escalate and run them outside a sandbox, but it can't remember that it's allowed to run tests. So in a session where its troubleshooting failing tests, you have to sit there and approve it again and again.

  17. added a commit that references this issue on Feb 20, 2026
    c3c2f32
  18. added a commit that references this issue on Feb 23, 2026
    7fe09e7
  19. added a commit that references this issue on Feb 27, 2026
    6b6b65d
  20. GitMurf commented on Mar 16, 2026

    @GitMurf

    Actually it's happening again now, asking every time to run tests...

    Yeah it seems that the prefix rules require exact full commands with PowerShell commands for Windows sandboxing. I described my similar issue I am still having here: #8537 (comment)

  21. ILYA-2606 commented on Mar 25, 2026

    @ILYA-2606

    A solution has been found:

    1. Create xcodebuild.sh:
    #!/usr/bin/env bash
    set -euo pipefail
    
    BASE_CMD="xcodebuild -scheme Hubble -destination 'generic/platform=iOS'"
    EXTRA="${1-}"
    
    if [[ -n "$EXTRA" ]]; then
      bash -lc "$BASE_CMD $EXTRA"
    else
      bash -lc "$BASE_CMD"
    fi
    1. Add xcodebuild.sh in Codex default.rules:
      prefix_rule(pattern=["sh", "xcodebuild.sh"], decision="allow")
    2. Ask Codex to use xcodebuild.sh for any project build, or write a skill for it:
    In the future, always call any xcodebuild via xcodebuild.sh with the addition of the rest of the command, for example:
    sh xcodebuild.sh "│ -quiet CODE_SIGNING_ALLOWED=NO build 2>&1"
    
  22. ax-openai commented on Jun 12, 2026

    @ax-openai
    Contributor

    Closing as resolved by #11951.

  23. added a commit that references this issue on Jun 27, 2026
    1891151
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

    bugsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions