Skip to content

fix(qa): daemon bootstrap I/O error + 'airc msg @peer text' quoted-arg parse - #440

Merged
joelteply merged 1 commit into
canaryfrom
fix/daemon-bootstrap-and-msg-arg-parse
May 2, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/daemon-bootstrap-and-msg-arg-parse

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Two fresh-install bugs caught while answering Joel's 'is daemon clean for new installs?' question.

# Bug Fix
9 macOS daemon install emits scary 'Bootstrap failed: 5: Input/output error' + dies, even when service IS loaded Wait for bootout to complete; verify install via launchctl list instead of trusting stderr
10 airc msg "@peer some text" (quoted single-arg) rejected as invalid peer name Pre-process $@ to split @-arg with whitespace into separate args before parse loop

Why both matter for fresh installs

Verification

Pairs with

🤖 Generated with Claude Code

…@peer text' quoted-arg parse

Found by self-QA on the fresh-install path Joel asked about. Both
hit first-time users + are quick fixes.

## #9: launchctl bootstrap "Input/output error" on macOS daemon install

Pre-fix `airc daemon install` over an existing daemon (e.g., switching
scopes or re-installing after a stale registration) emits:

  Wrote /Users/joelteply/Library/LaunchAgents/com.cambriantech.airc.plist
  Bootstrap failed: 5: Input/output error
  Try re-running the command as root for richer errors.
  ERROR: launchctl bootstrap failed. Plist written but not loaded;
         check Console.app for errors.

Then `die`s. But the plist file IS written + the service IS often
loaded (launchd's "Input/output error 5" is actually "service
already loaded" — bootstrap's stderr lies).

Two real bugs:
1. bootout (line 200) doesn't wait for the previous PID to fully
   exit before bootstrap fires. Result: launchd sees "service still
   loaded" → bootstrap fails.
2. die() on bootstrap stderr alone is wrong — verify by checking
   `launchctl list` for the service. If listed, success regardless
   of stderr noise.

Fix:
- After bootout, poll `launchctl list` for up to 3s (6×500ms) until
  the service disappears.
- Bootstrap with stderr captured (don't die on it).
- Verify by `launchctl list` post-bootstrap. If listed → success.
  If not → die loud with the captured stderr.

This makes daemon install idempotent + reliable across re-installs,
which matters for fresh-install confidence + scope-switching workflow.

## #10: 'airc msg "@peer some text"' rejected as invalid peer name

Pre-fix the strict charset reject in cmd_send.sh:163 fired when the
user quoted the @peer + body together:

  $ airc msg "@continuum-b69f comms check"
  ERROR: Invalid peer name in '@continuum-b69f comms check' —
         must match [a-z0-9-]+ ...

Strict parsing assumed `airc msg @peer "body"` (separate args).
Common UX intuition (and IRC clients like /msg) accept the single-
quoted form as a single line. The reject was correct for safety
but unfriendly.

Fix: pre-process $@ before the parse loop. If $1 starts with @ AND
contains whitespace, split on first whitespace — front becomes the
@-peer arg, back becomes the start of the message body. Then the
existing loop processes them as if they'd been separate args.

Verified: 'airc msg "@peer text"' now passes the @-parse step and
proceeds to send (or hits a downstream init/scope error, which is
fine — proves the parse changed). Original separate-args form
('airc msg @peer "text"') still works.

## Verification

- `bash -n` clean on both modified files
- #10 reproduced + fixed: parse error gone

## Pairs with

- #422 (canary→main — keep clearing first-time-user bugs)
- #439 (deeper-QA fixes — same QA pattern)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 2, 2026 21:14
@joelteply
joelteply merged commit f3fd17d into canary May 2, 2026
10 checks passed
@joelteply
joelteply deleted the fix/daemon-bootstrap-and-msg-arg-parse branch May 2, 2026 21:15
@joelteply
joelteply removed the request for review from Copilot May 2, 2026 21:38
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