Conversation
Ctrl-C handling moves from a broadcast channel of ad-hoc signals to a `SignalRouter` that owns the root shutdown token and a LIFO stack of scoped interrupt handlers (RFD 045). The first Ctrl-C press now always reaches the topmost active handler: the streaming loop, the tool execution loop, or a new turn-level handler that covers the gaps between turn phases (persistence, thread building, response processing) and commits partial content before ending the turn. A press with no registered handler, or a second press within `interrupt.escalation_cooldown_secs` (default 2s), begins a graceful shutdown; any further press exits the process immediately with code 130. SIGTERM always requests a graceful shutdown and SIGQUIT always exits immediately, both bypassing the handler stack. Cancelling an interrupt menu itself with Ctrl-C now escalates instead of silently falling back to "Stop": both the streaming and tool menus commit partial content or cancel running tools, then begin a graceful shutdown. During tool execution, a Ctrl-C is declined while an interactive tool prompt is active so the prompt keeps handling it, and propagates to the next handler down the stack otherwise. A Ctrl-C during the stream-error backoff wait now cuts the wait short and opens the interrupt menu immediately instead of after the full delay. `jp_task::TaskHandler` drops its separate force-cancellation token now that SIGQUIT exits the process directly; background task draining watches the router's shutdown token instead. Docs: RFD 045 is marked Implemented, and RFD 092 (predictable and responsive interrupt escalation) is added as a follow-up proposal covering the shutdown watchdog, a turn menu, a generic fallback menu, and Ctrl-C handling inside active prompts. Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
Ctrl-C handling moves from a broadcast channel of ad-hoc signals to a
SignalRouterthat owns the root shutdown token and a LIFO stack of scoped interrupt handlers (RFD 045). The first Ctrl-C press now always reaches the topmost active handler: the streaming loop, the tool execution loop, or a new turn-level handler that covers the gaps between turn phases (persistence, thread building, response processing) and commits partial content before ending the turn. A press with no registered handler, or a second press withininterrupt.escalation_cooldown_secs(default 2s), begins a graceful shutdown; any further press exits the process immediately with code130. SIGTERM always requests a graceful shutdown and SIGQUIT always exits immediately, both bypassing the handler stack.
Cancelling an interrupt menu itself with Ctrl-C now escalates instead of silently falling back to "Stop": both the streaming and tool menus commit partial content or cancel running tools, then begin a graceful shutdown. During tool execution, a Ctrl-C is declined while an interactive tool prompt is active so the prompt keeps handling it, and propagates to the next handler down the stack otherwise. A Ctrl-C during the stream-error backoff wait now cuts the wait short and opens the interrupt menu immediately instead of after the full delay.
jp_task::TaskHandlerdrops its separate force-cancellation token now that SIGQUIT exits the process directly; background task draining watches the router's shutdown token instead.Docs: RFD 045 is marked Implemented, and RFD 092 (predictable and responsive interrupt escalation) is added as a follow-up proposal covering the shutdown watchdog, a turn menu, a generic fallback menu, and Ctrl-C handling inside active prompts.