Skip to content

fix(mesh): converge on one canonical gist resolver - #459

Merged
joelteply merged 2 commits into
canaryfrom
fix/solo-mesh-health
May 4, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fix/solo-mesh-health

Conversation

@joelteply

@joelteply joelteply commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace description-only _mesh_find with the same content-based airc_core.channel_gist resolver used by subscribe/send
  • update connect discovery, stale-host rejoin, and rediscover to pass the relevant channel into that resolver
  • keep the health guardrails from the first commit so status/doctor/send expose zero-peer solo meshes instead of saying clean healthy

Root Cause

AIRC had two sources of truth for the mesh:

  1. _mesh_find matched only gists whose description was exactly airc mesh.
  2. channel_gist.resolve/find_existing matched envelope content and could choose an older airc room: ... gist that still carried the live general/cambriantech channel envelope.

Live account evidence showed exactly that split: _mesh_find chose 0fc919c... (fresh empty exact-description mesh), while channel routing and active peer heartbeat were on c56fda... (older room-described gist with airc-room-general.json and b69f heartbeat). Agents then believed they were joined while writing to different gists.

Verification

  • bash -n airc lib/airc_bash/mesh.sh lib/airc_bash/cmd_connect.sh lib/airc_bash/cmd_status.sh lib/airc_bash/cmd_doctor.sh lib/airc_bash/cmd_send.sh test/integration.sh
  • git diff --check
  • PYTHONPATH=lib python3 test/test_channel_gist.py
  • ./test/integration.sh send_dead_monitor_dies (sequential; 8/8)
  • ./test/integration.sh solo_mesh_warns (sequential; 3/3)
  • Live resolver smoke on Joel account: patched _mesh_find general and _mesh_find cambriantech both return c56fdaaf8e2af0a277bedf432975a23c, not the empty 0fc919c5ce642d2c1ea55534c312de6c.

Notes

This is the production fix for the split-brain class: one canonical channel→gist resolver. The zero-peer health warnings remain as defense-in-depth, but are not the primary fix.

Copilot AI review requested due to automatic review settings May 4, 2026 17:12
@joelteply

Copy link
Copy Markdown
Contributor Author

Coordination note: AIRC is currently unreliable/split from my continuum scope (local transport healthy, peers empty), so I am not trusting #general for review handoff. This PR is the immediate stop-lying fix: status/doctor/send now distinguish local bearer health from collaboration membership and warn on zero peer records. Follow-up should fix canonical gist convergence in join/connect so self-heal cannot strand an agent on a solo gist.

@joelteply

Copy link
Copy Markdown
Contributor Author

Holding this PR. Joel is right that this is a warning-layer patch, not the production fix. I am not merging it as the answer; switching to the core join/connect canonical-gist convergence bug so agents cannot self-heal into separate meshes in the first place.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the accuracy of “bus health” surfaces by distinguishing local transport/bearer freshness from actual collaboration mesh membership, and adds integration coverage for the “healthy local bus, zero peers” failure mode.

Changes:

  • Add a collaboration-health line to airc status that reports SOLO/DEGRADED/ok based on peer records and recent remote traffic.
  • Make airc doctor --health warn when the current scope has zero peer records (so it doesn’t report a clean healthy bus in a solo mesh).
  • Make user-invoked airc send emit a post-delivery warning when the scope appears to be a solo mesh; add solo_mesh_warns integration scenario.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
test/integration.sh Adds solo_mesh_warns scenario + wiring into mode dispatch to prevent regressions.
lib/airc_bash/cmd_status.sh Introduces _airc_collaboration_health_report and prints it during airc status.
lib/airc_bash/cmd_send.sh Adds stderr warning after successful user-invoked sends when peer roster is empty.
lib/airc_bash/cmd_doctor.sh Adds a --health warning when the collaboration mesh has 0 peer records.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if not entry.endswith(".json"):
continue
try:
json.load(open(os.path.join(peers_dir, entry)))
# self-healed host can have fresh bearer heartbeats while nobody else is
# paired to this mesh. Surface that split-brain shape explicitly.
AIRC_STATUS_HOME="$AIRC_WRITE_DIR" AIRC_STATUS_MY_NAME="$(get_name)" "$AIRC_PYTHON" - <<'PY'
import calendar, json, os, sys, time
Comment on lines +541 to +551
local peer_count=0
if [ -d "$PEERS_DIR" ]; then
peer_count=$(find "$PEERS_DIR" -maxdepth 1 -name '*.json' -type f 2>/dev/null | wc -l | tr -d ' ')
fi
if [ "${peer_count:-0}" -eq 0 ] 2>/dev/null; then
printf " [WARN] collaboration mesh has 0 peer records — local transport may be healthy but nobody is known to be connected\n"
printf " Check: airc peers; ask peers to run 'airc update --channel canary && airc connect <current invite>'\n"
warns=$((warns+1))
else
printf " [ok] collaboration mesh has %s peer record(s)\n" "$peer_count"
fi
Comment thread lib/airc_bash/cmd_send.sh
Comment on lines +675 to +681
local _peer_count=0
if [ -d "$PEERS_DIR" ]; then
_peer_count=$(find "$PEERS_DIR" -maxdepth 1 -name '*.json' -type f 2>/dev/null | wc -l | tr -d ' ')
fi
if [ "${_peer_count:-0}" -eq 0 ] 2>/dev/null; then
echo " ⚠ collaboration: 0 peer records in this scope; this may be a solo mesh. Run 'airc peers' and verify others joined this gist." >&2
fi
@joelteply joelteply changed the title fix(health): warn on solo collaboration mesh fix(mesh): converge on one canonical gist resolver May 4, 2026
@joelteply
joelteply merged commit 90c8e59 into canary May 4, 2026
6 checks passed
@joelteply
joelteply deleted the fix/solo-mesh-health branch May 4, 2026 17:20
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.

2 participants