[codex] add POSIX signal wake service - #10
Merged
Conversation
LimiNode
marked this pull request as ready for review
June 9, 2026 07:12
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
Adds an opt-in POSIX self-pipe wake bridge so SIGINT/SIGTERM can wake throttled Consolix polling loops without doing mutex or condition-variable work inside a signal handler.
What Changed
PosixSignalWakeServiceincore.LoopWakeServicefrom ordinary C++ code after the signal handler writes to the pipe.PosixSignalWakeComponentincomponents.consolix::add<consolix::PosixSignalWakeComponent>().ConsoleApplicationRunneras the owner of POSIX signal handler registration.sig_atomic_t.LoopThrottleComponentdelay so Linux/macOS CI verifies that SIGINT/SIGTERM interrupts the throttle wait quickly.Why
The previous runner behavior was intentionally async-signal-safe on POSIX, but a long
LoopThrottleComponentdelay could postpone SIGINT/SIGTERM handling until the throttle wait ended.The self-pipe bridge keeps the unsafe work out of the signal handler while still waking the polling loop promptly. The runner signal handler writes one byte to a pipe, and the watcher thread wakes
LoopWakeService, allowing the normal runner loop to observe the already-recorded stop request.Validation
cmake --build tmp/agent-work/build-runner-mingw --parallel 1ctest --test-dir tmp/agent-work/build-runner-mingw --output-on-failure-> 7/7 passedcmake --build tmp/agent-work/build-runner-cxx11-mingw --parallel 1ctest --test-dir tmp/agent-work/build-runner-cxx11-mingw --output-on-failure-> 5/5 passedrg -n '^\\s*#include .*\\.\\./' include-> no matchesgit diff --cached --checkPOSIX self-pipe behavior is covered by
tests/test_posix_signal_shutdown.cppand is expected to run in Linux/macOS CI.