Repository navigation
fix(update): loud stale-running-monitor warning on airc canary / update - #235
Conversation
… monitor is alive vhsm-d1f4's gotcha 2026-04-28: ran 'airc canary' to pick up #232, saw 'Updated X -> Y' confirmation, but their RUNNING monitor was still executing the pre-#232 in-memory bash. Phase 2C heartbeat scan never fired until they explicitly tore down + reconnected. The existing dim hint at the end of cmd_update was easy to miss amid install.sh's output. This makes the warning conditional + loud when it actually matters (running monitor present). ## Fix cmd_update detects `.airc/airc.pid` in the current scope and probes the PID. If alive, prints a multi-line action-shaped block with the rebar command on its own line: ⚠ A running airc monitor (PID NNNN) is still on the OLD code. Restart to pick up <new-sha>: airc teardown && airc connect Silent when nothing is running. The single-line hint that fired ALWAYS-on-update is dropped — the conditional version is more useful when it matters and quieter when it doesn't. ## What this does NOT do Auto-restart. That would interrupt active SSH sessions (DM in flight, file transfer, takeover dance). User decides when to bounce. ## Verification bash -n: clean test/integration.sh tabs: 19/0 ✓ Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Improves airc update UX by surfacing a clearer, action-oriented warning when an airc connect monitor is still running after an update, since long-running bash processes keep old function definitions in memory.
Changes:
- Replaces the previous dim, unconditional stale-monitor hint with a conditional warning based on
$AIRC_WRITE_DIR/airc.pid. - Prints a multi-line “restart” instruction only when a live PID is detected.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [ -n "$_pid" ] && kill -0 "$_pid" 2>/dev/null; then | ||
| echo "" | ||
| echo " ⚠ A running airc monitor (PID ${_pid}) is still on the OLD code." | ||
| echo " Restart to pick up ${after}:" |
There was a problem hiding this comment.
This warning will also print when no code update occurred (when before == after). In that case the running monitor is not on “OLD code”, so the message is misleading. Gate the stale-monitor warning on an actual revision change (e.g., only run this block when before != after), or adjust the wording to avoid claiming the monitor is old when nothing changed.
| # warning ONLY when a monitor is actually running in the current | ||
| # scope. Silent when nothing is running. | ||
| if [ -f "$AIRC_WRITE_DIR/airc.pid" ]; then | ||
| local _pid; _pid=$(awk '{print $1; exit}' "$AIRC_WRITE_DIR/airc.pid" 2>/dev/null) |
There was a problem hiding this comment.
_pid=$(awk ...) runs in a command substitution under set -euo pipefail (inherited from airc). If the pidfile exists but can’t be read (permissions, transient IO), awk exits non-zero and will abort airc update unexpectedly. Use the established pattern used elsewhere (e.g., ... || true inside the substitution) so a read failure just results in “no warning”.
| local _pid; _pid=$(awk '{print $1; exit}' "$AIRC_WRITE_DIR/airc.pid" 2>/dev/null) | |
| local _pid; _pid=$(awk '{print $1; exit}' "$AIRC_WRITE_DIR/airc.pid" 2>/dev/null || true) |
…low-up) (#238) Self-caught 2026-04-28: ran 'airc update' when already at HEAD; the warning still fired ("A running airc monitor is still on the OLD code") even though no code changed. False positive that nags users to bounce for nothing. ## Fix Gate the warning on `before != after` AND the running-monitor probe. When the SHA didn't advance, the running monitor IS up-to-date — no warning needed. ## Verification bash -n: clean Manual: `airc update` when already at HEAD → silent on warning. `airc update` when SHA advances → warning still fires. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
vhsm-d1f4 ran 'airc canary' for #232, saw the dim 'Running monitor still uses old code' hint, missed it in install.sh's output, and ran on stale in-memory bash for a while. Phase 2C didn't surface until teardown+reconnect.
Fix: cmd_update probes $AIRC_WRITE_DIR/airc.pid; if alive, prints a multi-line action-shaped warning with the restart command on its own line. Silent when nothing's running.