Repository navigation
Agents CLI: Ctrl-C and Ctrl-D cancel the configuration questions - #1655
Open
longquanzheng wants to merge 2 commits into
Open
longquanzheng wants to merge 2 commits into
longquanzheng wants to merge 2 commits into
Conversation
Ctrl-C at an init or first-run configuration question now prints "Cancelled; no configuration written.", writes no file, and exits with 130; Ctrl-D does the same with exit code 1. TypeScript: the terminal input had no interrupt handler during the questions, so readline's SIGINT went to a no-op. Each question now waits with an abort signal that Ctrl-C triggers, and the input is closed after the questions so raw mode ends before startup. Python: the first-run questions ran inside asyncio.run, whose SIGINT handler kept Ctrl-C from ending input(), and Ctrl-D took the default answer. The configuration now loads before asyncio.run, and both keys raise a cancellation that run_agent_cli maps to the exit code. Pseudo-terminal tests cover Ctrl-C at the first and a later question and Ctrl-D in both CLI cores.
Closing the terminal input after the first-run questions dropped lines already queued, so a chat message typed together with the last answer was lost. close() now returns the unread lines and the chat's new terminal input starts with them. Pseudo-terminal tests in both CLI cores send the last answer and a chat message in one write and expect the chat to echo it.
longquanzheng
enabled auto-merge (squash)
November 11, 2026 22:50
This branch has not been deployed
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
Ctrl-C or Ctrl-D at any configuration question of
init, or of the first-run setup thatrun,sessions, andconnectorsstart without a configuration file, now stops the command right away in both CLI cores. It printsCancelled; no configuration written., writes no file, and exits with 130 for Ctrl-C and 1 for Ctrl-D. The terminal leaves raw mode.Why
Trying
dex-agents-claude-sdk init, Ctrl-C did nothing at the questions.asyncio.run. Its SIGINT handler kept Ctrl-C from endinginput(). Ininit, Ctrl-C printed aKeyboardInterrupttraceback. Ctrl-D took the default answer and could write a default configuration.TypeScript: each question waits with an abort signal that Ctrl-C triggers. The terminal input closes after the questions, so Ctrl-C also ends startup. Python: the configuration loads before
asyncio.run. Ctrl-C and Ctrl-D raise a cancellation thatrun_agent_climaps to the exit code. The exit-code docs (runAgentCli,run_agent_cli, the Python core README, and the agents CLI reference) list the new codes.Testing
initquestion, Ctrl-C at the third question of the first-run setup, and Ctrl-D. Each asserts the exit code, the message, and that no configuration file exists; Python also asserts no traceback. They failed before the fix.ptymodule, because Node cannot open a pseudo-terminal.make copyright-check, anddocs npm run checkran locally. Two existing connectors-warning tests fail in both suites on this machine because a connectors MCP answers there; the Python pair also fails with the origin/main code. CI runs them without one.