mirror of
https://github.com/zed-industries/zed.git
synced 2026-07-10 00:13:29 +00:00
# Objective Fix the agent `terminal` tool in headless eval environments. In the eval sandbox, terminal commands failed before the shell ran with `IOError: Not a tty (os error 25)` because PTY setup attempted to acquire a controlling terminal. ## Solution - Add a `terminal::HeadlessTerminal` global that is set by `eval_cli` only. - When headless mode is enabled, run terminal task commands as plain subprocesses with piped stdout/stderr instead of opening a PTY. - Pump subprocess output through the existing terminal emulator/event channel so output capture, completion, and task killing keep working. - Build ACP terminal commands non-interactively in headless mode. - Keep the normal editor terminal path unchanged when the global is unset. - Handle non-PTY output edge cases by preserving split CRLF sequences and avoiding an indefinite wait if subprocess exit-status polling errors. ## Testing - `cargo fmt --all` - `cargo test -p util non_interactive_omits_interactive_flag` - `cargo test -p terminal test_no_pty_task_terminal_captures_output` - `cargo test -p terminal test_convert_lf_to_crlf_preserves_split_crlf` - `cargo test -p terminal test_write_output` - `cargo check -p eval_cli` - `git --no-pager diff --check` ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed the agent terminal tool failing with "Not a tty" in headless/eval environments |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-APACHE | ||