core-agent-ide/codex-cli/src/utils
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
..
agent Fix MacOS multiprocessing by relaxing sandbox (#1808) 2025-08-03 06:59:26 -07:00
logger chore: improve storage/ implementation; use log(...) consistently (#473) 2025-04-21 09:51:34 -04:00
singlepass refactor: improve performance of renderFilesToXml using Array.join (#127) 2025-04-16 16:14:57 -07:00
storage chore: improve storage/ implementation; use log(...) consistently (#473) 2025-04-21 09:51:34 -04:00
approximate-tokens-used.ts fix(cli): ensure /clear resets context and exclude system messages from approximateTokenUsed count (#443) 2025-04-20 08:52:14 -07:00
auto-approval-mode.js Initial commit 2025-04-16 12:56:08 -04:00
auto-approval-mode.ts Initial commit 2025-04-16 12:56:08 -04:00
bug-report.ts fix: /bug report command, thinking indicator (#381) 2025-04-18 18:13:34 -07:00
check-in-git.ts Initial commit 2025-04-16 12:56:08 -04:00
check-updates.ts fix: always load version from package.json at runtime (#909) 2025-05-12 21:27:15 -07:00
compact-summary.ts Adds Azure OpenAI support (#769) 2025-05-09 18:11:32 -07:00
config.ts add: responses api support for azure (#1321) 2025-06-22 18:01:13 -07:00
extract-applied-patches.ts feat: /diff command to view git diff (#426) 2025-04-19 16:23:27 -07:00
file-system-suggestions.ts feat: @mention files in codex (#701) 2025-04-30 16:19:55 -07:00
file-tag-utils.ts feat: @mention files in codex (#701) 2025-04-30 16:19:55 -07:00
get-api-key-components.tsx add: sign in with chatgpt (#963) 2025-05-16 12:28:54 -07:00
get-api-key.tsx feat: add support for login with ChatGPT (#1212) 2025-06-04 08:44:17 -07:00
get-diff.ts fix: diff command for filenames with special characters (#954) 2025-05-16 09:10:44 -07:00
input-utils.ts Add fallback text for missing images (#397) 2025-04-18 22:55:24 -07:00
model-info.ts add: codex-mini-latest (#951) 2025-05-16 08:04:00 -07:00
model-utils.ts Adds Azure OpenAI support (#769) 2025-05-09 18:11:32 -07:00
openai-client.ts Adds Azure OpenAI support (#769) 2025-05-09 18:11:32 -07:00
package-manager-detector.ts refactor(updates): fetch version from registry instead of npm CLI to support multiple managers (#446) 2025-04-21 00:00:20 -07:00
parsers.ts fix: reasoning default to medium, show workdir when supplied (#931) 2025-05-14 08:38:41 -07:00
providers.ts feat: added arceeai as a provider (#818) 2025-05-10 16:16:28 -07:00
responses.ts fix: guard against missing choices (#817) 2025-05-10 16:16:19 -07:00
session.ts fix: always load version from package.json at runtime (#909) 2025-05-12 21:27:15 -07:00
short-path.ts Initial commit 2025-04-16 12:56:08 -04:00
slash-commands.ts add: session history viewer (#912) 2025-05-16 12:28:22 -07:00
terminal-chat-utils.ts chore: consolidate model utils and drive-by cleanups (#476) 2025-04-21 12:33:57 -04:00
terminal.ts fix: /clear now clears terminal screen and resets context left indicator (#425) 2025-04-21 12:39:46 -04:00