Repository navigation
Conversation
…aches A plain shell has no shell-ready barrier, so a DA1 sent before any client attaches is buffered and later replayed with replies suppressed. Fish then stalls 10s and warns. Reuse the startup DA1 responder until the first attach.
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c39bf8e7-34ea-47fd-8dd4-86123a19e665
📒 Files selected for processing: 3
src/main/daemon/session-shell-ready-barrier.tssrc/main/daemon/session.test.tssrc/main/daemon/session.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…st DA1 The daemon stream client attaches when the session is created, so releasing on the first attach removed the responder before the shell ran. Fish still stalled 10 s. Release after the first answered DA1 instead, or after the 15 s startup window.
|
Correction: the first revision had no effect in the app.
A new Known trade-off: during the 15 s window, an ungated bash or zsh shell also gets its DA1 answered by the daemon. The reply is the same text the renderer sends ( |
fish sends a second blocking DA1 right after the first is answered, and again on every resize and prompt. Releasing DA1 authority after the first answer left that second query to a renderer that may not exist yet, so a background fish still waited 10 s. Keep answering until the client writes input, which only a live renderer or a user does.
|
New revision (
Fish uses DA1 as a barrier more often than I assumed. It sends The same stall also happens later in a session. On a browser client against an |
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b6750ca0-d1dd-4407-bc86-d710a1bb26b7
Files selected for processing: 4-
src/main/daemon/session-shell-ready-barrier.tssrc/main/daemon/session.test.tssrc/main/daemon/session.tssrc/main/daemon/terminal-host.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
|
Thank you, @bengry, for both the report and this PR. Your measurements made the race easy to see: the warning only shows up when the view attaches late, and the DA1 query fish sends gets no answer from anyone. We went with a different fix, in #33273, and are closing this one in favor of it. Running real fish against a windowless We didn't take code from this PR, but your diagnosis shaped the fix, so the commit credits you as a co-author. Thanks again! |
ELI5
When fish starts, it asks the terminal "what are you?" and waits for an answer. It asks twice in a row, and also after each resize and each command. If no Orca window is showing the terminal yet, nobody answers. Fish then ignores all input, Ctrl+D included, for 10 seconds and prints a warning. Now the daemon answers until the first input reaches the terminal, which shows that a window is live.
What Changed
replay-guard.ts). Fish waits 10 s and warns.SessionShellReadyBarrierinstalls the existing startup DA1 responder and filter. It answersESC[?1;2c, the renderer's own reply, and drops the query from recorded output. It releases them on the first client input (Session.write→noteClientInput()), after the existing 15 s timeout, and on every existing exit path. From then on the renderer answers as before.session.tsgets 1 line. The existing "does not reply to terminal queries" test now attaches a client first, because the daemon answers before the first attach.Why
The daemon already owns DA1 during startup for gated shells. This extends the same authority, with the same response and filter, to the one window where no renderer can answer. I rejected two alternatives:
4to its DA1 reply when inline images are on (terminal-capability-replies.ts).Why only fish
Orca drops the late query for every shell, but only fish waits on it. At startup, fish 4.x sends a batch of terminal queries, and DA1 marks the end of the batch. Fish waits up to 10 s for the DA1 reply. In the probe, fish sent
ESC[?u(kitty keyboard),ESC[>0q(XTVERSION) andESCP+q696e646e(XTGETTCAPindn), then DA1.Prompt themes or plugins in bash or zsh can send their own queries, but they usually don't block. This PR covers only DA1, so those other queries are still unanswered before the first input. I did not run the probe with bash or zsh.
Linked Issue
Fixes #32944
Visual Proof
N/A. There is no UI change. The fix removes a 10 s stall and a warning printed by fish. The before and after numbers are under Testing.
Testing
Tested on Linux only. Real fish 4.9.3 (
fish --no-config -i) in a raw PTY, timing a command sent at 0.5 s:The same probe shows fish sending
ESC[6n,OSC 11 ?and then DA1 as a barrier on every resize and after every command.For the first revision (release on attach) I also ran a throwaway probe, not committed: real fish through
Session, with a client that answers DA1 seen live and never in replayed bytes, like the renderer. 28 shells per run, 3 rounds. Each value is warnings per 12 shells:Other checks:
session.test.tsandterminal-host.test.ts: the DA1 tests now send 2 queries before any input and expect both answered, then expect the next query to reach the client after input. Both fail on the previous revision and pass now.pnpm tc:nodepasses.oxlintandoxfmt --checkpass on the changed files.src/main/daemonsuite: 21 or 22 real-shell tests fail on my machine, the same tests with and without this change, from my local zsh/bash setup. The files areshell-ready,shell-ready-bash-wrapper,repro-13767,bash-prompt-command-compositionanddaemon-stream-backpressure-socket.I manually tested these changes locally. I tested through the probe above, not in the packaged app.
Automated tests added/updated, or explained why not below
AI Disclosure
Root-cause analysis, the fix and the tests were done with Claude Code (Claude Opus 5.5 and Sonnet 5.5). I reviewed them.
Review
Agent skill upstream boundary
Notes
Not covered: a resize or prompt while a renderer is briefly detached later in the session (for example while a paired client reconnects). The daemon cannot see that detach; fixing it needs the runtime layer that knows its viewers.
Edge: a write from main itself, such as an injected startup command, also counts as input and hands DA1 back early. That is no worse than before.
Security: the daemon writes a fixed 7-byte reply to the PTY only for DA1 queries before the first client input.
SSH and remote: this helps slow remote attaches.
Windows: excluded.
Performance: one CSI handler for the pre-attach window.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred). I ran typecheck and lint on the changed files, plus the daemon tests. The rest is left to CI.