Repository navigation
fix: make prctl(PR_SET_PDEATHSIG) non-fatal for Lambda compatibility - #1
Merged
Merged
Conversation
AWS Lambda's Firecracker seccomp profile blocks prctl(PR_SET_PDEATHSIG), causing every subprocess spawn to fail with "Operation not permitted" (EPERM). This happens even with --dangerously-bypass-approvals-and-sandbox because the prctl call is in the process spawner (spawn.rs, pipe.rs, sleep-inhibitor), not in the sandbox layer. The parent-death signal is a best-effort cleanup mechanism — when it fails with EPERM, we gracefully continue instead of propagating the error. The existing kill_on_drop(true) on tokio::process::Command provides an alternative cleanup path. Patched call sites: - codex-rs/utils/pty/src/process_group.rs (core spawn + pipe paths) - codex-rs/linux-sandbox/src/proxy_routing.rs (network proxy) - codex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs Also adds a GitHub Actions workflow (lambda-build.yml) to produce a statically linked aarch64-unknown-linux-musl binary for Lambda Layers. Ref: openai#4725 Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prctl(PR_SET_PDEATHSIG)gracefully handleEPERMinstead of failing, enabling Codex CLI to run on AWS Lambdalambda-build.yml) to produceaarch64-unknown-linux-muslbinary for Lambda LayersProblem
AWS Lambda runs inside a Firecracker microVM with a guest-side seccomp profile that blocks
prctl(PR_SET_PDEATHSIG). This causes every subprocess spawn from Codex to fail with "Operation not permitted (os error 1)" — even when--dangerously-bypass-approvals-and-sandboxis used, because theprctlcall is in the core process spawner (spawn.rs), not in the sandbox layer.This was reported in openai#4725 and closed as NOT_PLANNED.
Fix
The parent-death signal is a best-effort cleanup mechanism. When
prctlfails withEPERM, we now returnOk(())instead of propagating the error. The existingkill_on_drop(true)ontokio::process::Commandprovides an alternative cleanup path.Patched call sites:
codex-rs/utils/pty/src/process_group.rs— core spawn path used by all tool callscodex-rs/linux-sandbox/src/proxy_routing.rs— network proxy subprocesscodex-rs/utils/sleep-inhibitor/src/linux_inhibitor.rs— sleep inhibitor subprocessTest plan
lambda-buildGitHub Actions workflow produces a working binaryls,cat,find,rg)🤖 Generated with Claude Code