Repository navigation
fix(repair): preserve gone channel pruning - #539
Merged
Merged
Conversation
There was a problem hiding this comment.
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_repairinference to honor the gone marker when reconstructingchannel_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 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 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 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"}' \ |
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.
Summary
gone_channel_gist.<channel>marker when monitor recv or send sees a terminal gist 404scope_repair repair-confighonor that marker so it cannot restore a dead channel mapping from stale bearer logs or durable room stateWhy
Windows validated #538 pruned
qa-test-b69f, then foundairc 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.shpython3 -m py_compile lib/airc_core/scope_repair.py test/test_scope_repair.pypython3 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