[codex] add exit-code lifecycle runner - #9
Merged
Conversation
LimiNode
marked this pull request as ready for review
June 8, 2026 10:13
LimiNode
marked this pull request as draft
June 8, 2026 10:58
LimiNode
marked this pull request as ready for review
June 8, 2026 20:33
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 a reusable
ConsoleApplicationRunnerthat drives the Consolix component lifecycle and returns an exit code without callingstd::exit, plus an optional wakeable throttle component for polling loops.What Changed
ConsoleApplicationRunnerwithrun_for_exit_code(),request_stop(), and forced-stop waiting for runner-thread cleanup.consolix::run_for_exit_code(),consolix::request_stop(code), andconsolix::stop(code)convenience APIs.ConsoleApplicationinto a compatibility facade over the runner while preserving process-owningrun()behavior viastd::exit(returned_code).LoopThrottleComponent, a wakeable optional wait step for polling loops, withwake()and configurable delay.LoopWakeServiceas a shared wake channel so ordinary runner stop requests wake throttled loop waits without hard-coding the runner to a specific component.external/log-it-cppto the latestmainpointer.Why
Backends and embedded runtimes need Consolix lifecycle and signal handling without losing control through
std::exit. Windows control handlers also should not perform full component shutdown directly from the handler thread because that can race or deadlock with normal component processing, logging, or module work.Consolix is also a polling-loop runtime. Keeping sleep out of the runner preserves low-latency behavior by default, while
LoopThrottleComponentgives regular services and tools an explicit way to avoid busy-loop CPU usage and still wake early when new work arrives.LoopWakeServicelets ordinaryconsolix::stop()requests wake long throttle waits through the existing resource model, so shutdown does not wait for the configured throttle delay.Runner reuse is intentionally rejected instead of reset in place because shutdown may already have destroyed components, services, and logging resources. A fresh
AppComponentManagerplus a fresh runner is the clearer lifecycle boundary.The include cleanup keeps Consolix aligned with the project's umbrella-header model: aggregate-owned internal headers receive shared dependencies from their entry point, and standalone public leaf headers use forward project include paths instead of
../.Validation
cmake --build tmp/agent-work/build-runner-mingw --target test_console_application_runner test_loop_throttle_component example_loop_throttle_component --parallel 1ctest --test-dir tmp/agent-work/build-runner-mingw -R "test_console_application_runner|test_loop_throttle_component" --output-on-failure-> 2/2 passedcmake --build tmp/agent-work/build-runner-cxx11-mingw --target test_console_application_runner test_loop_throttle_component example_loop_throttle_component --parallel 1ctest --test-dir tmp/agent-work/build-runner-cxx11-mingw -R "test_console_application_runner|test_loop_throttle_component" --output-on-failure-> 2/2 passedcmake --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 passedexamples/example_loop_throttle_component.exe-> exit code 0<consolix/utils/enums.hpp>and<consolix/utils/path_utils.hpp>LoopWakeServicethrough<consolix/core.hpp>rg -n '^\\s*#include .*\\.\\./' include-> no matchesgit diff --checkNote: an earlier full MinGW build with high parallelism hit
cc1plus.exe: out of memory; the same builds passed when rerun sequentially.