From 739a48e18522880e8e9f322859dbf9d89249e947 Mon Sep 17 00:00:00 2001 From: tupe12334 Date: Thu, 11 Jun 2026 21:31:03 +0300 Subject: [PATCH] fix: ack.sh exits 0 with message when session already complete Co-Authored-By: Claude Sonnet 4.6 --- core/src/scripts.rs | 6 ++++++ scripts/ack.sh | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/core/src/scripts.rs b/core/src/scripts.rs index c8ca0da..a2e2023 100644 --- a/core/src/scripts.rs +++ b/core/src/scripts.rs @@ -102,6 +102,12 @@ mod tests { assert!(content.contains("state.json")); } + #[test] + fn ack_sh_handles_complete_session() { + assert!(ACK_SH.contains("session already complete")); + assert!(ACK_SH.contains("[*]")); + } + #[test] fn ensure_ack_sh_is_idempotent() { let tmp = TempDir::new().unwrap(); diff --git a/scripts/ack.sh b/scripts/ack.sh index 2b8cbb0..4f79a21 100644 --- a/scripts/ack.sh +++ b/scripts/ack.sh @@ -4,6 +4,13 @@ STATE="$DIR/state.json" TMP="$STATE.tmp.$$" CURRENT=$(jq -r '.current_state' "$STATE") + +if [ "$CURRENT" = "[*]" ]; then + CHECKLIST=$(jq -r '.checklist' "$STATE") + echo "steplock: nothing to acknowledge for '$CHECKLIST' (session already complete)" + exit 0 +fi + NEXT=$(jq -r '.next_state // empty' "$STATE") NEXT="${1:-$NEXT}"