Repository navigation
Command queue: prepare the next commands while one runs - #357
Draft
raiseCatError wants to merge 7 commits into
Draft
raiseCatError wants to merge 7 commits into
raiseCatError wants to merge 7 commits into
Conversation
…order in the same shell
While a command runs, Enter adds the composer's command to the session's queue (Ctrl+Q always queues,
Ctrl+S sends the line to the running program). Entries run one at a time through the session's own
shell, each only after the previous command reached its prompt, so directory, variables, functions
and options carry over. A failure, Ctrl+C or a shell switch pauses the rest with the reason;
/queue resume continues and /queue clear drops them, and nothing runs twice.
- The queue belongs to the session service (in-process client alike): it keeps running while no
window is attached, and the exec event says which command came from the queue, so a window that
attaches later shows "from queue" for it too.
- Input ownership first: a program known to wait for input, or one that left a question open on
its line ("Password: ", "Continue? [y/N] ") before any probe looked, gets Enter; a reply is never
queued or run as a command. After Ctrl+C or Ctrl+Z, typing goes to the shell prompt as type-ahead.
- Ctrl+Q during single-key input composes an entry the program never sees; Enter adds it.
- /queue opens a manager to edit, reorder, remove, pause and clear; the queue line by the composer
shows what runs next or why it waits. Settings, Setup, Ask and settings export know about it.
- Live tests over zsh, Bash and Fish: ordering and state, failure and interrupt pauses, prompts,
hidden replies, multi-line entries, detach and reattach, narrow/NO_COLOR/Safe glyphs. A live
start that never becomes ready now ends its sandbox instead of hanging the test file.
Entry previews, pause reasons and the panel's block preview show control characters visibly (␛, ·) instead of writing them to the terminal: a pasted OSC 52 or screen clear inside a queued command can no longer act on the host terminal.
…the rest of the command Typing after a stop goes to the shell prompt only for two seconds. A program that survives the signal (a REPL, a remote shell, a trap) gets the ordinary routing again, so later typing queues as usual and is never written into that program's input unasked.
…er-read files so shards do not stack them These files take 17 to 68 seconds each but counted as 1, so a shard could run several heavy PTY files together on a 4-core runner and starve the timing-sensitive Fish and alternate-screen tests (17 to 24 second budgets), which then failed only on Ubuntu from this branch up.
…xt command only once the last one completed With the queue, Enter while a command runs and nothing asks a question queues the next command. These tests typed their answer as soon as the command's own echo contained the prompt text (it does), or typed the next command before the previous one had completed, so on a slower runner the answer or command was queued instead of sent. They now wait for the program's own prompt (the second occurrence of its text, or NMSh's waiting headline) and for the previous completion.
…he command text NMSh echoes In Classic wording NMSh's live line reads "Running read -P 'Name: ' x…", so waiting for "Name: " (or a second copy of it) was satisfied by NMSh's own line before Fish drew anything, and the answer was typed too early. The prompt is now produced by printf inside the command, so the text only appears when the shell prints it.
…ng command or the type-ahead window early The first test queued five commands behind sleep 3 and the Ctrl+C test typed 0.6 seconds after a 2 second type-ahead window; on a loaded macOS runner either margin was lost and the typing was treated as type-ahead or the queue had already started.
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.
Stacked on #348 (input awareness). Part of the workflow initiative (ledger:
docs/development/workflow-initiative-ledger.mdon the copy branch).What
While a command runs, Enter adds the composer's command to the session's queue (Ctrl+Q always queues, Ctrl+S sends the line to the running program). Entries run one at a time in the same shell, each after the previous command reached its prompt, so cwd, variables, functions and options carry over. A failure, Ctrl+C or a shell switch pauses the rest with the reason;
/queue resume//queue clearact;/queueopens a manager (edit, reorder, remove, pause).Safety
Tests
tests/commandQueue.test.ts(dispatcher, ordering, exactly-once, attribution, hostile text), protocol samples.tests/commandQueueLive.test.ts: 13 real-PTY tests over zsh/Bash/Fish: ordering and state, failure/interrupt pauses, prompts and hidden replies, Ctrl+Q compose, Ctrl+Z/Ctrl+C type-ahead, a SIGINT-surviving program, multi-line paste, detach/reattach, narrow/NO_COLOR/Safe glyphs.npm run verifylocally: green when the machine is idle (an earlier run under heavy parallel load showed startup/service timeouts that pass 65/65 in isolation).Not in this PR
Paste batches → queue, queue conditions (#354, #355).