eval_cli: Initialize themes in eval headless mode (#57139)

Also fix patch generation

Release Notes:

- N/A
This commit is contained in:
Ben Brandt 2026-05-19 13:29:00 +02:00 committed by GitHub
parent 85f410004c
commit 4557ad7ad1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 4 deletions

2
Cargo.lock generated
View file

@ -5964,6 +5964,8 @@ dependencies = [
"settings", "settings",
"shellexpand", "shellexpand",
"terminal_view", "terminal_view",
"theme",
"theme_settings",
"util", "util",
"watch", "watch",
] ]

View file

@ -47,5 +47,7 @@ serde_json.workspace = true
settings.workspace = true settings.workspace = true
shellexpand.workspace = true shellexpand.workspace = true
terminal_view.workspace = true terminal_view.workspace = true
theme.workspace = true
theme_settings.workspace = true
util.workspace = true util.workspace = true
watch.workspace = true watch.workspace = true

View file

@ -40,6 +40,7 @@ pub fn init(cx: &mut App) -> Arc<AgentCliAppState> {
let settings_store = SettingsStore::new(cx, &settings::default_settings()); let settings_store = SettingsStore::new(cx, &settings::default_settings());
cx.set_global(settings_store); cx.set_global(settings_store);
theme_settings::init(theme::LoadThemes::JustBase, cx);
let user_agent = format!( let user_agent = format!(
"Zed Agent CLI/{} ({}; {})", "Zed Agent CLI/{} ({}; {})",

View file

@ -443,16 +443,21 @@ class ZedAgent(BaseInstalledAgent):
env=env, env=env,
) )
# Only generate a patch if the workdir is a git repo # Only generate a patch if the workdir is a git repo with a valid HEAD
# (SWE-bench style). Terminal-bench containers aren't git repos. # (SWE-bench style). Terminal-bench containers aren't git repos, and
# some harnesses mount an initialized repo before creating the first commit.
await self.exec_as_agent( await self.exec_as_agent(
environment, environment,
command=( command=(
'if [ -d ".git" ]; then ' "if git rev-parse --git-dir >/dev/null 2>&1; then "
"git add -A && " "git add -A && "
"git diff --cached HEAD > /logs/agent/patch.diff && " "if git rev-parse --verify HEAD >/dev/null 2>&1; then "
"git diff --cached HEAD -- > /logs/agent/patch.diff && "
'echo "Patch size: $(wc -c < /logs/agent/patch.diff) bytes"; ' 'echo "Patch size: $(wc -c < /logs/agent/patch.diff) bytes"; '
"else " "else "
'echo "Git repo has no valid HEAD, skipping patch generation"; '
"fi; "
"else "
'echo "No git repo found, skipping patch generation"; ' 'echo "No git repo found, skipping patch generation"; '
"fi" "fi"
), ),