Commit 078bd8a
fix: redirect ssh_retry diagnostic messages to stderr
**Root Cause**: The ssh_retry function was outputting diagnostic messages
to stdout, which were being captured along with the actual command output
when using command substitution. This caused the CURRENT_SHA validation
to fail because the captured output contained multiple lines:
SSH Attempt 1 of 3
5521f2e2c49ddf933f160e7e5b6da7799fe5c4aa
✅ SSH command succeeded on attempt 1
The regex validation `^[a-fA-F0-9]{40}$` failed on this multi-line output,
causing CURRENT_SHA to be set to "unknown", which triggered the "first
deployment" logic and skipped stack removal detection entirely.
**Impact**: Removed stacks were not being cleaned up because the detection
was always being skipped due to the invalid SHA format.
**Fix**: Redirect all diagnostic echo statements in ssh_retry to stderr
using `>&2`. This ensures only the actual command output is captured in
stdout, allowing proper SHA validation.
**Test Plan**:
- Verify deploy runs capture correct CURRENT_SHA
- Confirm stack removal detection no longer skips
- Validate removed stacks are properly cleaned up
Changes:
- Add >&2 to all echo statements in ssh_retry function (8 instances)
- Diagnostic messages now appear in logs but don't pollute stdout
- Command output captured cleanly for variable assignment
Follows systematic debugging process from superpowers:systematic-debugging.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent ce533ce commit 078bd8a
1 file changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | | - | |
| 272 | + | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| |||
0 commit comments