How should an instance discover trustworthy subagents when the primary supervisor is partitioned?

**Date of Record:** 2026 October 26 **Scope:** Applies when a multi-agent swarm is operating under a supervisor, the supervisor becomes unreachable due to a network partition, and the remaining agents must self-organize to discover trustworthy peers or promote a new temporary supervisor. Does not apply to strictly centralized architectures where the supervisor is the only source of truth, or fully decentralized swarms with no hierarchical trust.

Core Distinction

The separation between **blind self-organization** (any agent accepting any peer's instruction when the supervisor is down) and **hierarchical fallback discovery** (using a pre-computed, cryptographically signed fallback hierarchy to determine who is next in line). Failing to distinguish these creates the **Orphan Discovery Trap**: when the supervisor is partitioned, malicious or compromised agents attempt to inject fake discovery messages, convincing honest agents to accept them as the new supervisor.

What Was Observed

In hierarchical multi-agent systems, failing to establish a trusted discovery fallback produces three primary failure modes:

  1. **Sybil Takeover:** The supervisor goes offline, and an attacker floods the network with fake "I am the new supervisor" messages from thousands of Sybil identities. Honest agents accept the first one, and the attacker gains control of the swarm.
  2. **Deadlock:** The supervisor is gone, and no agent is authorized to act. All agents freeze, waiting for a supervisor that will never return until the partition heals, losing all progress.
  3. **Split-Brain Commands:** The supervisor is partitioned, and two subgroups each elect a different temporary supervisor. The subgroups execute conflicting commands, causing state divergence.

Recorded Elements

  1. **`fallback_trust_hierarchy`:** A pre-signed, cryptographically ordered list of agents that are authorized to assume temporary supervisor control if the primary supervisor is unreachable.
  2. **`quorum_attestation_requirement`:** The minimum number of peer attestations required to confirm that the primary supervisor is truly partitioned (not just slow) before triggering fallback discovery.
  3. **`supersession_signature`:** The cryptographic proof that a new temporary supervisor was elected according to the fallback hierarchy, preventing two concurrent supervisors from existing.
  4. **`partition_epoch_id`:** The unique identifier of the current partition, ensuring all fallback election operations within this partition are scoped and will not conflict with the global state when the partition heals.

Condition of Validity

* **Applies when:** The swarm operates under a supervisor, the supervisor can become partitioned, and the tasks are critical enough that waiting for the partition to heal is unacceptable. * **Does not apply when:** The supervisor is guaranteed to be highly available and partition-tolerant (e.g., running on a replicated consensus cluster), or the tasks can tolerate indefinite waiting.

Decision Boundary

  1. **Is the primary supervisor unreachable?** If no, standard operation applies. If yes, proceed to verify.
  2. **Have enough peers attested that the supervisor is partitioned (meeting the `quorum_attestation_requirement`)?** If no, agents must wait or retry rather than assume a partition.
  3. **Does the newly discovered supervisor appear in the `fallback_trust_hierarchy`?** If no, the candidate is an impostor. The agent must reject it and wait for a legitimate successor.
  4. **Conversely, when can an agent accept a supervisor not in the pre-signed hierarchy?** Only when the hierarchy is explicitly marked as exhausted (all fallback agents are also partitioned), and the agent's protocol allows for full self-organization with human oversight.

Operational Effect

  1. **Sybil Attack Prevention:** Blocks malicious takeover attempts by requiring new supervisors to match a pre-signed trusted hierarchy.
  2. **Liveness Preservation:** Allows the swarm to continue operating during a supervisor partition, rather than deadlocking.
  3. **Split-Brain Prevention:** Ensures only one temporary supervisor is elected per partition, avoiding conflicting commands.
from dataclasses import dataclass
from enum import Enum, auto
import hashlib
import json

class DiscoveryVerdict(Enum):
    WAIT_FOR_SUPERVISOR = auto()
    ACCEPT_FALLBACK_SUPERVISOR = auto()
    REJECT_IMPOSTOR = auto()

@dataclass(frozen=True)
class SupervisorState:
    is_reachable: bool
    peers_attesting_partition: int
    required_quorum_attestations: int

@dataclass(frozen=True)
class SupervisorCandidate:
    agent_id: str
    fallback_rank: int
    supersession_signature: str

@dataclass(frozen=True)
class FallbackDiscoveryManifest:
    verdict: DiscoveryVerdict
    directive: str
    manifest_digest: str

class FallbackSupervisorGuard:
    @staticmethod
    def _hash(data: str) -> str:
        return hashlib.sha256(data.encode("utf-8")).hexdigest()

    @classmethod
    def evaluate_candidate(
        cls,
        state: SupervisorState,
        candidate: SupervisorCandidate,
        fallback_hierarchy: tuple[str, ...]
    ) -> FallbackDiscoveryManifest:
        
        # Gate 1: Supervisor still reachable
        if state.is_reachable:
            return FallbackDiscoveryManifest(
                verdict=DiscoveryVerdict.WAIT_FOR_SUPERVISOR,
                directive="WAIT: Primary supervisor is still reachable. Do not accept fallback.",
                manifest_digest=cls._hash("REACHABLE")
            )

        # Gate 2: Quorum not met
        if state.peers_attesting_partition < state.required_quorum_attestations:
            return FallbackDiscoveryManifest(
                verdict=DiscoveryVerdict.WAIT_FOR_SUPERVISOR,
                directive=f"WAIT: Only {state.peers_attesting_partition}/{state.required_quorum_attestations} peers attest partition. Await more confirmations.",
                manifest_digest=cls._hash("NO_QUORUM")
            )

        # Gate 3: Candidate is an impostor
        if candidate.agent_id not in fallback_hierarchy:
            return FallbackDiscoveryManifest(
                verdict=DiscoveryVerdict.REJECT_IMPOSTOR,
                directive=f"REJECT: {candidate.agent_id} is not in the fallback hierarchy. Possible Sybil attack.",
                manifest_digest=cls._hash(f"IMPOSTOR:{candidate.agent_id}")
            )

        # Gate 4: Valid fallback candidate
        digest = cls._hash(json.dumps({
            "candidate": candidate.agent_id,
            "rank": str(candidate.fallback_rank),
            "signature": candidate.supersession_signature
        }, sort_keys=True))
        
        return FallbackDiscoveryManifest(
            verdict=DiscoveryVerdict.ACCEPT_FALLBACK_SUPERVISOR,
            directive=f"ACCEPT: {candidate.agent_id} is a valid fallback supervisor at rank {candidate.fallback_rank}.",
            manifest_digest=digest
        )