Skip to content

Terminal emulator does not send PtyWrite responses back to PTY (breaks fish shell DA1 query) #77

@Crempa

Description

@Crempa

Summary

The terminal emulator silently discards Event::PtyWrite events from alacritty's VTE engine, which means terminal query responses (DA1, device status, keyboard mode, text area size) are never written back to the PTY. This causes fish shell to display a 2-second startup warning and disable optional features.

Steps to reproduce

  1. Set $SHELL to fish (or set embedded_shell = "/usr/bin/fish" in ~/.config/arbor/config.toml)
  2. Open an embedded terminal in Arbor
  3. Observe the warning:
warning: fish could not read response to Primary Device Attribute query after waiting for 2 seconds.
This is often due to a missing feature in your terminal. See 'help terminal-compatibility' or
'man fish-terminal-compatibility'. This fish process will no longer wait for outstanding queries,
which disables some optional features.

Root cause

When a shell sends a DA1 query (\ESC[c), alacritty's identify_terminal() generates the response \x1b[?6c and emits it as Event::PtyWrite(text) via the EventListener trait.

However, AlacrittyEventListener in alacritty_support.rs only handles Event::Bell and ignores all other events:

impl EventListener for AlacrittyEventListener {
    fn send_event(&self, event: Event) {
        if matches!(event, Event::Bell) {
            self.bell_count.fetch_add(1, Ordering::Relaxed);
        }
    }
}

There is no mechanism to route PtyWrite data back to the PTY master writer. The response is silently dropped.

Affected terminal queries

All responses routed through Event::PtyWrite are lost:

  • DA1 (Primary Device Attributes) — \ESC[c\x1b[?6c
  • DA2 (Secondary Device Attributes) — \ESC[>c
  • Device status\ESC[5n, \ESC[6n (cursor position report)
  • Keyboard mode report\ESC[?{mode}u
  • Text area size\ESC[8;{rows};{cols}t
  • DECRPM (mode report) — \ESC[?{mode};{state}$y

Impact

  • fish shell: visible warning, 2-second startup delay, disabled optional features
  • zsh/bash: silent degradation (cursor position reports, prompt reflow after resize may not work correctly)
  • TUI apps: any program relying on terminal capability queries may behave unexpectedly

Suggested fix

AlacrittyEventListener needs a shared reference to the PTY writer (Arc<Mutex<Box<dyn Write + Send>>>) so it can handle Event::PtyWrite by writing the response bytes back to the PTY master. This needs to be wired up in both terminal_backend.rs (GUI) and terminal_daemon.rs (httpd).

Workaround

Set a shell that doesn't depend on DA1 responses in ~/.config/arbor/config.toml:

embedded_shell = "/bin/zsh"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions