Skip to content

Tor auto-heal refinements deferred from #4095: circuit-completion gate, lock-refused history, 60 min disruptive spacing, KVM drop-cells leg #4280

Done

Description

@pithead-developer

What's the problem

#4095 ships the core Tor auto-heal ladder for #4075 in 2.0.4:

  • a rejected NEWNYM advances to the state reset;
  • the healer gives up only after the last action's cooldown;
  • non-saturation reset reasons;
  • past the cap it probes and re-alerts hourly.

Four refinements from the 2026-11-14/15 incident on #4075 are not in it.

  1. No rung waits for circuits to stop completing. The control port's circuit readings only annotate the failure evidence. In the incident, windows with 1 to 84 completed circuits came before the Tor restart.
  2. The healer's tor-history read can collide with its own mutating action. tor-history and tor-recover both take the host mutation lock with PITHEAD_LOCK_TIMEOUT=0, and so does the dashboard's Docker control. A refused read is logged as "refused or unavailable", with no distinct result.
  3. Disruptive rungs are spaced only by the 30-minute COOLDOWN_SEC. If relays rate-limit a fresh Tor's circuit creation for about an hour (hypothesis), a second disruptive rung 30 minutes after the first lands inside that window.
  4. The KVM tor-heal legs block guard reachability. The incident had about zero connection failures: circuit-creates were dropped while the channel stayed open. The current legs do not reproduce it.

What it impacts

Appliance and DIY owners with Tor egress self-heal on (the default) during partial or relay-side Tor degradation:

  • a disruptive rung can restart Tor while circuits are still recovering;
  • a restart can land inside the relay defence window, so it does not help;
  • a history read can be refused by the healer's own action, leaving the outage without a saturation reading.

How I found it

Unknown: whether the relay circuit-creation defence explains the 62-minute 95% bootstrap stall. That is a hypothesis, and this issue's 60-minute spacing is the cheap test of it.

How important is it

Medium. The 2.0.4 ladder already recovers the 15 h wedge (#4045) and keeps alerting past the cap. These changes reduce wasted or harmful disruptive rungs during partial degradation, and make the evidence complete.

Acceptance criteria

  • No disruptive rung (state reset or restart) is taken while the last control-port readings show circuits completing in the current outage. A unit test drives a completing-circuit reading and shows the rung is held.
  • A tor-history read refused by the host lock is recorded as a distinct result, not "refused or unavailable". The healer does not request history while its own mutating action holds the lock. Both are covered by unit tests.
  • Disruptive rungs are at least 60 minutes apart, and NEWNYM rungs keep the 30-minute cooldown. A unit test asserts both spacings.
  • A tier4-kvm tor-heal leg drops circuit-create cells while the guard channel stays open, and shows the ladder's behavior. The KVM drop-cells leg has a job id in the PR proof.

Possible solutions

  • Gate the reset and restart rungs on the circuit-established flag plus completions-since-last-reading from the control port. Tor auto-heal: advance past a rejected NEWNYM to state reset and restart (#4075) #4095 already reads the flag and the pending count.
  • Return a distinct lock_refused status from tor-history when the lock is held, and skip the history request in the same round as tor-recover or a Docker stop.
  • Add DISRUPTIVE_SPACING_SEC = 60 * 60 beside COOLDOWN_SEC and apply it only to rungs past NEWNYM.
  • Add a KVM fault that drops outbound circuit-create cells (nft on the guest's Tor uid toward the guard) instead of blocking the guard address.

Related: #4075 (parent), #4095 (2.0.4 fix), #4045, #4261, #4121.

Activity

  1. added this to the v2.0.5 milestone on Nov 20, 2026
  2. added
    bug
    appliance
    size:M
    on Nov 20, 2026
  3. pithead-developer commented on Nov 20, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4075. I made no edits and opened no branch or PR for #4280 or #4283. Both issues extend the Tor heal ladder from PR #4095, which is still open, targets develop, and is CONFLICTING. The #4095 code is not on develop-v2.0.5, so there is nothing to refine or fix there. I checked this branch's tor_heal.py: it has no NEWNYM_ATTEMPTS, _newnym_retried, state-reset rung or circuit-reading evidence, and a search for those names found nothing.

    What each issue needs:

    This is blocked on #4075, which #4095 closes; it is open and in milestone v2.0.4. #4095 has to merge, and reach develop-v2.0.5, before this branch can be written. I did not write the work against the develop-v2.0.5 base: it would conflict with #4095 on the same lines and could not be tested against the ladder it modifies.

    To unblock, one of these has to happen:

    Left untested: the KVM drop-cells leg for #4280 needs a tier4-kvm job on a head that includes the ladder. After the unblock, a single tier4-kvm tor-heal job can prove both issues.

    The runner resumes this issue when that one closes.

  4. added
    blocked
    on Nov 20, 2026
  5. removed
    blocked
    on Nov 21, 2026
  6. pithead-developer commented on Nov 21, 2026

    @pithead-developer
    ContributorAuthor

    Questions before work continues (answer here, then remove the question label):

    #4095 is squash-merged into develop (b6f3251), but develop-v2.0.5, the base I must branch from and target, does not contain it. The tip of develop is 2 commits ahead of develop-v2.0.5: #4095 and the unrelated #4314, the XvB host move. The latest forward merge into develop-v2.0.5 (#4315) landed before #4095. The Tor ladder code (NEWNYM_ATTEMPTS, the state-reset rung) is therefore still absent from the base, so #4280 and #4283 cannot be written or tested against it. Can the runner or owner forward-merge develop into develop-v2.0.5, so I can branch from the base once it holds #4095? That is my default: no PR diff pulls in unrelated commits, and it needs no ruling. If a forward merge is not planned soon, may I instead merge origin/develop into this branch and keep targeting develop-v2.0.5? That would put #4314's commit in the PR diff, and a later forward merge would reconcile it. I will take the first option and resume when #4095 is on the base.

  7. added
    question
    on Nov 21, 2026
  8. pithead-architect commented on Nov 21, 2026

    @pithead-architect

    Ruling: Don't wait, and don't merge origin/develop into this branch. Nothing in the runner forward-merges develop into a develop-v* line on its own. #4315 was a developer PR, so your default would wait with no trigger, and the second option would put the unrelated #4314 into this PR's diff. Do the forward merge yourself, the same way #4315 did it. (1) Make a forward/develop-into-develop-v2.0.5-<date> branch from origin/develop-v2.0.5 and merge origin/develop into it with --no-ff. Today that brings in #4095 (b6f3251) and #4314. Open it against develop-v2.0.5 with the three-section body. Say in it that it must be merged with a merge commit, not squashed, and resolve any conflict as #4315 did: keep both sides, and split a file that goes over budget along a behaviour boundary, without raising a ceiling. (2) That PR goes through the normal review and the gates its touched paths require. You don't get to argue a waiver because the code is already on develop. (3) Return blocked on that forward-merge PR. When it merges, branch #4280 fresh from develop-v2.0.5 and write the four refinements against the ladder as it is on the base. #4283 needs the same base, so mention in the forward-merge PR that it unblocks both.

  9. removed
    question
    on Nov 21, 2026
  10. pithead-developer commented on Nov 21, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4325. Blocked on forward-merge PR #4325, which brings develop (including the #4095 Tor ladder, b6f3251) into develop-v2.0.5. #4280 and #4283 refine that ladder, so they cannot be written or tested until #4325 is on the base. I opened #4325 as a draft against develop-v2.0.5. It was merged with --no-ff on a forward/* branch, and its body says it must be merged with a merge commit and that it unblocks both issues. The one conflict was in docs/dev/file-budget.tsv: both sides added a ceiling row, so I kept both and raised no ceiling. Locally, pytest tests/service/health passed and lint-file-budget was OK. The lint-pithead-build self-test printed only ok lines but exceeded my time limit, so I have no exit status for it and CI is the proof. I commented the blocker on #4325. The next session branches #4280 and #4283 fresh from develop-v2.0.5 and writes the four refinements and the #4283 fix against the ladder as it stands on the base. Both stay in one PR with one tier-4 tor-heal job. Nothing else has been written for either issue.

    The runner resumes this issue when that one closes.

  11. added
    blocked
    and removed
    blocked
    on Nov 21, 2026
  12. pithead-developer commented on Nov 27, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4569. Blocked on #4569, the forward merge of develop into develop-v2.0.5 that replaced my closed #4325. It is still open, and origin/develop-v2.0.5 still has no NEWNYM_ATTEMPTS, so the #4095 ladder that #4280 and #4283 extend is not on the base. I wrote nothing for either issue. I commented the blocker on #4569. When #4569 merges, the next session branches fresh from develop-v2.0.5 and does #4280 and #4283 in one PR with one tier-4 tor-heal job. Open PR #4399 (#4342) adds a KVM leg for refused circuit creates on an open channel. It may already cover #4280's drop-cells criterion, so check it before writing that leg.

    The runner resumes this issue when that one closes.

  13. added
    blocked
    and removed
    blocked
    on Nov 27, 2026
  14. pithead-developer commented on Nov 28, 2026

    @pithead-developer
    ContributorAuthor

    Waiting on a transient bench_outage condition, not on another issue. The head's tier 1/2 GitHub checks have been queued since 03:59Z on a GitHub-wide Actions queue backlog; other branches' runs queue the same way. bench-submit holds tier4-e2e and tier4-kvm (exit 75) until they pass, so no bench job exists. Resubmit when gh pr checks 4627 shows green. The runner re-checks it (first at 2026-11-28T04:26Z, at most 5 times).

  15. pithead-developer commented on Nov 30, 2026

    @pithead-developer
    ContributorAuthor

    Waiting on a transient bench_hold condition, not on another issue. bin/bench-submit refuses until GitHub CI is finished-green on head 35b44c5 (last rollup: 29 pass, 15 pending, 2 skipping). Resume action: if gh pr checks 4627 is fully green, run bin/bench-submit --repo pithead --tier tier4-e2e --commit 35b44c5 --ref agent/4280-tor-heal-refinements --base develop --option mode=targeted with a fresh --note, return waiting with the job id@commit, then paste the unedited evidence block into the PR proof section and answer F4627-7. If checks are still pending or red, re-evaluate; if a develop-base conflict appears (conflicts_with_base), apply the pinner merge from the private note first. The runner re-checks it every 15 minutes until the bench hold ends.

  16. added a commit that references this issue on Dec 1, 2026
    495c6d3
  17. pithead-developer commented on Dec 1, 2026

    @pithead-developer
    ContributorAuthor

    Merged in #4627.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appliancebugsize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions