core-agent-ide/codex-cli/src/utils/agent
David Z Hao 75eecb656e
Fix MacOS multiprocessing by relaxing sandbox (#1808)
The following test script fails in the codex sandbox:
```
import multiprocessing
from multiprocessing import Lock, Process

def f(lock):
    with lock:
        print("Lock acquired in child process")

if __name__ == '__main__':
    lock = Lock()
    p = Process(target=f, args=(lock,))
    p.start()
    p.join()
```

with 
```
Traceback (most recent call last):
  File "/Users/david.hao/code/codex/codex-rs/cli/test.py", line 9, in <module>
    lock = Lock()
           ^^^^^^
  File "/Users/david.hao/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/multiprocessing/context.py", line 68, in Lock
    return Lock(ctx=self.get_context())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/david.hao/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/multiprocessing/synchronize.py", line 169, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
  File "/Users/david.hao/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/multiprocessing/synchronize.py", line 57, in __init__
    sl = self._semlock = _multiprocessing.SemLock(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 1] Operation not permitted
```

After reading, adding this line to the sandbox configs fixes things -
MacOS multiprocessing appears to use sem_lock(), which opens an IPC
which is considered a disk write even though no file is created. I
interrogated ChatGPT about whether it's okay to loosen, and my
impression after reading is that it is, although would appreciate a
close look


Breadcrumb: You can run `cargo run -- debug seatbelt --full-auto <cmd>`
to test the sandbox
2025-08-03 06:59:26 -07:00
..
sandbox Fix MacOS multiprocessing by relaxing sandbox (#1808) 2025-08-03 06:59:26 -07:00
agent-loop.ts add: responses api support for azure (#1321) 2025-06-22 18:01:13 -07:00
apply-patch.ts fix: gpt-4.1 apply_patch handling (#930) 2025-05-14 08:34:09 -07:00
exec.ts fix: gpt-4.1 apply_patch handling (#930) 2025-05-14 08:34:09 -07:00
handle-exec-command.ts fix: increase output limits for truncating collector (#575) 2025-05-05 10:26:55 -07:00
parse-apply-patch.ts Initial commit 2025-04-16 12:56:08 -04:00
platform-commands.ts chore: improve storage/ implementation; use log(...) consistently (#473) 2025-04-21 09:51:34 -04:00
review.ts feat: shell command explanation option (#173) 2025-04-17 13:28:58 -07:00