Skip to content

Hold ambiguous program input for explicit recovery - #514

Draft
raiseCatError wants to merge 1 commit into
devfrom
fix/input-ownership-race-20261028
Draft

raiseCatError wants to merge 1 commit into
devfrom
fix/input-ownership-race-20261028

Conversation

@raiseCatError

@raiseCatError raiseCatError commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

An echo-visible ownership lookup can replay an immediate answer and Enter into command approval before a macOS line reader is recognizable. Keep ambiguous program submissions in an ownership hold with an explicit recovery choice. Echo controls presentation; it does not authorize sending.

  • Ctrl+S sends the capture once to the same live command. Tab/Ctrl+Q reviews without replaying Enter. Later likely/visible reports never approve the capture.
  • Completion invalidates delivery and keeps hidden prompt review; cancellation, terminal handover and shutdown clear pending captures. Existing approval entries never auto-send.
  • Parse real editor keys and NMSh actions before guarding replayed program Enter; preserve queue-review privacy across later hidden-reader reports. No detector, protocol, dependency or CI-gate change.

Refs #473. Separate from test-only PR #513, whose exact head and failed comprehensive gate remain untouched. No automatic merge or release.

Validation: full npm run verify passed locally with the intended truecolor profile and shortest compliant T7 test root. Fixed two-round/two-worker real-PTY stress passed with no lifecycle leftovers. Deterministic coverage includes unknown/older lookups, late likely/hidden inference, completion, cancellation, native handover, editor actions and ordering. Exact-head hosted CI: normal PR run40630119387 PASSED; single comprehensive run40630147755 FAILED macOS1/3 in browserConsoleChrome.test.ts:106. Its Mermaid-render result was neither success nor syntax; the actual code/reason was not logged, so causation remains unconfirmed. Other test/platform/timing/Fedora gates passed; aggregate checks correctly failed. No retry. This PR stays draft/unmerged until that independent blocker is understood and the required gate is satisfied. Controlled old/current-dev source fails both immediate/delayed approval-enqueue assertions; corrected source retains the real read and recovers exactly once after explicit Ctrl+S. Independent review findings are addressed. Physical Ghostty/Zed QA remains NOT RUN.

Manual validation on Ghostty and Zed: run a prompt-less zsh read and type an immediate answer; when held, Ctrl+S should deliver it once without queueing. Check hidden reads show no answer; sleep plus Enter remains held; Ctrl+Q reviews for queueing; Tab does not submit; Esc/Ctrl+C cancel; completion keeps review-only typing; Fish/native and fullscreen handover receive only their own new input.

Do not integrate #513 yet: preserve its exact head and failed comprehensive evidence. After this gate is understood/corrected, use a separately pinned integration candidate containing current dev, the reviewed correction and exact #513 head, then run the unchanged comprehensive gate once. A normal green rerun does not clear either failure.

Deferred resource investigation plan preserves all prior performance benefits, CPU/RSS costs and measurement limits; no memory optimization was started.

@raiseCatError

Copy link
Copy Markdown
Owner Author

Cross-reference from #541. I didn't change this branch.

This PR makes Enter during a command that isn't reading a hidden confirmation hold, which pulls the opposite way from Queue Mode. Before either merges, we should decide whether this PR is still needed with #541, and if so, how the two compose. I'd suggest rebasing it onto #541 and keeping the hold only when Queue Mode is off.

raiseCatError added a commit that referenced this pull request Nov 11, 2026
…input

An Enter pressed before NMSh can see that the running command reads (an echoing
terminal is no evidence, see #514) reaches the queue as a command, and in Queue
Mode without approval. The session service now holds every entry queued since
the command was submitted as soon as the command is first reported asking for
input, before any frontend hears of it, so the next dispatch can never overtake
the hold. Hidden input also hides the held text.

Adds a deterministic dispatcher test for a reader that ends right after it was
seen, and a live zsh test of #514's controlled race with Queue Mode on (the
fixture files are byte-identical copies of #514's).

Refs #426
Refs #473
raiseCatError added a commit that referenced this pull request Nov 11, 2026
Same resolution as verified on integration/20261111: #514's queue-review hints
and #541's program naming; tests updated where each assumed only its own
behaviour. #514 must merge first.

Refs #426
Refs #473
raiseCatError added a commit that referenced this pull request Nov 11, 2026
A standing "Enter queues" mode cannot be made safe: on macOS nothing reports
that a program reads with no prompt, so no setting can tell a reply from a
command, and it would weaken #514's boundary for every command.

Ctrl+Q on an empty line while a command runs now opens the queue composer for
that command only: each line entered in it is queued as typed, without approval,
until Esc, a second Ctrl+Q on the empty line, or the end of that command. Plain
Enter keeps #514's rules. Hidden input closes the composer before anything is
drawn: its first key is looked at like the composer's, and a request reported
while it is empty closes it. A line already begun in it stays a queued command.

Removes the Start in Queue Mode setting and /queue mode. The owner-side hold on
late-detected readers stays. Documents the remaining limit: a reader NMSh never
sees before it ends.

Refs #426
Refs #473

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant