Get terminal tool working in evals (#29831)

Bypass our terminal subsystem and just run a shell in a pty.

- [x] make sure we use the same working directory
- [x] strip control chars from the pty output (?)
- [x] tests

Release Notes:

- N/A
This commit is contained in:
Cole Miller 2025-05-05 08:07:43 -04:00 committed by GitHub
parent ce053c9bff
commit b404024c7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 287 additions and 29 deletions

74
Cargo.lock generated
View file

@ -736,6 +736,8 @@ dependencies = [
"language_models",
"linkme",
"open",
"paths",
"portable-pty",
"pretty_assertions",
"project",
"rand 0.8.5",
@ -762,6 +764,7 @@ dependencies = [
"workspace",
"workspace-hack",
"zed_llm_client",
"zlog",
]
[[package]]
@ -3991,7 +3994,7 @@ version = "3.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "697b5419f348fd5ae2478e8018cb016c00a5881c7f46c717de98ffd135a5651c"
dependencies = [
"nix",
"nix 0.29.0",
"windows-sys 0.59.0",
]
@ -9076,6 +9079,18 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
[[package]]
name = "nix"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
"bitflags 2.9.0",
"cfg-if",
"cfg_aliases 0.1.1",
"libc",
]
[[package]]
name = "nix"
version = "0.29.0"
@ -10899,6 +10914,27 @@ dependencies = [
"portable-atomic",
]
[[package]]
name = "portable-pty"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4a596a2b3d2752d94f51fac2d4a96737b8705dddd311a32b9af47211f08671e"
dependencies = [
"anyhow",
"bitflags 1.3.2",
"downcast-rs",
"filedescriptor",
"lazy_static",
"libc",
"log",
"nix 0.28.0",
"serial2",
"shared_library",
"shell-words",
"winapi",
"winreg 0.10.1",
]
[[package]]
name = "postage"
version = "0.5.0"
@ -13310,6 +13346,17 @@ dependencies = [
"serde",
]
[[package]]
name = "serial2"
version = "0.2.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7d1d08630509d69f90eff4afcd02c3bd974d979225cbd815ff5942351b14375"
dependencies = [
"cfg-if",
"libc",
"winapi",
]
[[package]]
name = "session"
version = "0.1.0"
@ -13410,6 +13457,16 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "shared_library"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11"
dependencies = [
"lazy_static",
"libc",
]
[[package]]
name = "shell-words"
version = "1.1.0"
@ -17764,6 +17821,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
[[package]]
name = "winreg"
version = "0.50.0"
@ -18216,7 +18282,7 @@ dependencies = [
"miniz_oxide",
"mio",
"naga",
"nix",
"nix 0.29.0",
"nom",
"num-bigint",
"num-bigint-dig",
@ -18593,7 +18659,7 @@ dependencies = [
"futures-core",
"futures-lite 2.6.0",
"hex",
"nix",
"nix 0.29.0",
"ordered-stream",
"serde",
"serde_repr",
@ -18706,7 +18772,7 @@ dependencies = [
"menu",
"migrator",
"mimalloc",
"nix",
"nix 0.29.0",
"node_runtime",
"notifications",
"outline",