Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

feat: per-command log files for background hooks (#1934)

Maximilian Roose5665a87af3b
diff --git a/src/commands/handle_switch.rs b/src/commands/handle_switch.rs
index be2dba414..3b96a1b8a 100644
--- a/src/commands/handle_switch.rs
+++ b/src/commands/handle_switch.rs
@@ -237,27 +237,25 @@ pub(crate) fn spawn_switch_background_hooks(
) -> anyhow::Result<()> {
let ctx = CommandContext::new(repo, config, branch, result.path(), yes);
- for steps in super::hooks::prepare_background_hooks(
+ let mut all_groups: Vec<Vec<super::hooks::SourcedStep>> = Vec::new();
+
+ all_groups.extend(super::hooks::prepare_background_hooks(
&ctx,
HookType::PostSwitch,
extra_vars,
hooks_display_path,
- )? {
- super::hooks::spawn_hook_pipeline(&ctx, steps)?;
- }
+ )?);
if matches!(result, SwitchResult::Created { .. }) {
- for steps in super::hooks::prepare_background_hooks(
+ all_groups.extend(super::hooks::prepare_background_hooks(
&ctx,
HookType::PostStart,
extra_vars,
hooks_display_path,
- )? {
- super::hooks::spawn_hook_pipeline(&ctx, steps)?;
- }
+ )?);
}
- Ok(())
+ super::hooks::announce_and_spawn_background_hooks(&ctx, all_groups)
}
/// Handle the switch command.
diff --git a/src/commands/hook_filter.rs b/src/commands/hook_filter.rs
index e7b0d0e64..da32be5a0 100644
--- a/src/commands/hook_filter.rs
+++ b/src/commands/hook_filter.rs
@@ -8,7 +8,18 @@
///
/// Approval for project hooks is handled at the gate (command entry point),
/// not during hook execution.
-#[derive(Clone, Copy, Debug, PartialEq, Eq, strum::Display, strum::EnumString)]
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ PartialEq,
+ Eq,
+ serde::Serialize,
+ serde::Deserialize,
+ strum::Display,
+ strum::EnumString,
+)]
+#[serde(rename_all = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub enum HookSource {
/// User hooks from ~/.config/worktrunk/config.toml (no approval required)
diff --git a/src/commands/hooks.rs b/src/commands/hooks.rs
index 5d225163d..0999bec90 100644
--- a/src/commands/hooks.rs
+++ b/src/commands/hooks.rs
@@ -178,8 +178,6 @@ pub struct SourcedStep {
/// - Multiple unnamed steps from the same source repeat the label (`user → user`)
/// - Source prefix was dropped for named steps (`user:bg` → `bg`) — less
/// informative when both user and project hooks are present
-/// - Combined hook-type messages were split (`post-switch: X; post-start: Y`
-/// → two separate lines) — more verbose for the common create case
fn format_pipeline_summary(steps: &[SourcedStep]) -> String {
let mut parts = Vec::new();
for step in steps {
@@ -204,26 +202,74 @@ fn format_pipeline_summary(steps: &[SourcedStep]) -> String {
parts.join(" → ")
}
-/// Spawn a hook pipeline as a background `wt hook run-pipeline` process.
+/// Announce and spawn background hooks for one or more hook types.
///
-/// Serializes the pipeline steps to JSON and spawns `wt hook run-pipeline`
-/// as a detached process, piping the spec to stdin. The background
-/// process expands templates just-in-time and executes each step via
-/// the detected shell.
+/// Displays a single combined summary line covering all hook types, then
+/// spawns each source group as an independent pipeline. Use this instead
+/// of calling `spawn_hook_pipeline` directly when multiple hook types
+/// fire together (e.g., post-switch + post-start on create).
///
-/// Used for all post-* background hooks regardless of config format.
-pub fn spawn_hook_pipeline(ctx: &CommandContext, steps: Vec<SourcedStep>) -> anyhow::Result<()> {
- use super::pipeline_spec::{PipelineCommandSpec, PipelineSpec, PipelineStepSpec};
+/// Example output: `Running post-switch: zellij-tab; post-start: deps, assets, docs`
+pub fn announce_and_spawn_background_hooks(
+ ctx: &CommandContext,
+ groups: Vec<Vec<SourcedStep>>,
+) -> anyhow::Result<()> {
+ if groups.iter().all(|g| g.is_empty()) {
+ return Ok(());
+ }
+
+ // Build combined summary, merging groups with the same hook type:
+ // "post-switch: zellij-tab; post-start: deps, assets, docs"
+ let display_path = groups
+ .iter()
+ .flat_map(|g| g.iter())
+ .find_map(|s| s.display_path.as_ref());
+
+ // Merge summaries by hook type so user+project for the same type
+ // shows "post-start: user_bg, project" not "post-start: user_bg; post-start: project".
+ let mut type_summaries: Vec<(HookType, Vec<String>)> = Vec::new();
+ for group in &groups {
+ let hook_type = group[0].hook_type;
+ let summary = format_pipeline_summary(group);
+ if let Some(entry) = type_summaries.iter_mut().find(|(ht, _)| *ht == hook_type) {
+ entry.1.push(summary);
+ } else {
+ type_summaries.push((hook_type, vec![summary]));
+ }
+ }
+
+ let combined: String = type_summaries
+ .iter()
+ .map(|(ht, summaries)| format!("{ht}: {}", summaries.join(", ")))
+ .collect::<Vec<_>>()
+ .join("; ");
+ let message = match display_path {
+ Some(path) => {
+ let path_display = format_path_for_display(path);
+ cformat!("Running {combined} @ <bold>{path_display}</>")
+ }
+ None => format!("Running {combined}"),
+ };
+ eprintln!("{}", progress_message(message));
+ for group in groups {
+ spawn_hook_pipeline_quiet(ctx, group)?;
+ }
+
+ Ok(())
+}
+
+/// Spawn a hook pipeline as a background `wt hook run-pipeline` process.
+///
+/// Displays a summary line and spawns the pipeline. For multiple hook types
+/// that should share a single display line, use `announce_and_spawn_background_hooks`.
+pub fn spawn_hook_pipeline(ctx: &CommandContext, steps: Vec<SourcedStep>) -> anyhow::Result<()> {
if steps.is_empty() {
return Ok(());
}
let hook_type = steps[0].hook_type;
- let source = steps[0].source;
let display_path = steps[0].display_path.as_ref();
-
- // Show summary: "Running post-start: install → build, lint"
let summary = format_pipeline_summary(&steps);
let message = match display_path {
Some(path) => {
@@ -234,6 +280,18 @@ pub fn spawn_hook_pipeline(ctx: &CommandContext, steps: Vec<SourcedStep>) -> any
};
eprintln!("{}", progress_message(message));
+ spawn_hook_pipeline_quiet(ctx, steps)
+}
+
+/// Spawn a hook pipeline without displaying a summary line.
+///
+/// Used by `announce_and_spawn_background_hooks` which handles display separately.
+fn spawn_hook_pipeline_quiet(ctx: &CommandContext, steps: Vec<SourcedStep>) -> anyhow::Result<()> {
+ use super::pipeline_spec::{PipelineCommandSpec, PipelineSpec, PipelineStepSpec};
+
+ let hook_type = steps[0].hook_type;
+ let source = steps[0].source;
+
// Extract base context from the first command. All steps share the same base context,
// but per-step metadata (hook_name) is stripped — it gets injected per-step by the
// background runner.
@@ -272,18 +330,19 @@ pub fn spawn_hook_pipeline(ctx: &CommandContext, steps: Vec<SourcedStep>) -> any
let spec = PipelineSpec {
worktree_path: ctx.worktree_path.to_path_buf(),
branch: ctx.branch_or_head().to_string(),
- hook_type: hook_type.to_string(),
- source: source.to_string(),
+ hook_type,
+ source,
context,
steps: spec_steps,
+ log_dir: ctx.repo.wt_logs_dir(),
};
let spec_json = serde_json::to_vec(&spec).context("failed to serialize pipeline spec")?;
let wt_bin = std::env::current_exe().context("failed to resolve wt binary path")?;
- let hook_log = HookLog::hook(source, hook_type, "pipeline");
- let log_label = format!("{hook_type} {source} pipeline");
+ let hook_log = HookLog::hook(source, hook_type, "runner");
+ let log_label = format!("{hook_type} {source} runner");
if let Err(err) = spawn_detached_exec(
ctx.repo,
diff --git a/src/commands/pipeline_spec.rs b/src/commands/pipeline_spec.rs
index 41b2b39dd..fd60b031c 100644
--- a/src/commands/pipeline_spec.rs
+++ b/src/commands/pipeline_spec.rs
@@ -2,6 +2,10 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::PathBuf;
+use worktrunk::HookType;
+
+use super::hook_filter::HookSource;
+
/// Serialized specification for a background pipeline.
///
/// Serialized to JSON and piped to stdin of `wt hook run-pipeline`.
@@ -11,11 +15,16 @@ use std::path::PathBuf;
pub struct PipelineSpec {
pub worktree_path: PathBuf,
pub branch: String,
- pub hook_type: String,
- pub source: String,
+ pub hook_type: HookType,
+ pub source: HookSource,
/// Base context variables for template expansion.
pub context: HashMap<String, String>,
pub steps: Vec<PipelineStepSpec>,
+ /// Directory for per-command log files.
+ ///
+ /// The pipeline runner creates one log file per command here,
+ /// named via `HookLog::hook(source, hook_type, name)`.
+ pub log_dir: PathBuf,
}
#[derive(Serialize, Deserialize)]
@@ -44,11 +53,12 @@ mod tests {
let spec = PipelineSpec {
worktree_path: "/tmp/test-worktree".into(),
branch: "feature/auth".into(),
- hook_type: "post-start".into(),
- source: "user".into(),
+ hook_type: HookType::PostStart,
+ source: HookSource::User,
context: [("branch".into(), "feature/auth".into())]
.into_iter()
.collect(),
+ log_dir: "/tmp/test-worktree/.git/wt/logs".into(),
steps: vec![
PipelineStepSpec::Single {
name: Some("install".into()),
diff --git a/src/commands/run_pipeline.rs b/src/commands/run_pipeline.rs
index 97cfb8c16..f00c2cc44 100644
--- a/src/commands/run_pipeline.rs
+++ b/src/commands/run_pipeline.rs
@@ -12,7 +12,7 @@
//! 2. Open a [`Repository`] from the worktree path in the spec.
//! 3. Walk steps in order. For each step, expand templates and spawn shell
//! children (see Execution model). Abort on the first serial step failure.
-//! 4. Exit. The log file in `.git/wt/logs/` is the only artifact.
+//! 4. Exit. Log files in `.git/wt/logs/` are the only artifacts.
//!
//! ## Execution model
//!
@@ -53,6 +53,7 @@
//! since the expanded string is passed to a shell for interpretation.
use std::collections::HashMap;
+use std::fs;
use std::io::Read as _;
use std::path::Path;
use std::process::{Child, Stdio};
@@ -64,12 +65,17 @@ use worktrunk::git::Repository;
use worktrunk::shell_exec::ShellConfig;
use super::pipeline_spec::{PipelineSpec, PipelineStepSpec};
+use super::process::HookLog;
/// Run a serialized pipeline from stdin.
///
/// This is the entry point for `wt hook run-pipeline`.
/// The orchestrator is a long-lived background process spawned by
/// `spawn_detached_exec`; stdout/stderr are already redirected to a log file.
+///
+/// Each command's output is written to its own log file in `spec.log_dir`,
+/// named `{branch}-{source}-{hook_type}-{name}.log`. The runner process's
+/// own stdout/stderr captures only runner-level errors.
pub fn run_pipeline() -> anyhow::Result<()> {
let mut contents = String::new();
std::io::stdin()
@@ -82,12 +88,20 @@ pub fn run_pipeline() -> anyhow::Result<()> {
let repo =
Repository::at(&spec.worktree_path).context("failed to open repository for pipeline")?;
+ fs::create_dir_all(&spec.log_dir)
+ .with_context(|| format!("failed to create log directory: {}", spec.log_dir.display()))?;
+
+ let mut cmd_index = 0usize;
+
for step in &spec.steps {
match step {
PipelineStepSpec::Single { template, name } => {
+ let log_name = command_log_name(name.as_deref(), cmd_index);
+ let log_file = create_command_log(&spec, &log_name)?;
let expanded = expand_now(template, &spec, &repo, name.as_deref())?;
let step_json = build_step_context_json(&spec.context, name.as_deref())?;
- let mut child = spawn_shell_command(&expanded, &spec.worktree_path, &step_json)?;
+ let mut child =
+ spawn_shell_command(&expanded, &spec.worktree_path, &step_json, log_file)?;
let status = child.wait().context("failed to wait for child process")?;
if !status.success() {
bail!(
@@ -96,9 +110,10 @@ pub fn run_pipeline() -> anyhow::Result<()> {
expanded,
);
}
+ cmd_index += 1;
}
PipelineStepSpec::Concurrent { commands } => {
- run_concurrent_group(commands, &spec, &repo)?;
+ run_concurrent_group(commands, &spec, &repo, &mut cmd_index)?;
}
}
}
@@ -133,17 +148,25 @@ fn expand_now(
/// Spawn a shell command with context JSON piped to stdin.
///
/// Uses `ShellConfig` for portable shell detection (Git Bash on Windows,
-/// `sh` on Unix). Returns the `Child` so the caller controls when to wait.
+/// `sh` on Unix). stdout/stderr are redirected to `log_file` so each
+/// command gets its own log. Returns the `Child` so the caller controls
+/// when to wait.
fn spawn_shell_command(
expanded: &str,
worktree_path: &Path,
context_json: &str,
+ log_file: fs::File,
) -> anyhow::Result<Child> {
let shell = ShellConfig::get()?;
+ let log_err = log_file
+ .try_clone()
+ .context("failed to clone log file handle")?;
let mut child = shell
.command(expanded)
.current_dir(worktree_path)
.stdin(Stdio::piped())
+ .stdout(Stdio::from(log_file))
+ .stderr(Stdio::from(log_err))
.spawn()
.with_context(|| format!("failed to spawn: {expanded}"))?;
@@ -162,14 +185,18 @@ fn run_concurrent_group(
commands: &[super::pipeline_spec::PipelineCommandSpec],
spec: &PipelineSpec,
repo: &Repository,
+ cmd_index: &mut usize,
) -> anyhow::Result<()> {
let mut children = Vec::with_capacity(commands.len());
for cmd in commands {
+ let log_name = command_log_name(cmd.name.as_deref(), *cmd_index);
+ let log_file = create_command_log(spec, &log_name)?;
let expanded = expand_now(&cmd.template, spec, repo, cmd.name.as_deref())?;
let cmd_json = build_step_context_json(&spec.context, cmd.name.as_deref())?;
- let child = spawn_shell_command(&expanded, &spec.worktree_path, &cmd_json)?;
+ let child = spawn_shell_command(&expanded, &spec.worktree_path, &cmd_json, log_file)?;
children.push((cmd.name.clone(), expanded, child));
+ *cmd_index += 1;
}
let mut failures = Vec::new();
@@ -207,6 +234,26 @@ fn build_step_context_json(
}
}
+/// Derive the log file name for a command.
+///
+/// Named commands use their name; unnamed commands use `cmd-{index}`.
+fn command_log_name(name: Option<&str>, index: usize) -> String {
+ match name {
+ Some(n) => n.to_string(),
+ None => format!("cmd-{index}"),
+ }
+}
+
+/// Create a per-command log file in the spec's log directory.
+///
+/// Caller must ensure `spec.log_dir` exists (created once at pipeline startup).
+fn create_command_log(spec: &PipelineSpec, name: &str) -> anyhow::Result<fs::File> {
+ let hook_log = HookLog::hook(spec.source, spec.hook_type, name);
+ let path = hook_log.path(&spec.log_dir, &spec.branch);
+ fs::File::create(&path)
+ .with_context(|| format!("failed to create log file: {}", path.display()))
+}
+
fn format_exit(code: Option<i32>) -> String {
code.map_or("signal".to_string(), |c| format!("exit code {c}"))
}
diff --git a/src/git/mod.rs b/src/git/mod.rs
index 127973f7b..fa8fec03b 100644
--- a/src/git/mod.rs
+++ b/src/git/mod.rs
@@ -369,10 +369,13 @@ pub fn branch_tracks_ref(
PartialEq,
Eq,
clap::ValueEnum,
+ serde::Serialize,
+ serde::Deserialize,
strum::Display,
strum::EnumString,
strum::EnumIter,
)]
+#[serde(rename_all = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub enum HookType {
PreSwitch,
diff --git a/tests/integration_tests/post_start_commands.rs b/tests/integration_tests/post_start_commands.rs
index 535a3b8b8..22f73ce0c 100644
--- a/tests/integration_tests/post_start_commands.rs
+++ b/tests/integration_tests/post_start_commands.rs
@@ -897,28 +897,25 @@ approved-commands = ["echo 'stdout output' && echo 'stderr output' >&2"]
let worktree_path = repo.root_path().parent().unwrap().join("repo.feature");
let git_common_dir = resolve_git_common_dir(&worktree_path);
let log_dir = git_common_dir.join("wt/logs");
- wait_for_file_count(&log_dir, "log", 1);
+ // 2 log files: runner log + per-command log (cmd-0, unnamed single command)
+ wait_for_file_count(&log_dir, "log", 2);
- // Find the log file
- let log_files: Vec<_> = fs::read_dir(&log_dir)
+ // Find the command log file (contains "cmd-0" in name, not "runner")
+ let cmd_log = fs::read_dir(&log_dir)
.unwrap()
.filter_map(|e| e.ok())
.map(|e| e.path())
- .filter(|p| p.extension().and_then(|s| s.to_str()) == Some("log"))
- .collect();
-
- assert_eq!(
- log_files.len(),
- 1,
- "Should have exactly one log file, found: {:?}",
- log_files
- );
+ .find(|p| {
+ p.file_name()
+ .and_then(|n| n.to_str())
+ .is_some_and(|n| n.contains("cmd-0"))
+ })
+ .expect("Should have a cmd-0 log file");
// Wait for content to be written (background command might still be writing)
- let log_file = &log_files[0];
- wait_for_file_content(log_file);
+ wait_for_file_content(&cmd_log);
- let log_contents = fs::read_to_string(log_file).unwrap();
+ let log_contents = fs::read_to_string(&cmd_log).unwrap();
// Verify both stdout and stderr were captured
assert_snapshot!(log_contents, @"
@@ -982,35 +979,34 @@ approved-commands = [
snapshot_switch("post_start_separate_logs", &repo, &["--create", "feature"]);
- // Map configs run as a concurrent group in one pipeline runner process,
- // producing a single log file. Wait for it and verify all outputs are present.
+ // Each command gets its own log file (task1, task2, task3) plus one runner log.
let worktree_path = repo.root_path().parent().unwrap().join("repo.feature");
let git_common_dir = resolve_git_common_dir(&worktree_path);
let log_dir = git_common_dir.join("wt/logs");
- wait_for_file_count(&log_dir, "log", 1);
-
- let log_file = fs::read_dir(&log_dir)
- .unwrap()
- .filter_map(|e| e.ok())
- .find(|e| e.path().extension().and_then(|s| s.to_str()) == Some("log"))
- .expect("should have one log file");
-
- // Poll for all outputs — concurrent commands may flush at different times.
- let start = std::time::Instant::now();
- let timeout = std::time::Duration::from_secs(15);
- loop {
- let contents = fs::read_to_string(log_file.path()).unwrap_or_default();
- if contents.contains("TASK1_OUTPUT")
- && contents.contains("TASK2_OUTPUT")
- && contents.contains("TASK3_OUTPUT")
- {
- break;
- }
+ wait_for_file_count(&log_dir, "log", 4);
+
+ // Verify each task's output is in its own log file.
+ for (task, expected) in [
+ ("task1", "TASK1_OUTPUT"),
+ ("task2", "TASK2_OUTPUT"),
+ ("task3", "TASK3_OUTPUT"),
+ ] {
+ let log_file = fs::read_dir(&log_dir)
+ .unwrap()
+ .filter_map(|e| e.ok())
+ .find(|e| {
+ e.file_name()
+ .to_string_lossy()
+ .contains(&format!("post-start-{task}"))
+ })
+ .unwrap_or_else(|| panic!("should have log file for {task}"));
+
+ wait_for_file_content(&log_file.path());
+ let contents = fs::read_to_string(log_file.path()).unwrap();
assert!(
- start.elapsed() < timeout,
- "Timed out waiting for all outputs in log. Got: {contents}"
+ contents.contains(expected),
+ "Log for {task} should contain {expected}, got: {contents}"
);
- std::thread::sleep(std::time::Duration::from_millis(50));
}
}
diff --git a/tests/integration_tests/user_hooks.rs b/tests/integration_tests/user_hooks.rs
index 5804329ef..6242a2822 100644
--- a/tests/integration_tests/user_hooks.rs
+++ b/tests/integration_tests/user_hooks.rs
@@ -1516,20 +1516,20 @@ fn test_concurrent_hook_single_failure(repo: TestRepo) {
"wt hook post-start should succeed (spawns in background)"
);
- // Wait for log file to be created and contain output
+ // Wait for log files: runner log + per-command log (cmd-0, unnamed single command)
let log_dir = resolve_git_common_dir(repo.root_path()).join("wt/logs");
- wait_for_file_count(&log_dir, "log", 1);
+ wait_for_file_count(&log_dir, "log", 2);
- // Find and read the log file
- let log_file = fs::read_dir(&log_dir)
+ // Find the command log file (contains "cmd-0" in name)
+ let cmd_log = fs::read_dir(&log_dir)
.unwrap()
.filter_map(|e| e.ok())
- .find(|e| e.path().extension().is_some_and(|ext| ext == "log"))
- .expect("Should have a log file");
+ .find(|e| e.file_name().to_string_lossy().contains("cmd-0"))
+ .expect("Should have a cmd-0 log file");
// Wait for content to be written (command runs async)
- wait_for_file_content(&log_file.path());
- let log_content = fs::read_to_string(log_file.path()).unwrap();
+ wait_for_file_content(&cmd_log.path());
+ let log_content = fs::read_to_string(cmd_log.path()).unwrap();
// Verify the hook actually ran and wrote output (not just that file was created)
assert!(
@@ -1542,7 +1542,7 @@ fn test_concurrent_hook_single_failure(repo: TestRepo) {
fn test_concurrent_hook_multiple_failures(repo: TestRepo) {
// Write project config with multiple named hooks (table format).
// Map configs run as a concurrent group in one pipeline runner,
- // producing a single log file with all outputs.
+ // each command producing its own log file.
repo.write_project_config(
r#"[post-start]
first = "echo FIRST_OUTPUT"
@@ -1562,29 +1562,28 @@ second = "echo SECOND_OUTPUT"
"wt hook post-start should succeed (spawns in background)"
);
- // Wait for the pipeline log file to be created
+ // Wait for per-command log files: runner log + first + second
let log_dir = resolve_git_common_dir(repo.root_path()).join("wt/logs");
- wait_for_file_count(&log_dir, "log", 1);
-
- let log_file = fs::read_dir(&log_dir)
- .unwrap()
- .filter_map(|e| e.ok())
- .find(|e| e.path().extension().is_some_and(|ext| ext == "log"))
- .expect("Should have a log file");
-
- // Poll for both outputs — concurrent commands may flush at different times.
- let start = std::time::Instant::now();
- let timeout = std::time::Duration::from_secs(15);
- loop {
- let content = fs::read_to_string(log_file.path()).unwrap_or_default();
- if content.contains("FIRST_OUTPUT") && content.contains("SECOND_OUTPUT") {
- break;
- }
+ wait_for_file_count(&log_dir, "log", 3);
+
+ // Verify each command's output is in its own log file
+ for (task, expected) in [("first", "FIRST_OUTPUT"), ("second", "SECOND_OUTPUT")] {
+ let log_file = fs::read_dir(&log_dir)
+ .unwrap()
+ .filter_map(|e| e.ok())
+ .find(|e| {
+ e.file_name()
+ .to_string_lossy()
+ .contains(&format!("post-start-{task}"))
+ })
+ .unwrap_or_else(|| panic!("should have log file for {task}"));
+
+ wait_for_file_content(&log_file.path());
+ let content = fs::read_to_string(log_file.path()).unwrap();
assert!(
- start.elapsed() < timeout,
- "Timed out waiting for both outputs in log. Got: {content}"
+ content.contains(expected),
+ "Log for {task} should contain {expected}, got: {content}"
);
- thread::sleep(std::time::Duration::from_millis(50));
}
}
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap
index e32d2d599..7087b6e91 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_mixed_user_pipeline_project_flat.snap
@@ -49,5 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user → user_bg @ _REPO_.feature
-◎ Running post-start: proj @ _REPO_.feature
+◎ Running post-start: user → user_bg, proj @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_combined_hooks.snap b/tests/snapshots/integration__integration_tests__switch__switch_combined_hooks.snap
index 3b049d938..d7575ed8c 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_combined_hooks.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_combined_hooks.snap
@@ -50,5 +50,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-switch: project @ _REPO_.combined-hooks-test
-◎ Running post-start: project @ _REPO_.combined-hooks-test
+◎ Running post-switch: project; post-start: project @ _REPO_.combined-hooks-test
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
index a50b586cd..e2d57d04c 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
@@ -49,5 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: bg @ _REPO_.feature
-◎ Running post-start: project @ _REPO_.feature
+◎ Running post-start: bg, project @ _REPO_.feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap
index 783e080b5..360e661c6 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_unnamed_post_start.snap
@@ -49,5 +49,4 @@ exit_code: 0
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Running post-start: user @ _REPO_.feature
-◎ Running post-start: project @ _REPO_.feature
+◎ Running post-start: user, project @ _REPO_.feature