Skip to content

engine: a pinned peer is never shelved — stop the support-session prune loop#103

Merged
mrjeeves merged 1 commit into
mainfrom
claude/allmystuff-client-rename-save-ch730v
Jul 16, 2026
Merged

engine: a pinned peer is never shelved — stop the support-session prune loop#103
mrjeeves merged 1 commit into
mainfrom
claude/allmystuff-client-rename-save-ch730v

Conversation

@mrjeeves

Copy link
Copy Markdown
Owner

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_HUBS in 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 sent Shelve to the customer; the customer's daemon — which has no pin — then saw local_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

  • New: reevaluate_never_shelves_a_pinned_peer, reevaluate_unshelves_a_peer_that_became_pinned
  • Full myownmesh-core suite green (271 unit + integration), cargo fmt --check and clippy clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GiGnE5ucyTgqdVrhKVJSUm


Generated by Claude Code

…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
@mrjeeves
mrjeeves merged commit daf2671 into main Jul 16, 2026
10 checks passed
@mrjeeves
mrjeeves deleted the claude/allmystuff-client-rename-save-ch730v branch July 16, 2026 22:11
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