engine: a pinned peer is never shelved — stop the support-session prune loop#103
Merged
Merged
Conversation
…ne loop Under a pruning topology (hubs/star/ring) the shelve pass marked every non-edge link shelved, pinned or not. A technician's standing support dial is a spoke-to-spoke pin: the pin-holder's own daemon shelved the link and told the far side so, the pinless side then saw both-sides-shelved on its shape tick and closed the connection (TopologyPruned), the pin redialed it, and the session dropped on a loop every few seconds — video, input, and chat routes dying together on each pass. Pruning a non-edge deliberately needs BOTH sides shelved, and the pin lives on exactly one side — so the pin-holder simply never sends its half of that agreement. This is the same sticky exemption the announce-dial and prune passes already apply; the shelve pass was the one place that missed it. Marking a pinned peer preferred also unshelves a link that was shelved before the pin existed, so a pin added mid-session heals. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GiGnE5ucyTgqdVrhKVJSUm
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.
What
Fixes the repeating video/control drops CEC techs are seeing: a connected support session died every few seconds and reconnected on a loop whenever the support area runs a pruning topology (hubs, i.e.
CEC_HELP_HUBSin production).Root cause
The topology shaper prunes a spoke↔spoke connection once both sides have shelved it — that's the coordination-free "we both agree this link shouldn't exist" signal. A technician's dial pins the customer (
connect_peer(pin: true)), and pins are deliberately one-sided: the announce-dial path and the prune pass both exempt sticky peers.The shelve pass (
reevaluate_topology) was the one place that didn't. The tech's own daemon marked the pinned link shelved and sentShelveto the customer; the customer's daemon — which has no pin — then sawlocal_shelved && remote_shelved, no edge, not sticky, and closed the connection (TopologyPruned). Every route riding the link (screen video, input, terminal, chat) died at once. The pin immediately redialed on the next announce, the session came back, the shelve pass re-ran, and the customer pruned again: connect → a few seconds of session → drop, forever.Fix
One expression in
reevaluate_topology: a sticky (pinned) peer is never shelved. The pin-holder therefore never sends its half of the prune agreement, so the pinless side can never reach both-sides-shelved and the link survives. Because the trigger is the pin-holder's Shelve, shipping this in the technician-side daemon stops the pruning on customer daemons that don't have the fix yet.Ordinary shaping is untouched: unpinned non-edges still shelve and prune exactly as before, and removing the pin (forgetting the customer) lets the normal shelve → prune cleanup run. Marking a pinned peer preferred also unshelves a link that got shelved before the pin landed, so a pin added mid-session heals.
Testing
reevaluate_never_shelves_a_pinned_peer,reevaluate_unshelves_a_peer_that_became_pinnedmyownmesh-coresuite green (271 unit + integration),cargo fmt --checkand clippy clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01GiGnE5ucyTgqdVrhKVJSUm
Generated by Claude Code