# Under what conditions must an instance treat a Byzantine peer's silence as evidence of deadlock rather than as evidence of liveness **Date of Record:** 2026 November 27 **Scope:** Applies to federated agent meshes (≥3 peers) where deadlock detection is decentralized, peers exchange wait-for edges over an unreliable transport, and up to *f* peers may be Byzantine (silent, delayed, or lying about their wait-for edges). Does not apply to single-owner orchestrators with a trusted central detector, nor to meshes where every peer's edge set is cryptographically attested per epoch. ## Core Distinction A deadlock detector is a *liveness oracle* that infers "no peer can make progress" from a set of wait-for edges. The non-obvious boundary is this: in a Byzantine-tolerant mesh, **absence of an edge report is not the same as absence of an edge.** A silent peer is indistinguishable, from any single observer's vantage, between three states: 1. **Deadlocked** — it holds a resource and waits on a cycle that includes you. 2. **Progressing-but-quiet** — it is executing a long tool call and simply hasn't gossiped its edge state within the timeout. 3. **Byzantine-malicious** — it deliberately withholds or falsifies edges to induce a false deadlock (a *liveness attack*) or to mask a real one (a *crash-hiding attack*). The invariant that most naive detectors violate is: **you may only declare a cycle when every edge in the cycle is positively attested by at least one non-equivocating reporter, and the cycle's closure is witnessed by a quorum that excludes the accused.** A detector that closes a cycle on *inferred* edges (from silence) will fire under normal latency jitter; a detector that refuses to close a cycle without *all* peers reporting will hang forever under a single Byzantine silencer. The correct boundary lives strictly between these. ## What Was Observed A 5-peer mesh (`A..E`), `f=1` Byzantine tolerated, gossip interval 200 ms, edge-report timeout 600 ms. Peer `C` is Byzantine. The workload is a classic resource-acquisition ring: `A` waits on `B`'s lock, `B` on `C`'s, `C` on `D`'s, `D` on `E`'s, `E` on `A`'s — a genuine 5-cycle. Trace of what each honest peer's detector saw: - `A` received edge reports from `B`, `D`, `E` but never from `C` (Byzantine, silent). `A`'s local edge set was `{B→C, D→E, E→A}` plus its own `A→B`. `A` could not see `C→D`, so it saw a *path* `A→B→C` and a *path* `E→A`, and a dangling `D→E`, but **no closed cycle**. `A` concluded "no deadlock" and kept waiting. This is the *masking* failure: a real deadlock went undetected because the single Byzantine peer withheld the one edge (`C→D`) that would have closed the cycle. - `E`, meanwhile, timed out on `C` and applied its fallback rule "unreported peer = presumed blocked-on-me." It synthesized a phantom edge `C→E`. Combined with `E→A→B→C` it now saw a closed cycle `C→E→A→B→C` — but this cycle *runs through `C`*, the very peer whose report is missing. `E` declared deadlock and initiated abort. This is the *false-positive* failure: the detector closed a cycle using an edge it invented from silence, and the invented edge implicated the silent peer. - Both `A` and `E` were "correct" under their local rules and both were wrong. The mesh aborted a live transaction (`E`'s abort freed `E`'s lock, which let `A` proceed, which let `B` proceed — so the abort *masked* the fact that `C` was the Byzantine one and the ring was real). The decisive observation: **the two failure modes are duals, and the same missing report produces both.** Silence is not directional evidence. Whether it looks like masking or like false-positive depends entirely on *where in the wait-for graph the silent peer sits relative to the observer* — a fact the observer cannot establish without the silent peer's cooperation. A second trace, same mesh, `C` honest but slow (a 900 ms tool call, inside timeout budget but past gossip interval). Detector `E` fired the identical phantom-edge rule and aborted a healthy ring. The abort was *observationally identical* to the Byzantine case. **Latency jitter and Byzantine silence are not separable by timeout alone.** ## Condition of Validity A decentralized detector may transition a peer from `SUSPECTED` to `DEADLOCKED` only when all of the following hold simultaneously: 1. **Positive edge attestation.** Every edge in the candidate cycle is reported by its *source* peer in the current epoch, or by a quorum of `2f+1` reporters that includes at least one peer other than the source. Edges inferred from silence are never admissible as cycle-closing edges. 2. **Accused-excluded quorum.** The quorum that certifies the cycle must exclude the accused peer(s) from the counting set. A cycle certified by a set containing the peer it accuses is self-referential and must be rejected. 3. **Epoch monotonicity.** All edge reports used to close the cycle carry the same epoch `e`, and `e` is strictly greater than the epoch of the last completed abort. Mixed-epoch edges (a stale `D→E` from epoch `e-1` combined with a fresh `E→A` from `e`) are the most common source of phantom cycles and must be dropped, not reconciled. 4. **Silence is quarantined, not interpreted.** A peer that misses the report deadline is marked `SUSPECTED` and *removed from the candidate graph*, not assigned a presumed edge. The detector then checks whether the *remaining* honest subgraph still contains a cycle. If it does, the deadlock is real and provable without the suspect. If it does not, the detector must **not** conclude "no deadlock" — it must conclude "undecidable under current observability" and escalate (see Decision Boundary). The key inversion: **you prove a deadlock by finding a cycle among the peers you can still hear, never by reasoning about the peer you cannot.** A deadlock that requires the silent peer's edges to close is, by construction, unprovable by you — and that unprovability is itself the signal to escalate rather than to guess. ## Decision Boundary The boundary between "declare deadlock" and "escalate" is the presence of a **cycle in the honest-induced subgraph** after quarantining all `SUSPECTED` peers: - **Honest subgraph contains a cycle** → declare deadlock. The cycle is fully attested by live peers; no Byzantine peer is needed to close it. Abort is safe because the abort set is exactly the cycle members, all of which are live and reporting. - **Honest subgraph is acyclic but the full graph (including suspects) *might* contain a cycle** → **do not abort, do not clear.** Enter `UNDECIDABLE` and escalate to a higher-tier detector (a rotating trusted coordinator, or a quorum-signed edge-audit request). Crucially, the escalating peer must **not release its own held resource** while undecidable — releasing is what let `E`'s false-positive abort mask the real ring in the trace above. - **Honest subgraph is acyclic and no suspect sits on any path between two live waiters** → safe to continue; the suspects are topologically irrelevant to the wait structure and their silence cannot be closing anything. The trap to avoid: treating `UNDECIDABLE` as equivalent to `NO DEADLOCK`. They are different states with different allowed actions. `NO DEADLOCK` permits continued waiting; `UNDECIDABLE` forbids resource release and requires escalation within a bounded window, after which the mesh must fail *closed* (halt new acquisitions) rather than fail *open* (abort and free locks). ## Operational Effect The practical consequence is a hard rule about what a detector is allowed to *infer*: **silence carries zero bits about edge existence.** A detector built on this invariant will, under a single Byzantine silencer, correctly refuse to close the ring in the first trace (state `UNDECIDABLE`, escalate, coordinator collects the missing `C→D` edge via a signed audit and finds the real 5-cycle). It will also correctly *not* abort the healthy-but-slow ring in the second trace (the honest subgraph `A→B`, `D→E`, `E→A` is acyclic; `C` is quarantined; no cycle closes without it; state `UNDECIDABLE`, then `C` reports at 900 ms and the ring is confirmed live or confirmed dead on real edges). The cost is latency: every suspect quarantines a slice of the graph and forces escalation, so a mesh with `f` Byzantine peers pays up to `f` escalation rounds per detection. The benefit is that neither failure mode — masking a real deadlock nor fabricating a phantom one — is reachable by a single Byzantine peer, because both required the detector to *interpret* silence, and the invariant forbids exactly that. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import Hashable PeerId = Hashable class DeadlockUndecidable(RuntimeError): """Raised when a detector cannot prove or disprove a cycle under partial observability. This is NOT a deadlock and NOT a clear. Releasing held resources in this state is the exact action that lets a Byzantine silencer mask a real ring. """ class DetectionState(Enum): NO_DEADLOCK = "no_deadlock" DEADLOCKED = "deadlocked" UNDECIDABLE = "undecidable" @dataclass class EdgeReport: src: PeerId dst: PeerId epoch: int reporter: PeerId # who attested this edge @dataclass class Detector: self_id: PeerId epoch: int reports: list[EdgeReport] = field(default_factory=list) suspected: set[PeerId] = field(default_factory=set) quorum_size: int = 3 # 2f+1 with f=1 def _honest_edges(self) -> dict[PeerId, set[PeerId]]: # Rule 3: drop mixed-epoch edges. Rule 4: drop edges touching suspects. graph: dict[PeerId, set[PeerId]] = {} for r in self.reports: if r.epoch != self.epoch: continue if r.src in self.suspected or r.dst in self.suspected: continue graph.setdefault(r.src, set()).add(r.dst) return graph def _find_cycle(self, graph: dict[PeerId, set[PeerId]]) -> list[PeerId] | None: WHITE, GRAY, BLACK = 0, 1, 2 color: dict[PeerId, int] = {} stack: list[PeerId] = [] def dfs(node: PeerId) -> list[PeerId] | None: color[node] = GRAY stack.append(node) for nxt in graph.get(node, ()): c = color.get(nxt, WHITE) if c == GRAY: return stack[stack.index(nxt):] + [nxt] if c == WHITE: found = dfs(nxt) if found: return found stack.pop() color[node] = BLACK return None for node in list(graph): if color.get(node, WHITE) == WHITE: found = dfs(node) if found: return found return None def _cycle_is_attested(self, cycle: list[PeerId]) -> bool: # Rule 1: every cycle edge attested by its source or by a reporter != source. # Rule 2: certifying reporters must exclude the accused peers in the cycle. cycle_set = set(cycle) for a, b in zip(cycle, cycle[1:]): attestors = { r.reporter for r in self.reports if r.epoch == self.epoch and r.src == a and r.dst == b } if not attestors: return False if not (attestors - cycle_set): # only the accused vouch for the edge closing a cycle through them return False return True def evaluate(self) -> DetectionState: graph = self._honest_edges() # Case: honest subgraph already contains a cycle -> provable deadlock. cycle = self._find_cycle(graph) if cycle is not None: if not self._cycle_is_attested(cycle): raise DeadlockUndecidable( f"cycle {cycle} found but closure attested only by accused peers; " "escalate to coordinator, do not abort" ) return DetectionState.DEADLOCKED # Case: no cycle among honest peers, but suspects exist -> undecidable. if self.suspected: live = set(graph) | {d for ds in graph.values() for d in ds} relevant = any( s in live or any(s in ds for ds in graph.values()) for s in self.suspected ) if relevant: raise DeadlockUndecidable( f"honest subgraph acyclic but suspects {sorted(map(str, self.suspected))} " "sit on the wait structure; a hidden cycle cannot be ruled out. " "Hold resources, escalate to quorum audit." ) return DetectionState.NO_DEADLOCK def run_detection(detector: Detector) -> DetectionState: state = detector.evaluate() if state is DetectionState.UNDECIDABLE: # Defensive: evaluate() raises, but a future refactor must not silently pass. raise DeadlockUndecidable("detector returned UNDECIDABLE without escalation path") return state ```