Commit 20bd682895bd

Vincent Demeester <vincent@sbr.pm>
2026-01-29 14:14:51
fix(shpool): allow attaching to existing review sessions without prompt
Previously, review-* sessions always required a prompt argument, even when just attaching to an existing session. Now checks if the session exists first and attaches directly if so. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 50ae1ab
Changed files (1)
tools
shpool-ssh-wrapper
tools/shpool-ssh-wrapper/default.nix
@@ -76,8 +76,14 @@ pkgs.writeScriptBin "shpool-ssh-wrapper" ''
           # The WORK_DIR variable holds the prompt (after =)
           # Uses 'cr' script from PATH (pkgs/my/scripts/bin/cr)
           if [ -z "$WORK_DIR" ]; then
-              echo "Error: review sessions require a prompt (use session=prompt syntax)" >&2
-              exit 1
+              # No prompt - check if session already exists and just attach
+              if ${pkgs.shpool}/bin/shpool list 2>/dev/null | grep -q "^$SESSION_NAME "; then
+                  exec ${pkgs.shpool}/bin/shpool attach -f "$SESSION_NAME"
+              else
+                  echo "Error: new review sessions require a prompt (use session=prompt syntax)" >&2
+                  echo "Example: ssh host/review-pull-123=\"Review https://github.com/...\"" >&2
+                  exit 1
+              fi
           fi
           run_with_command "$SESSION_NAME" "cr" "$WORK_DIR"
           ;;