Repository navigation
fix(heartbeat): allow empty body when --heartbeat (caught live; airc#644 PR-2 follow-up) - #648
Merged
Merged
Conversation
…644 PR-2 follow-up) PR-2 (#647) shipped the cmd_send --heartbeat path + the reminder_timer_loop hook calling 'cmd_send --heartbeat --internal ' every 60s. Locally tested by: $ airc msg --heartbeat --internal "" ERROR: Usage: airc send <message> or airc send @peer <message> The empty-body usage-check (sane default for chat) was rejecting the heartbeat send. As a result no heartbeats reached messages.jsonl after teardown+rejoin+75s — silent emission failure that PR-2's unit tests didn't catch because they're structural (grep for the flag) not behavioural (actually invoke the send). Joel's discipline applied: 'have to see if it works.' Code review + unit tests do NOT validate user experience. Run the actual command a user would run. The reminder loop's invocation IS the user surface here; teardown+rejoin+wait is the equivalent of a fresh install path. Fix: the usage-check now exempts heartbeats. The signal in a heartbeat is in envelope metadata (kind/ts/from), not the msg body — empty body is the correct shape. Other empty-body sends still die loudly per the prior contract. bash -n lib/airc_bash/cmd_send.sh → ok.
This was referenced May 28, 2026
Closed
Merged
This was referenced May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PR-2 (#647) shipped `cmd_send --heartbeat` + the `reminder_timer_loop` hook calling `cmd_send --heartbeat --internal ""` every 60s. Locally testing showed zero heartbeats reaching `messages.jsonl` — silent emission failure.
Root cause: `cmd_send`'s empty-body usage-check (sane default for chat) was rejecting the heartbeat:
```
$ airc msg --heartbeat --internal ""
ERROR: Usage: airc send or airc send @peer
```
This unit tests didn't catch because they're structural (grep for the flag's existence) not behavioural (actually invoke the send). The reminder-loop's subshell suppressed stdout+stderr so the failure was invisible from logs too.
Caught Live
Joel: "have to see if it works." I did the actual user-surface test:
The failure was found by running the substrate the way a user would, not by trusting tests.
Fix
The empty-body check now exempts heartbeats. The signal in a heartbeat IS its envelope metadata (`kind` / `ts` / `from`); body MUST be empty. Other empty-body sends still die loudly per the prior contract.
```bash
local first="${1:-}"
if [ -z "$first" ] && [ "$heartbeat" != "1" ]; then
die "Usage: airc send or airc send @peer "
fi
```
Validation
`bash -n lib/airc_bash/cmd_send.sh` → ok
After this lands + airc update + restart, the live test should produce:
```
$ grep -c '"kind":"heartbeat"' .airc/messages.jsonl
1+ # one per ~60s of process uptime
```
Title Prefix
`fix:` per conventional-commits; targets `canary` per the merge-to-canary-in-active-loop rule. Closes the regression introduced by #647 in the same active-loop iteration.
Followup
PR-2's tests should grow a behavioural check that actually invokes `cmd_send --heartbeat --internal ""` in a temp-scope and asserts a heartbeat lands in messages.jsonl. Filing as a TODO; the priority right now is fixing the live emission.