Skip to content

execd: every command starts with default signal dispositions - #674

Merged
jaredLunde merged 1 commit into
mainfrom
execd-reset-signals
Nov 18, 2026
Merged

jaredLunde merged 1 commit into
mainfrom
execd-reset-signals

Conversation

@jaredLunde

Copy link
Copy Markdown
Contributor

A customer's SIGINT (Ctrl-C) to a job does nothing on E2B. Found by Beyond's W12.1 through the front: the verifier's the signal op reaches a job's group failed there (the job's SIGINT trap never ran) while it passes on a direct execd. The verifier is right; this fixes the endpoint (supersedes the verifier change in #673, closed).

Cause. Beyond's E2B provider starts sandbox-exec with setsid nohup /usr/local/bin/sandbox-exec ... & inside a non-interactive shell (api/app/execfront/e2b.go:450 in the beyond repo): & there sets SIGINT and SIGQUIT to SIG_IGN, nohup ignores SIGHUP, and an ignored disposition survives exec. Every command and job execd spawned inherited it, a shell could not even trap it, and a signal to the job did nothing. (The execd binary happened to re-enable SIGINT because main waits on it; an embedder such as sandbox-exec, and every other signal, did not.)

Fix. serve installs do-nothing handlers (tokio's safe signal driver) for HUP, INT, QUIT, TERM, USR1, USR2 and ALRM before any spawn (proc::release_signals). exec resets a handler to the default, so every command, one-shot and job alike, starts with SIG_DFL. Side effect: execd itself survives a stray SIGHUP/SIGUSR1/SIGQUIT; it still stops on SIGTERM and SIGINT where main waits for them. unsafe stays forbidden (a pre_exec reset would need it).

Test. tests/signals.rs starts execd the way cmd &/nohup does (those signals ignored in its own process) and shows a one-shot dying of each signal and a job's trap running on each. Red without the fix (SIGQUIT ignored by a one-shot), green with it. The verifier's check is unchanged.

Local, as ci.yml runs them: fmt, dprint, clippy (workspace and code-mode), audit, gateway-unit/e2e, agent-lib, code-mode, exec, jobs, rest, notify-e2e, workspace-rest, exec-live, sdk-ts, sdk-python all pass; agent-serve fails only 2 serve_service_managed_mcp tests on this host (/proc/<pid>/mem denied).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LBGuEqmuH3r35k31s2EJ8X

A launcher that starts execd with `cmd &` or `nohup` leaves SIGINT, SIGQUIT and SIGHUP ignored, and
an ignored disposition survives exec: every command and job inherited it, so a customer's Ctrl-C to
a job did nothing and a shell could not trap it (E2B starts sandbox-exec that way, e2b.go:450).
serve installs do-nothing handlers for HUP INT QUIT TERM USR1 USR2 ALRM before any spawn; exec
resets a handler to the default, so every command starts with SIG_DFL.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBGuEqmuH3r35k31s2EJ8X
@jaredLunde
jaredLunde enabled auto-merge November 18, 2026 05:19
@jaredLunde
jaredLunde added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 2d88fa9 Nov 18, 2026
31 checks passed
@jaredLunde
jaredLunde deleted the execd-reset-signals branch November 18, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant