Repository navigation
feat(terminal): real Ctrl-C, wait_for regex, screen diff - #2537
Merged
Merged
Conversation
Ctrl-C drops the running command mid-way (sleep included) and sets $? to 130; $? now carries across terminal lines. TerminalTool gains wait_for (regex over command output, returns early) and screen=changes|none. Python and JS bindings forward the new arguments. Lifts L-TERM-003.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 918773b | Commit Preview URL Branch Preview URL |
Oct 07 2026, 04:41 AM |
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.
What changed
sleepor a busy loop. Before, it waited for the next command boundary.$?is set to 130. An interactive session also keeps$?across lines (false, thenecho $?on the next line prints 1).TerminalToolwait_for. This optional regex makes the call return as soon as command output printed during the call matches it, even while the command keeps running. The reply then carriesmatched. It matches command stdout/stderr only, never typed keys or prompts, soecho ready<Enter>does not match itself.^and$match at line ends.TerminalToolscreen."full"(the default) keeps the current behavior."changes"returnsscreen_changes: [{row, text}]with only the rows that changed since the previous call, pluscursor."none"omits the screen.Terminal.call(input, wait_ms, wait_for, screen)gains the same arguments;call(**tool_args)forwards a model call as is. JSTerminal.call()also accepts an args object ({input, wait_ms, wait_for, screen}).Why
These are agent-loop features. Long-running commands (servers, builds) can now be awaited by their output instead of fixed sleeps. Ctrl-C actually stops work, and long sessions no longer resend a full 24-row screen on every call. This lifts L-TERM-003.
Before / After
Tests:
terminal::tests::{ctrl_c_interrupts_a_running_command, ctrl_c_interrupts_a_busy_loop, exit_status_carries_across_lines},terminal::tool::tests::{wait_for_*, screen_changes_returns_only_changed_rows, strip_ansi_keeps_visible_text}, plus Python and JS terminal tests. Locally, all 2840 bashkit lib tests (--features terminal) pass, Pythontest_terminal.pygives 12 passed, and the JSterminal.spec.tsgives 12 passed.Risk
terminalfeature, which is off by default.clear_cancelled_execution_stateruns. A stale notify permit is ignored unless the cancel flag is set.wait_forpattern is model-supplied. It is capped at 1 KiB with a 1 MiB compiled-regex limit, and the tap of command output keeps only the newest 256 KiB (TM-DOS-119 updated).__callJsonnow takes a JSON args string. This is internal and the wrapper is updated.Checklist
screendefaults tofull; output schema no longer requiresscreen)Generated by Claude Code