From 13f62390a7fd8e3b84629bf5333ca3b435a00c3d Mon Sep 17 00:00:00 2001 From: openhands Date: Mon, 23 Mar 2026 08:30:13 +0000 Subject: [PATCH] fix: Duplicate read_phase definition in phase-test.sh (#179) Source the canonical read_phase() from lib/agent-session.sh instead of maintaining a local copy that could drift. Co-Authored-By: Claude Opus 4.6 (1M context) --- dev/phase-test.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dev/phase-test.sh b/dev/phase-test.sh index 7a684c3..82c28c2 100755 --- a/dev/phase-test.sh +++ b/dev/phase-test.sh @@ -8,6 +8,9 @@ set -euo pipefail +# Source canonical read_phase() from shared library +source "$(dirname "$0")/../lib/agent-session.sh" + PROJECT="testproject" ISSUE="999" PHASE_FILE="/tmp/dev-session-${PROJECT}-${ISSUE}.phase" @@ -81,13 +84,7 @@ else fail "PHASE:failed format: first='$first_line' second='$second_line'" fi -# ── Test 5: orchestrator read function ──────────────────────────────────────── -read_phase() { - local pfile="$1" - # Allow cat to fail (missing file) — pipeline exits 0 via || true - { cat "$pfile" 2>/dev/null || true; } | head -1 | tr -d '[:space:]' -} - +# ── Test 5: orchestrator read function (canonical read_phase from lib/agent-session.sh) echo "PHASE:awaiting_ci" > "$PHASE_FILE" phase=$(read_phase "$PHASE_FILE") if [ "$phase" = "PHASE:awaiting_ci" ]; then