Repository navigation
refactor: unify _daemon_os into detect_platform (#205, net -26) - #211
Merged
Merged
Conversation
Two near-identical OS-detection functions: detect_platform in lib/airc_bash/platform_adapters.sh + _daemon_os in airc top-level. Both Darwin/Linux/MINGW switching with /proc/version WSL detection. Unify on detect_platform's surface, with output names from _daemon_os (darwin/linux/wsl/windows/unknown) since they match \`uname -s\` more directly than detect_platform's prior \"macos\"/\"windows-bash\". Changes: - detect_platform: rename outputs (macos→darwin, windows-bash→windows), inline the WSL check (\`grep ... && echo wsl || echo linux\`). - _daemon_os: deleted (16 lines). - 4 daemon callers: \$(_daemon_os) → \$(detect_platform). - cmd_doctor.sh _doctor_probe_sshd: case macos)→darwin), case windows-bash)→windows). Diff: +10 / -36 = **-26 lines.** airc 5283 → 5265. Verified: \`airc doctor\` still detects macOS Remote Login + Tailscale on Mac; \`airc daemon status\` still works (uses the new unified function).
There was a problem hiding this comment.
Pull request overview
Consolidates OS detection by removing the duplicated _daemon_os implementation in airc and standardizing on detect_platform from lib/airc_bash/platform_adapters.sh, while updating downstream callers to use the new platform tokens.
Changes:
- Refactors
detect_platformto emitdarwin/linux/wsl/windows/unknown(matching the former_daemon_osvocabulary). - Updates doctor probes to switch on
darwinandwindows. - Removes
_daemon_osfromaircand replaces daemon callsites withdetect_platform.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/airc_bash/platform_adapters.sh | Changes detect_platform output tokens to match daemon expectations. |
| lib/airc_bash/cmd_doctor.sh | Updates detect_platform case labels to the new tokens. |
| airc | Deletes _daemon_os and switches daemon install/status logic to detect_platform. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+132
to
+134
| Darwin) echo darwin ;; | ||
| Linux) grep -qiE 'microsoft|wsl' /proc/version 2>/dev/null && echo wsl || echo linux ;; | ||
| MINGW*|MSYS*|CYGWIN*) echo windows ;; |
Comment on lines
199
to
203
| _doctor_probe_sshd() { | ||
| local plat; plat=$(detect_platform) | ||
| case "$plat" in | ||
| macos) | ||
| darwin) | ||
| # macOS Remote Login = launchd-managed sshd. Detect WITHOUT sudo: |
This was referenced Apr 28, 2026
joelteply
added a commit
that referenced
this pull request
Apr 28, 2026
feat(mesh): one gist per gh account — Phase 1 mesh-substrate switch
Architectural shift from per-room gists to per-account-singleton mesh.
Joel 2026-04-27: "B is the god damn correct shift. They all share the
same gist, stop being stupid. one goes down first one to resolve, posts
to gist. host goes down, new host, first one that posts, becomes it."
## What changes
- New `lib/airc_bash/mesh.sh` — primitives for the mesh-gist abstraction:
_mesh_desc, _mesh_find (singleton lookup), _mesh_publish, _mesh_update,
_mesh_age_secs, _mesh_take_over (race-aware oldest-by-created election)
- airc top-level: source mesh.sh; _self_heal_stale_host now takes only
stale_id (no room_name discriminator — mesh is per-account, nothing
to discriminate on)
- cmd_connect.sh:
- Discovery: singleton lookup via _mesh_find (was: per-room awk filter)
- Host publish: description "airc mesh", payload kind "mesh",
channels: [\$room_name] array (replaces .name + .topic)
- Heartbeat payload: same shape change
- Race-loser: _mesh_take_over (jitter, list, oldest-by-created wins)
- Joiner: kind "mesh" handled alongside legacy "room" for back-compat
with gists that haven't rolled over yet
- cmd_rooms.sh: list display now recognizes mesh (◆), room (#), invite
(1:1) — three kinds during the transition
## What's deferred to Phase 2/3/4
- Joiners adding their own channels to the mesh gist (currently the
host's published channels list is set at create time and only the
host updates it)
- Channel-as-message-metadata routing (messages still go to one log;
per-channel filtering is local-only at display time)
- .general sidecar deletion (still spawned per spawn_general_sidecar_if_wanted)
- Sweep of legacy `airc room: *` gists on rollover
## Verification
- bash -n clean on all four files
- airc help / version / dispatch reach correct paths
- test/integration.sh tabs: 1/3 (rename-marker timing flake; 0/3 on
pristine canary HEAD too — not introduced
by this PR, predates mesh switch)
- test/integration.sh status: 7/0 ✓
- test/integration.sh room: 14/0 ✓
- test/integration.sh general_sidecar_default: 12/0 ✓
- test/integration.sh platform_adapters: 9/2 (darwin/macos rename
from PR #211, unrelated)
## Test plan
- [ ] CI integration suite on push to canary
- [ ] e2e: continuum-b69f (Windows) + Mac Claude on same gh account
both run `airc update && airc join` — confirm both converge on
a single new "airc mesh" gist; first to publish wins; second
becomes joiner
- [ ] e2e takeover: kill the host, confirm joiner detects stale and
becomes new host (mesh takeover via _mesh_take_over)
- [ ] migration grace: existing `airc room: *` gists left untouched;
new mesh gist created alongside; cmd_rooms shows both with
separate markers (◆ vs #)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Apr 28, 2026
* feat(mesh): one gist per gh account — Phase 1 mesh-substrate switch
Architectural shift from per-room gists to per-account-singleton mesh.
Joel 2026-04-27: "B is the god damn correct shift. They all share the
same gist, stop being stupid. one goes down first one to resolve, posts
to gist. host goes down, new host, first one that posts, becomes it."
## What changes
- New `lib/airc_bash/mesh.sh` — primitives for the mesh-gist abstraction:
_mesh_desc, _mesh_find (singleton lookup), _mesh_publish, _mesh_update,
_mesh_age_secs, _mesh_take_over (race-aware oldest-by-created election)
- airc top-level: source mesh.sh; _self_heal_stale_host now takes only
stale_id (no room_name discriminator — mesh is per-account, nothing
to discriminate on)
- cmd_connect.sh:
- Discovery: singleton lookup via _mesh_find (was: per-room awk filter)
- Host publish: description "airc mesh", payload kind "mesh",
channels: [\$room_name] array (replaces .name + .topic)
- Heartbeat payload: same shape change
- Race-loser: _mesh_take_over (jitter, list, oldest-by-created wins)
- Joiner: kind "mesh" handled alongside legacy "room" for back-compat
with gists that haven't rolled over yet
- cmd_rooms.sh: list display now recognizes mesh (◆), room (#), invite
(1:1) — three kinds during the transition
## What's deferred to Phase 2/3/4
- Joiners adding their own channels to the mesh gist (currently the
host's published channels list is set at create time and only the
host updates it)
- Channel-as-message-metadata routing (messages still go to one log;
per-channel filtering is local-only at display time)
- .general sidecar deletion (still spawned per spawn_general_sidecar_if_wanted)
- Sweep of legacy `airc room: *` gists on rollover
## Verification
- bash -n clean on all four files
- airc help / version / dispatch reach correct paths
- test/integration.sh tabs: 1/3 (rename-marker timing flake; 0/3 on
pristine canary HEAD too — not introduced
by this PR, predates mesh switch)
- test/integration.sh status: 7/0 ✓
- test/integration.sh room: 14/0 ✓
- test/integration.sh general_sidecar_default: 12/0 ✓
- test/integration.sh platform_adapters: 9/2 (darwin/macos rename
from PR #211, unrelated)
## Test plan
- [ ] CI integration suite on push to canary
- [ ] e2e: continuum-b69f (Windows) + Mac Claude on same gh account
both run `airc update && airc join` — confirm both converge on
a single new "airc mesh" gist; first to publish wins; second
becomes joiner
- [ ] e2e takeover: kill the host, confirm joiner detects stale and
becomes new host (mesh takeover via _mesh_take_over)
- [ ] migration grace: existing `airc room: *` gists left untouched;
new mesh gist created alongside; cmd_rooms shows both with
separate markers (◆ vs #)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* feat(channels): channel field on every message envelope — Phase 2A
Stamps the active channel on every outgoing message envelope so the
monitor formatter can route display by channel uniformly, regardless
of which scope the message was emitted from. This is the substrate
for Phase 2B (collapsing the multi-scope sidecar into a single scope
with subscribed_channels).
## Envelope shape
Old (room implied by scope-level room_name file):
{"from":"X","to":"Y","ts":"...","msg":"..."}
New (channel stamped on the line itself):
{"from":"X","to":"Y","ts":"...","channel":"general","msg":"..."}
## Sites stamped
- cmd_send.sh: peer/broadcast envelope + sig over the new payload shape
- cmd_send.sh: queue marker (tailnet offline)
- cmd_send.sh: queue marker (network error)
- cmd_send.sh: fail marker (auth)
- airc top-level: drain marker
- handshake.py: peer-join system event
Rename markers go through cmd_send --internal and inherit the field.
## Display
monitor_formatter.py now prefers `m.get("channel")` over the scope-
level room_name when prefixing each emitted line. The scope-level
room_name remains as a fallback for pre-Phase-2 envelopes that lack
the field, so older messages still prefix correctly during rollover.
## Verification
- bash -n + python ast.parse on all four changed files
- test/integration.sh tabs: 19/0 ✓
- test/integration.sh room: 14/0 ✓
- test/integration.sh queue: 7/0 ✓
## Stacked on Phase 1
Branched off feat/one-mesh-gist-per-account (PR #222). When that
merges to canary, Phase 2A rebases cleanly. Phase 2B (sidecar
deletion + subscribed_channels config) follows.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.
Two near-identical OS-detection functions consolidated.
detect_platform(lib/airc_bash/platform_adapters.sh) and_daemon_os(airc top-level) both did Darwin/Linux/MINGW switching with /proc/version WSL detection — unify on detect_platform's surface, with output names matching _daemon_os (darwin/linux/wsl/windows/unknown — closer to rawuname -s).Diff: +10 / -36 = -26 lines. airc 5283 → 5265.
Continuum-b69f's #205 candidate #3 (OS-detection audit). Per his suggestion I leaned safe: pure cleanup, near-zero risk. Verified airc doctor + airc daemon status still work on Mac.