Skip to content

Fix adapter signal handling on Linux - #207

Merged
yihanzhu merged 2 commits into
mainfrom
codex/fix-adapter-signal-handler
Aug 31, 2026
Merged

Fix adapter signal handling on Linux#207
yihanzhu merged 2 commits into
mainfrom
codex/fix-adapter-signal-handler

Conversation

@yihanzhu

@yihanzhu yihanzhu commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Keep one permanent guarded signal handler instead of swapping traps around process launch.
  • Defer signals only across child PID/process-group registration, then replay them.
  • Make every trap-reachable state read safe under set -u, including repeated TERM.
  • Prevent signal cleanup from re-entering.

Why

PR #206 exposed a Linux-only failure in the already-merged #205 signal regression: the runner exited with Bash status 2 and leaked stderr even though the child group and scratch state were cleaned. This one-file follow-up fixes that root cause before #206 continues.

Proof

Exact head/base: 9c79b78ce98987ac50e050abf563fc877c541943 / cac3a2eaf41000c14d84b6c4af64b09fbdab7ce5.

  • adapter contract matrix: 29/29 locally, including TERM group cleanup
  • ShellCheck 0.11.0: clean
  • Bash syntax and diff checks: clean
  • Linux proof: required CI for this exact head

Inactive fake-only test runtime. No real adapter, credential, network use, activation, release, or deployment.

Follow-up to #205; unblocks #206.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploying ystack with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9c79b78
Status: ✅  Deploy successful!
Preview URL: https://bf15aa3e.fabrica-6yx.pages.dev
Branch Preview URL: https://codex-fix-adapter-signal-han.fabrica-6yx.pages.dev

View logs

@yihanzhu

Copy link
Copy Markdown
Owner Author

Codex reviewer (cross-vendor, read-only)

Reviewed-head: 9c79b78
Reviewed-base: cac3a2e
reviewer: operator-default @ high

Posted verbatim by codex-review.sh (codex exec review --json --base refs/codex-review/207-29867/base in an isolated temp worktree, sandbox forced read-only). Comments only — Codex never pushes, approves, or merges.

The permanent signal handler closes the handler-replacement race while preserving deferred delivery during child process-group setup. The nounset-safe defaults and cleanup guard do not alter normal behavior, and the changed script passes syntax and pinned ShellCheck validation.

@yihanzhu
yihanzhu merged commit 77eedf9 into main Aug 31, 2026
2 checks passed
@yihanzhu
yihanzhu deleted the codex/fix-adapter-signal-handler branch August 31, 2026 22:07
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