seatbelt_base_policy.sbpl missing ipc-sysv-sem — lmdb (used by Angular persistent cache) crashes with SIGABRT on macOS

Resolved 💬 2 comments Opened Jun 18, 2026 by Prontsevich Closed Jun 18, 2026

Description

What version of Codex is running?

Codex Desktop (macOS)

What platform is your computer?

macOS Darwin arm64 (Apple Silicon)

What issue are you seeing?

When running an Angular build (@angular/build:application) inside Codex's
sandboxed shell on macOS, the process crashes with SIGABRT (exit code 134)
during Angular's persistent compiler cache initialization.

The root cause is lmdb — a native C key-value database that Angular uses
for its persistent compilation cache (@lmdb/lmdb-darwin-arm64@3.5.1). The
prebuilt lmdb binary for darwin-arm64 is compiled with System V semaphore
support. Verified via nm on the native addon:

U _semctl
U _semget
U _semop
T _mdb_sem_wait

During lmdb.open(), lmdb calls semget()/semop() for internal lock
management. Codex's seatbelt_base_policy.sbpl starts with (deny default)
and selectively allows IPC:

  • (allow ipc-posix-sem) — POSIX semaphores ✅
  • (allow ipc-posix-shm-read-data ...) — POSIX SHM for OpenMP ✅
  • ipc-sysv-semNOT allowed ❌ → (deny default) → SIGABRT

Steps to reproduce

  1. Install lmdb in any Node.js project: npm install lmdb
  1. Create a test script:

``js
// test-lmdb.js
const lmdb = require('lmdb');
const db = lmdb.open({ path: '/tmp/lmdb-test' });
db.put('key', 'value');
console.log('OK:', db.get('key'));
db.close();
``

  1. Create a sandbox profile that mimics Codex's IPC rules:

``scheme
;; codex-like.sb
(version 1)
(deny default)
(allow process-exec process-fork signal)
(allow file-read* file-write* file-ioctl)
(allow sysctl-read)
(allow mach-lookup)
(allow ipc-posix-sem)
(allow ipc-posix-shm-read-data
ipc-posix-shm-write-create
ipc-posix-shm-write-unlink
(ipc-posix-name-regex #"^/__KMP_REGISTERED_LIB_[0-9]+$"))
(allow pseudo-tty)
(allow network*)
(allow system-socket)
``

  1. Run: sandbox-exec -f codex-like.sb node test-lmdb.js

Abort trap: 6 (exit 134)

  1. Add (allow ipc-sysv-sem) to the profile and re-run:

OK: value

What did you expect to happen?

lmdb should open successfully inside the sandbox, as it only uses semaphores
for internal process synchronization — no network, no shared memory with
external processes.

What happened instead?

Process aborts with SIGABRT before any output is produced. The crash is opaque —
it looks like a generic process abort rather than a sandbox permission issue,
making it difficult for users to diagnose.

Workaround

Setting CI=true in the shell environment tells Angular to skip the persistent
cache entirely (@angular/build/src/utils/normalize-cache.js checks
process.env.CI and sets cacheEnabled=false), so lmdb is never initialized.
Build output is identical; only incremental build speed is affected.

# .codex/config.toml
[shell_environment_policy]
set = { CI = "true" }

Suggested fix

Add (allow ipc-sysv-sem) to seatbelt_base_policy.sbpl, alongside the
existing (allow ipc-posix-sem):

; Needed for Python multiprocessing SemLock
(allow ipc-posix-sem)
; Needed for lmdb (used by Angular persistent compiler cache and other tools)
(allow ipc-sysv-sem)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗