Repository navigation
Conversation
Ink runs the terminal in raw mode, so ctrl+c reaches the TUI as a key, not a SIGINT. Ink's exitOnCtrlC exited on it without running the registered cleanups, without settling the task stream, and with exit code 0. Only a real SIGINT or SIGTERM from outside reached run-wizard's handler, and headless runs had no handler at all. wizardCancel in wizard-abort.ts is now the one exit for a cancel. It runs the cleanups, then the registered cancel hooks and the analytics flush, each bounded to 2 s, then exits 128 plus the signal number. A second cancel while the first settles exits at once. The ctrl+c key in ScreenContainer, SIGINT, SIGTERM and SIGHUP in the TUI, and the same signals in headless runs all call it. run-wizard and runNonInteractive register a cancel hook that settles their task stream as an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a Context Mill branch:
Add Results will be posted here when complete. |
This was referenced Sep 24, 2026
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.
Problem
Ctrl-C in the TUI skipped every registered cleanup. Ink runs the terminal in raw mode, so Ctrl-C arrives as a key, not a SIGINT. Ink's
exitOnCtrlCexited on that key, andrun-wizard's SIGINT handler never ran. So a cancelled run:Headless and
--ciruns had no signal handler at all. A SIGTERM from CI killed the process before any cleanup ran.Changes
There's now one cancel path. Every way of quitting goes through it.
wizardCancelinwizard-abort.ts. Runs the cleanups first, then the cancel hooks and the analytics flush, each capped at 2 s. Then it exits with 128 plus the signal number. A second cancel while the first is settling exits right away.startTUIrenders withexitOnCtrlC: false.ScreenContainer's globaluseInputsends Ctrl-C towizardCancel.installCancelSignalssends SIGINT, SIGTERM and SIGHUP towizardCancel. It's installed instartTUIandrunNonInteractive.run-wizardandrunNonInteractiveregister a cancel hook that ends their stream as an error.run-wizard's own signal handler is gone.Exit codes: 130 for Ctrl-C or SIGINT, 143 for SIGTERM, 129 for SIGHUP.
docs/error-catalog.mdlists them.Prior art. We copied these patterns rather than invent one:
exitOnCtrlC: falseand handle Ctrl-C yourself inuseInput.Test plan
Real TUI. Ran the built
dist/bin.js auditin a pty (node-pty) and sent a real\x03or signal:[wizard-cancel] ctrl+c, cancelling[wizard-cancel] SIGTERM, cancellingctrl+c again, exiting nowEach run left the alternate screen and printed the exit line.
Unit and integration tests. They cover
wizardCancel's order, exit codes, the second-cancel force, a hanging or throwing hook, the Ctrl-C key inScreenContainer,startTUI's render options, a TUI run cancelled mid-agent (stream settled as an error before exit), and a headless run cancelled by SIGTERM.Mutations. Breaking each wiring point (the key,
exitOnCtrlC, the headless signals, therun-wizardhook, cleanups-first) fails one test.pnpm typecheck, ESLint on the changed files (0 errors), andvitest run(203 files, 3368 tests) pass.To try it, run any TUI command, press Ctrl-C, then check
echo $?prints 130.LLM context
Written by Claude Code while fixing the audit ledger cleanup in #1336.
🤖 Generated with Claude Code