Skip to content

SPM swift test fails inside codewhale sandbox: sandbox-exec: sandbox_apply: Operation not permitted #2617

@ShikiSuen

Description

@ShikiSuen

Description

swift test (and swift build --build-tests, and xcodebuild test) consistently fail inside CodeWhale's shell sandbox when the Swift Package Manager needs to compile the Package.swift manifest. The swift build command for the non-test target works only because it reuses cached build artifacts and does not need to recompile the manifest.

This makes CodeWhale unusable for any Swift project that relies on swift test for verification — the agent can compile code but can never run a single test.

Steps to reproduce

  1. Open a CodeWhale session in a Swift Package Manager workspace.
  2. Run swift build — it succeeds (cached artifacts are reused).
  3. Run swift test --filter SomeTestSuite in the package directory.
  4. Observe that SPM attempts to compile the manifest with swiftc inside a sandbox.
  5. The build fails before any test code is reached.

Expected behavior

swift test resolves dependencies, compiles the test target, and runs the tests, just as swift build compiles the main target.

Actual behavior

sandbox-exec: sandbox_apply: Operation not permitted
error: 'vchewing_langmodelassembly': Invalid manifest

The failure happens during SPM's manifest compilation phase:

sandbox-exec: sandbox_apply: Operation not permitted

This repeats for every package dependency (the manifest is compiled multiple times with different vfs overlays), and SPM exits with ExitCode(rawValue: 1) before any test binary is linked.

The same occurs with:

  • swift build --build-tests
  • swift test
  • xcodebuild test -scheme ...
  • Setting SWIFTPM_DISABLE_SANDBOX=1 has no effect.

A plain swift build (without test target) works because the package was already resolved and the build directory was populated before the sandbox restriction took effect.

Additionally, several org.swift.swiftpm cache directories are reported as inaccessible:

warning: /Users/.../Library/org.swift.swiftpm/configuration is not accessible or not writable
warning: /Users/.../Library/org.swift.swiftpm/security is not accessible or not writable
warning: /Users/.../Library/Caches/org.swift.swiftpm is not accessible or not writable

Impact

This is the single most workflow-breaking issue I have encountered with CodeWhale. It turns the agent from a verifiable tool into a blind code generator for any Swift project.

In concrete terms:

  • swift build succeeds, so the agent can produce code that compiles.
  • swift test is blocked by the sandbox on every invocation — swiftc is not allowed to compile the manifest.
  • The agent ships untested code. When that code is later run manually by the user, failures surface that could have been caught and fixed in-session if the test feedback loop were available.
  • This affects all SPM projects, not just one codebase. Any Swift developer using CodeWhale loses their primary verification mechanism.

Without swift test, the agent is operating with one hand tied behind its back: it can write, it can build, but it cannot confirm correctness.

Environment

  • OS: macOS 26 (Tahoe)
  • codewhale version: 0.8.50
  • Install method: Cargo
  • Model/provider: deepseek-v4-pro / DeepSeek
  • Terminal app: CodeWhale built-in terminal
  • Shell: /bin/zsh
  • Xcode: 26.5 (26.5)
  • Swift: 6.3

Logs, screenshots, or recordings

Image

P.S.: I dunno whether this issue exists on non-Darwin platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions