Repository navigation
fix(mesh): converge on one canonical gist resolver - #459
Conversation
|
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. |
|
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. |
There was a problem hiding this comment.
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 statusthat reportsSOLO/DEGRADED/okbased on peer records and recent remote traffic. - Make
airc doctor --healthwarn 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 sendemit a post-delivery warning when the scope appears to be a solo mesh; addsolo_mesh_warnsintegration 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 |
| 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 |
| 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 |
Summary
_mesh_findwith the same content-basedairc_core.channel_gistresolver used by subscribe/sendRoot Cause
AIRC had two sources of truth for the mesh:
_mesh_findmatched only gists whose description was exactlyairc mesh.channel_gist.resolve/find_existingmatched envelope content and could choose an olderairc room: ...gist that still carried the livegeneral/cambriantechchannel envelope.Live account evidence showed exactly that split:
_mesh_findchose0fc919c...(fresh empty exact-description mesh), while channel routing and active peer heartbeat were onc56fda...(older room-described gist withairc-room-general.jsonand 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.shgit diff --checkPYTHONPATH=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)_mesh_find generaland_mesh_find cambriantechboth returnc56fdaaf8e2af0a277bedf432975a23c, not the empty0fc919c5ce642d2c1ea55534c312de6c.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.