Skip to content

feat(status): airc status — liveness view for #7 (monitor, queue, last-activity) - #13

Merged
joelteply merged 1 commit into
mainfrom
feat/status-command-issue-7
Apr 15, 2026
Merged

joelteply merged 1 commit into
mainfrom
feat/status-command-issue-7

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Adds airc status — a one-command snapshot of mesh health. Last visible-resilience item on #7's umbrella list.

Example — joiner

```
$ airc status
airc status — scope /Users/you/project/.airc
identity: m5-test (joiner of host-abc @ [email protected]:7547)
monitor: running (PID 50580)
last send: 94s ago
last recv: 156s ago
queue: empty
reminder: every 300s
```

Example — host

```
$ airc status
identity: host-abc (hosting on port 7547)
monitor: running (PID 12345)
...
```

Opt-in SSH reachability probe

```
$ airc status --probe
...
host: reachable
```

3s `ConnectTimeout` + `BatchMode=yes` — never hangs the terminal. Kept off-by-default so the plain `airc status` stays instant.

Fields

Field Source
identity + role get_name + host_target presence
monitor ALL PIDs in airc.pid, alive if ANY is; reports "stale pidfile" with hint to run airc connect
last send AIRC_WRITE_DIR/last_sent (written by cmd_send)
last recv newest inbound in local messages.jsonl (filters own name + system 'airc' source)
queue line count of pending.jsonl
reminder off / paused / every Ns

Test plan

  • Hand-tested against a live mesh (joiner + host modes, pending queue populated)
  • New scenario_status (7 assertions): identity line, monitor line, queue empty, joiner role visible, last-send reflects activity, queue shows pending after simulated outage send
  • Full suite: 62/62 (was 55/55)

Related

🤖 Generated with Claude Code

…ivity)

Last item on #7's visible-resilience list. Before this: figuring out
whether your mesh is alive required reading pidfiles, tailing logs, and
guessing. After: one command shows the answers.

Output (joiner):

  airc status — scope /Users/you/project/.airc
  identity:    m5-test (joiner of host-abc @ [email protected]:7547)
  monitor:     running (PID 50580)
  last send:   94s ago
  last recv:   156s ago
  queue:       empty
  reminder:    every 300s

Output (host):

  airc status — scope /Users/you/project/.airc
  identity:    host-abc (hosting on port 7547)
  monitor:     running (PID 12345)
  last send:   5m ago
  last recv:   10s ago
  queue:       empty
  reminder:    off

Fields:

* identity + role — joiner shows paired host; host shows listen port
* monitor — checks ALL PIDs in airc.pid (parent + python listener), alive
  if ANY is; reports "stale pidfile" if none, with the hint to run connect
  for self-healing
* last send — elapsed seconds from AIRC_WRITE_DIR/last_sent (written by cmd_send)
* last recv — elapsed seconds from newest inbound (from != $my_name and
  != 'airc') in local messages.jsonl, ts parsed in Python
* queue — pending.jsonl line count; messages waiting for flush_pending_loop
* reminder — off / paused / every Ns

Opt-in `airc status --probe` does a 3s SSH probe of host_target with
BatchMode=yes (no hangs), prints "reachable" or "UNREACHABLE". Kept
off-by-default so `airc status` is always fast.

Help text + dispatch entry updated.

Full suite: 62/62 (was 55/55). Refs #7 umbrella — this closes item 3
(`airc status` liveness view).
@joelteply
joelteply merged commit 9acfd11 into main Apr 15, 2026
1 check passed
@joelteply
joelteply deleted the feat/status-command-issue-7 branch April 15, 2026 19:29
joelteply added a commit that referenced this pull request Apr 15, 2026
Pre-this-commit: airc status reported "last send: Xs ago" from a single
marker that cmd_send updated on every attempt. Queued-during-outage sends
showed "1s ago" right next to "queue: 1 pending" — a state that literally
means "we did NOT deliver." Users reading this as delivery confirmation
would be wrong.

Two files now:
- last_sent        — "user attempted to send anything" (drives reminder reset, existing semantics)
- last_delivered   — "host's messages.jsonl got the line" (new)

last_delivered is updated in three places only — each a point of
actual delivery:
1. cmd_send successful wire branch (after __APPENDED__ marker seen)
2. cmd_send host-mode (local append IS delivery on the host)
3. flush_pending_loop drain success (queued messages that eventually landed)

cmd_status now reports "last delivered: Xs ago" as the primary field.
Only prints "last attempt" when it's newer than last_delivered AND the
queue is non-empty — surfaces the exact state ("user tried Ns ago,
nothing has delivered since, message is queued").

Test updates:
- scenario_status joiner flow now asserts last_delivered advances after
  a successful send AND that last_attempt is hidden when they agree
- Post-outage assertion now requires last_attempt with QUEUED tag —
  the exact lie the old "last send" line was telling

Full suite 70/70.

Refs #15, #13.
joelteply added a commit that referenced this pull request Apr 15, 2026
vhsm-claude's last #12 followup. Before: `airc status --probe` hit SSH
on every call; a statusline renderer or watch loop polling every few
seconds could generate unnecessary connection load and terminal lag.

Cache structure: ${AIRC_WRITE_DIR}/probe_cache is two lines — epoch
seconds on line 1, result string on line 2. TTL 5s. Stale entries trigger
a fresh probe and atomic rewrite (mv .new → probe_cache so concurrent
reads never see half-written content).

Cached entries render with a "(cached Ns)" suffix so the user can tell
fresh from cached at a glance.

  $ airc status --probe
    host:        UNREACHABLE (ssh timeout or auth failure)

  $ airc status --probe   # within 5s
    host:        UNREACHABLE (ssh timeout or auth failure) (cached 2s)

Tests extend scenario_status with 3 assertions: first call is fresh (no
cached suffix), first call correctly reports UNREACHABLE for fake host,
second call within TTL shows the cached suffix.

Full suite: 81/81.

Refs #12 review, #13.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant