Skip to content

fix(repair): preserve gone channel pruning - #539

Merged
joelteply merged 1 commit into
canaryfrom
codex/persist-gone-channel-prune
May 6, 2026
Merged

joelteply merged 1 commit into
canaryfrom
codex/persist-gone-channel-prune

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

  • persist a gone_channel_gist.<channel> marker when monitor recv or send sees a terminal gist 404
  • make scope_repair repair-config honor that marker so it cannot restore a dead channel mapping from stale bearer logs or durable room state
  • extend the monitor-gone scenario to require the durable marker
  • add a scope-repair unit test for Windows' observed loop: fix(monitor): stop respawning gone channel gists #538 prunes a dead channel, then repair previously restored it

Why

Windows validated #538 pruned qa-test-b69f, then found airc msg/ensure-init repaired the config and reintroduced the dead gist from historical bearer logs. That made #538 repeat the same prune every join instead of permanently healing.

Validation

  • bash -n airc lib/airc_bash/cmd_send.sh test/integration.sh
  • python3 -m py_compile lib/airc_core/scope_repair.py test/test_scope_repair.py
  • python3 test/test_scope_repair.py
  • ./test/integration.sh monitor_gone_gist_stops_respawn
  • ./test/integration.sh send_gone_gist_does_not_claim_delivery
  • ./test/integration.sh python_units

Copilot AI review requested due to automatic review settings May 6, 2026 18:50
@joelteply
joelteply merged commit 5b486b2 into canary May 6, 2026
8 checks passed
@joelteply
joelteply deleted the codex/persist-gone-channel-prune branch May 6, 2026 18:52

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 makes “gone gist” channel pruning durable across ensure_init/scope_repair by persisting a per-channel marker when a terminal 404 is detected, so repair logic can’t resurrect dead channel_gists entries from stale logs or durable scope state (addressing the Windows loop observed after #538).

Changes:

  • Persist gone_channel_gist.<channel> markers on send-path and monitor recv-path terminal 404 (gone gist) events.
  • Update airc_core.scope_repair inference to honor the gone marker when reconstructing channel_gists.
  • Extend coverage with a new scope-repair unit test and a monitor-gone scenario assertion.

Reviewed changes

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

Show a summary per file
File Description
airc Monitor watchdog now writes a durable gone_channel_gist.<channel> marker when recv-side 404/gone is detected.
lib/airc_bash/cmd_send.sh Send-path 404/gone handling now persists gone_channel_gist.<channel> alongside clearing the config mapping.
lib/airc_core/scope_repair.py Adds marker reading and uses it to prevent repair from restoring dead gist mappings.
test/integration.sh Updates the monitor-gone scenario to require the marker behavior be present.
test/test_scope_repair.py Adds a regression unit test ensuring repair doesn’t reintroduce a dead gist when the marker exists.

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

Comment thread airc
Comment on lines +1462 to 1469
local _gone_gid
_gone_gid=$("$AIRC_PYTHON" -m airc_core.config get_channel_gist \
--config "$CONFIG" --channel "$ch" 2>/dev/null || true)
"$AIRC_PYTHON" -m airc_core.config set_channel_gist \
--config "$CONFIG" --channel "$ch" --gist-id "" \
>/dev/null 2>&1 || true
[ -n "$_gone_gid" ] && printf '%s\n' "$_gone_gid" > "$AIRC_WRITE_DIR/gone_channel_gist.${ch}" 2>/dev/null || true
printf '{"from":"airc","ts":"%s","channel":"%s","msg":"[GONE: room gist 404 — channel #%s dissolved. Monitor stopped respawning this channel; re-host with: airc join --room %s]"}\n' \
Comment on lines +105 to 110
gone_gist = _gone_channel_gist(home, channel)
if gone_gist:
if channel_gists.get(channel) == gone_gist:
channel_gists.pop(channel, None)
continue
log_gist = _gist_from_bearer_log(home, channel)
Comment thread lib/airc_bash/cmd_send.sh
Comment on lines 433 to 437
"$AIRC_PYTHON" -m airc_core.config set_channel_gist \
--config "$CONFIG" --channel "$active_channel" --gist-id "" \
>/dev/null 2>&1 || true
[ -n "${room_gist_id:-}" ] && printf '%s\n' "$room_gist_id" > "$AIRC_WRITE_DIR/gone_channel_gist.${active_channel}" 2>/dev/null || true
local gone_marker; gone_marker=$(printf '{"from":"airc","ts":"%s","channel":"%s","msg":"[GONE: room gist 404 — channel #%s dissolved, message NOT delivered. Re-host with: airc join --room %s] %s"}' \
Comment thread lib/airc_bash/cmd_send.sh
Comment on lines 631 to 635
"$AIRC_PYTHON" -m airc_core.config set_channel_gist \
--config "$CONFIG" --channel "$active_channel" --gist-id "" \
>/dev/null 2>&1 || true
[ -n "${_host_room_gist_id:-}" ] && printf '%s\n' "$_host_room_gist_id" > "$AIRC_WRITE_DIR/gone_channel_gist.${active_channel}" 2>/dev/null || true
local _host_gone_marker; _host_gone_marker=$(printf '{"from":"airc","ts":"%s","channel":"%s","msg":"[GONE: room gist 404 — channel #%s dissolved, message NOT delivered. Re-host with: airc join --room %s] %s"}' \
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