Repository navigation
Reap active Git and GitHub subprocesses on SIGTERM - #1290
Conversation
Architecture-Review: unchanged; CLI dispatch shares the existing signal handler and preserves termination during late signal delivery. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on 1c765bed182110f06318d87de2b8f0b5b42c406a, 39.9s: approve (0 critical, 0 important, 2 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
|
|
||
|
|
||
| def _request_unwind(_signum, _frame): | ||
| signal.signal(signal.SIGTERM, signal.SIG_IGN) |
There was a problem hiding this comment.
suggestion: Unwind-time children inherit SIGTERM=SIG_IGN, now across the whole CLI
_request_unwind sets SIGTERM to SIG_IGN until unwind_on_sigterm exits. Popen(restore_signals=True) only resets SIGPIPE, SIGXFZ and SIGXFSZ. So any subprocess started from a finally/cleanup path while Terminated is propagating keeps ignoring SIGTERM after exec. This already happened inside sandbox scopes. Because cli.main now wraps every command, it can affect any cleanup that runs Git or gh. Impact is small: those children are short-lived and _proc.run SIGKILLs on exceptions. Smallest fix: block SIGTERM with signal.pthread_sigmask instead of using SIG_IGN, or pass a preexec_fn/process_group reset in _proc.run. At minimum, add a comment documenting it.
| except subprocess.TimeoutExpired as exc: | ||
| out = exc.stdout.decode(errors="replace") if isinstance(exc.stdout, bytes) else exc.stdout | ||
| out = out or "" | ||
| out = exc.stdout.decode(errors="replace") if isinstance(exc.stdout, bytes) else (exc.stdout or "") |
There was a problem hiding this comment.
suggestion: Unrelated TimeoutExpired refactor
This change folds out = out or "" into the conditional expression. It is behavior-neutral but unrelated to SIGTERM unwinding, and the new line is longer than the surrounding style. Revert it to keep the diff focused.
|
@Mergifyio queue |
❌ Left the queue ·
|
|
No description provided. |
|
Owner queue route. The full sandboxed check passed on |
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Context and goal
Closes #1178
Acceptance
Supersedes #1262. The fresh regression also delivers SIGTERM during handler restoration. Both the supervisor and CLI signal tests pass, and source line count stays within the current budget.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review
Validation
Recorded for
1c765bed1821uv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0