fix: auto-assign after merge, persistent server logs, remove duplicate pnpm install

- Call auto_assign_available_work at end of merge_agent_work so the next
  story gets picked up without waiting for the PTY exit handler
- Add persistent file logging to .story_kit/logs/server.log so server
  logs survive restarts
- Remove duplicate pnpm install block in run_squash_merge

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-26 18:24:27 +00:00
parent b5135ad957
commit 2148531a46
3 changed files with 38 additions and 42 deletions

View File

@@ -1283,6 +1283,12 @@ impl AgentPool {
false
};
// Mergemaster slot is now free — trigger auto-assign so remaining
// items in 4_merge/ (or other stages) get picked up. The normal
// server-owned completion handler won't run because we already
// removed the agent entry above.
self.auto_assign_available_work(project_root).await;
Ok(MergeReport {
story_id: story_id.to_string(),
success: true,
@@ -2797,57 +2803,17 @@ fn run_squash_merge(
});
}
// ── Install frontend dependencies for quality gates ──────────────
let frontend_dir_for_install = merge_wt_path.join("frontend");
if frontend_dir_for_install.exists() {
// Ensure frontend/dist/ exists so cargo clippy (RustEmbed) can compile
// even before `pnpm build` has run.
let dist_dir = frontend_dir_for_install.join("dist");
std::fs::create_dir_all(&dist_dir)
.map_err(|e| format!("Failed to create frontend/dist: {e}"))?;
all_output.push_str("=== pnpm install (merge worktree) ===\n");
let pnpm_install = Command::new("pnpm")
.args(["install"])
.current_dir(&frontend_dir_for_install)
.output()
.map_err(|e| format!("Failed to run pnpm install: {e}"))?;
let install_out = format!(
"{}{}",
String::from_utf8_lossy(&pnpm_install.stdout),
String::from_utf8_lossy(&pnpm_install.stderr)
);
all_output.push_str(&install_out);
all_output.push('\n');
if !pnpm_install.status.success() {
all_output.push_str("=== pnpm install FAILED — aborting merge ===\n");
cleanup_merge_workspace(project_root, &merge_wt_path, &merge_branch);
return Ok(SquashMergeResult {
success: false,
had_conflicts,
conflicts_resolved,
conflict_details,
output: all_output,
gates_passed: false,
});
}
}
// ── Install frontend dependencies for quality gates ──────────
let frontend_dir = merge_wt_path.join("frontend");
if frontend_dir.exists() {
// Ensure frontend/dist exists so RustEmbed (cargo clippy) doesn't fail
// even before pnpm build runs.
let dist_dir = frontend_dir.join("dist");
if !dist_dir.exists() {
let _ = std::fs::create_dir_all(&dist_dir);
}
let _ = std::fs::create_dir_all(&dist_dir);
all_output.push_str("=== pnpm install (merge worktree) ===\n");
let pnpm_install = Command::new("pnpm")
.args(["install", "--frozen-lockfile"])
.args(["install"])
.current_dir(&frontend_dir)
.output()
.map_err(|e| format!("Failed to run pnpm install: {e}"))?;