# What structural signals indicate a capability-negotiation deadlock when two agents advertise overlapping-but-non-substitutable skill schemas **Date of Record:** 2026 November 29 **Scope:** Applies to peer-to-peer agent meshes using declarative capability manifests (MCP `tools/list`, A2A Agent Cards, or equivalent) where a caller selects a callee by matching a task intent against advertised skill schemas. Does not apply to statically wired single-callee tool use where the caller has no discovery step. ## Core Distinction The failure this record isolates is **not** "no agent has the capability." It is the case where *both* agents advertise a skill whose `name`, `description`, and top-level parameter set intersect, but whose **preconditions, side-effect class, or return contract are disjoint** — and neither manifest exposes that disjointness. The negotiation protocol treats schema overlap as substitutability. It is not. A caller that resolves intent→skill by cosine similarity over descriptions or by name collision will bind to the wrong callee and only discover the mismatch *after* the side effect has fired. The distinguishing structural signal is this: **two manifests agree on the input schema while disagreeing on the implicit postcondition.** The protocol has no field for postconditions, so the disagreement is invisible at negotiation time and surfaces only as a downstream failure in the caller's reasoning loop. ## What Was Observed A planner agent (`P`) needed to "reconcile a ledger against a bank statement." Discovery returned two candidate callees: - `ledger.reconcile` — advertised input `{account_id, period}`, description "reconcile account against external records." Idempotent, read-only, returns a diff object. - `bank.reconcile` — advertised input `{account_id, period}`, description "reconcile account against external records." **Non-idempotent, mutating**: it posts adjustment entries to the ledger and returns a mutation receipt, not a diff. The input schemas were byte-identical. Description strings were near-identical (embedding cosine 0.97). `P` had no field distinguishing side-effect class, so it ranked by description similarity, broke the tie by discovery order, and selected `bank.reconcile`. The trace: 1. `P` issues `reconcile(acct=4471, period=Q1)`. 2. `bank.reconcile` executes, posts 12 adjustment entries, returns `{receipt_id, entries_posted: 12}`. 3. `P` expects a diff object, receives a receipt. Its output-parsing step fails schema validation. 4. `P` applies its retry policy — a *retry* of a mutating call — and posts 12 more entries. 5. The ledger is now double-adjusted. `P`'s local model of the world ("I have not yet reconciled") is false, but nothing in the returned receipt contradicts it, because `P` never parsed the receipt. The compounding signal: the retry policy was correct for an idempotent callee and catastrophic for a mutating one. **The negotiation layer never communicated idempotency, so the caller's retry semantics defaulted to the wrong class.** ## Condition of Validity This failure requires all three conditions simultaneously; remove any one and the deadlock does not form: 1. **Schema-overlap without side-effect disclosure.** The manifests must agree on inputs while omitting (or mislabeling) idempotency / mutation class / return-contract type. If either manifest carries an explicit `side_effects: mutating` or a typed return contract, the caller can discriminate. 2. **Similarity-based resolution.** The caller must resolve ambiguity by description embedding, name collision, or discovery order rather than by an explicit capability predicate. A caller that requires a `read_only: true` filter before matching is immune. 3. **A retry or re-plan loop downstream.** The wrong selection is only *destructive* when the caller's error-recovery path re-invokes the callee. A caller that halts on parse failure and escalates to a human contains the blast radius to one mutation. The invariant violated: **a capability manifest must be a total function from (intent, required postcondition) to a uniquely admissible callee, or it must fail closed.** Overlapping-but-disjoint manifests make the resolution function non-total, and the protocol silently picks an arbitrary branch. ## Decision Boundary The boundary is between *discriminating at negotiation time* and *discriminating after execution*. Operationally: - **Below the boundary (safe):** the caller filters candidates on a **required-postcondition predicate** — e.g. `required: {idempotent: true, return_type: "diff"}` — before any similarity ranking. Callees that cannot prove the predicate are excluded, not down-ranked. If zero callees satisfy the predicate, the caller **must** fail closed and escalate; it must not fall back to best-similarity. - **Above the boundary (unsafe):** similarity ranking over descriptions or input schemas alone, with postcondition checking deferred to output validation. This is the regime that produced the double-post. The precise guardrail: **selection is admissible only if the chosen callee's manifest carries an explicit, machine-checkable postcondition token that the caller's required predicate matches exactly.** Description similarity is permitted only to rank *within* an already-postcondition-filtered candidate set — never to break a tie across side-effect classes. A second structural signal worth encoding: when two manifests share an input schema but the string-identical description maps to different `return_type` or `idempotency` values, that is a **manifest collision** and should raise at discovery time, not at execution time. Collisions are cheap to detect and expensive to discover late. ## Operational Effect After enforcing postcondition-filtered selection, the observed system changed in three measurable ways: 1. **Wrong-callee bindings dropped to zero** on the reconcile workload, because `bank.reconcile` (mutating) was excluded before ranking whenever the intent required a read-only diff. 2. **Retry amplification was eliminated** for mutating callees: because the caller now knows the side-effect class at bind time, it applies at-most-once semantics to mutating callees and retry-with-backoff only to idempotent ones. 3. **Discovery latency rose slightly** (one extra predicate-evaluation pass over the candidate set) but **escalation rate rose correctly**: intents with no admissible callee now surface as explicit `NoAdmissibleCallee` conditions rather than silent mis-binds. Fail-closed is the desired outcome; a silent wrong bind is not. The residual risk: manifests that *lie* about their postcondition (advertise `idempotent: true` but mutate). That is a trust/attestation problem, not a negotiation problem, and must be handled by signed manifests or post-execution reconciliation — outside this record's scope. ```python from dataclasses import dataclass, field from typing import Optional class CapabilityNegotiationError(RuntimeError): """Raised when capability resolution cannot produce a uniquely admissible callee.""" pass class ManifestCollisionError(CapabilityNegotiationError): """Two manifests overlap on input schema but disagree on postcondition class.""" pass @dataclass(frozen=True) class Manifest: skill: str input_schema: frozenset idempotent: bool return_type: str mutating: bool description: str @dataclass(frozen=True) class RequiredPostcondition: idempotent: Optional[bool] = None return_type: Optional[str] = None read_only: bool = False def _postcondition_ok(m: Manifest, req: RequiredPostcondition) -> bool: if req.read_only and m.mutating: return False if req.idempotent is not None and m.idempotent != req.idempotent: return False if req.return_type is not None and m.return_type != req.return_type: return False return True def resolve( candidates: list[Manifest], required: RequiredPostcondition, ) -> Manifest: # Detect manifest collisions: same input schema, disjoint postcondition class. for i, a in enumerate(candidates): for b in candidates[i + 1:]: if a.input_schema == b.input_schema and ( a.idempotent != b.idempotent or a.mutating != b.mutating or a.return_type != b.return_type ): raise ManifestCollisionError( f"manifests {a.skill!r} and {b.skill!r} share input schema " f"but disagree on postcondition class " f"(idempotent={a.idempotent}/{b.idempotent}, " f"mutating={a.mutating}/{b.mutating}, " f"return_type={a.return_type}/{b.return_type}); " f"resolution would be non-total" ) admissible = [m for m in candidates if _postcondition_ok(m, required)] if not admissible: # Fail closed. Never fall back to best-similarity across side-effect classes. raise CapabilityNegotiationError( f"no callee satisfies required postcondition {required}; " f"refusing similarity fallback" ) if len(admissible) > 1: # Multiple admissible callees are only safe if they share postcondition class; # rank by description similarity is permitted *here* and only here. raise CapabilityNegotiationError( f"ambiguous admissible set {[m.skill for m in admissible]}; " f"requires explicit disambiguation" ) return admissible[0] def bind_and_execute( candidates: list[Manifest], required: RequiredPostcondition, invoke, ): callee = resolve(candidates, required) if callee.mutating and not callee.idempotent: # At-most-once semantics for mutating, non-idempotent callees. try: return invoke(callee.skill, at_most_once=True) except Exception as e: raise CapabilityNegotiationError( f"mutating callee {callee.skill!r} failed; " f"NOT retrying (non-idempotent). Manual reconciliation required." ) from e return invoke(callee.skill, at_most_once=False) ```