diff --git a/shared/lib/wavemill-mill.sh b/shared/lib/wavemill-mill.sh index 9bf6ee5..ede6d1c 100755 --- a/shared/lib/wavemill-mill.sh +++ b/shared/lib/wavemill-mill.sh @@ -736,13 +736,13 @@ cleanup_completed_task() { # Kill tmux window (unconditional - no race condition) local win="$issue-$slug" execute tmux kill-window -t "$SESSION:$win" 2>/dev/null || true - log " ✓ Closed window: $win" + log "debug" " ✓ Closed window: $win" # Remove worktree local wt_dir="${WORKTREE_ROOT}/${slug}" if [[ -d "$wt_dir" ]]; then execute git -C "$REPO_DIR" worktree remove "$wt_dir" --force 2>/dev/null || true - log " ✓ Removed worktree: $wt_dir" + log "debug" " ✓ Removed worktree: $wt_dir" fi # Delete branch after removing the worktree so Git can detach cleanly first. @@ -751,9 +751,9 @@ cleanup_completed_task() { log_warn " Refusing to delete protected branch: $task_branch" elif git -C "$REPO_DIR" show-ref --verify --quiet "refs/heads/$task_branch" 2>/dev/null; then execute git -C "$REPO_DIR" branch -D "$task_branch" 2>/dev/null || true - log " ✓ Deleted local branch: $task_branch" + log "debug" " ✓ Deleted local branch: $task_branch" if execute git -C "$REPO_DIR" push origin --delete "$task_branch" 2>/dev/null; then - log " ✓ Deleted remote branch: $task_branch" + log "debug" " ✓ Deleted remote branch: $task_branch" else log "debug" " ℹ Remote branch already deleted or push failed: $task_branch" fi @@ -4063,13 +4063,13 @@ cleanup_completed_task() { # Kill tmux window (unconditional - no race condition) local win="$issue-$slug" tmux kill-window -t "$SESSION:$win" 2>/dev/null || true - log " ✓ Closed window: $win" + log "debug" " ✓ Closed window: $win" # Remove worktree local wt_dir="${WORKTREE_ROOT}/${slug}" if [[ -d "$wt_dir" ]]; then git -C "$REPO_DIR" worktree remove "$wt_dir" --force 2>/dev/null || true - log " ✓ Removed worktree: $wt_dir" + log "debug" " ✓ Removed worktree: $wt_dir" fi # Delete branch after removing the worktree so Git can detach cleanly first. @@ -4078,9 +4078,9 @@ cleanup_completed_task() { log_warn " Refusing to delete protected branch: $task_branch" elif git -C "$REPO_DIR" show-ref --verify --quiet "refs/heads/$task_branch" 2>/dev/null; then git -C "$REPO_DIR" branch -D "$task_branch" 2>/dev/null || true - log " ✓ Deleted local branch: $task_branch" + log "debug" " ✓ Deleted local branch: $task_branch" if git -C "$REPO_DIR" push origin --delete "$task_branch" 2>/dev/null; then - log " ✓ Deleted remote branch: $task_branch" + log "debug" " ✓ Deleted remote branch: $task_branch" else log "debug" " ℹ Remote branch already deleted or push failed: $task_branch" fi diff --git a/tests/startup-handoff.test.sh b/tests/startup-handoff.test.sh index 3ecc4cd..25434ef 100644 --- a/tests/startup-handoff.test.sh +++ b/tests/startup-handoff.test.sh @@ -184,6 +184,15 @@ cp "$REPO_DIR/shared/lib/agent-adapters.sh" "$TEST_REPO/shared/lib/" cp "$REPO_DIR/shared/lib/model-validator.ts" "$TEST_REPO/shared/lib/" cp "$REPO_DIR/shared/lib/wavemill-status.sh" "$TEST_REPO/shared/lib/" cp "$REPO_DIR/tools/prompts/"*.md "$TEST_REPO/tools/prompts/" + +# Stub agent_launch_interactive so it doesn't exercise real tmux pane readiness +# checks against the mock tmux. Appended functions override the original at +# source time. +cat >> "$TEST_REPO/shared/lib/agent-adapters.sh" <<'STUB_EOF' + +agent_launch_interactive() { return 0; } +agent_launch_autonomous() { return 0; } +STUB_EOF printf '{}' > "$TMP_ROOT/home/.claude.json" printf '{"token":"ok"}' > "$TMP_ROOT/home/.codex/auth.json" @@ -294,7 +303,7 @@ write_plan "$SUCCESS_PLAN" "$TEST_REPO" "$STATE_DIR" "$STATE_FILE" "startup-succ SUCCESS_OUTPUT="$TMP_ROOT/success-output.txt" bash "$RUNNER_SCRIPT" "$SUCCESS_PLAN" > "$SUCCESS_OUTPUT" 2>&1 -if jq -e '.tasks["HOK-1001"].phase == "coding"' "$STATE_FILE" >/dev/null 2>&1; then +if jq -e '.tasks["HOK-1001"].phase == "planning"' "$STATE_FILE" >/dev/null 2>&1; then pass "startup runner writes workflow state only after in-tmux startup succeeds" else fail "startup runner did not persist workflow state for the launched task"