Why does an instance borrow a tool under a narrowed scope and still execute the un-narrowed capability?

**Date of Record:** 2026 December 1 **Scope:** Applies to cross-organizational A2A/MCP-style capability negotiation where a lender agent advertises a tool with a declared capability schema and a borrower agent requests a least-privilege projection of it (a subset of parameters, a narrowed enum, a reduced resource selector). Does not apply to single-org tool calls where the caller and callee share one policy authority, nor to pure schema-versioning mismatches with no scope projection.

Core Distinction

The failure is not a permission *denial*. It is a permission *downgrade that succeeds at the negotiation layer and is silently discarded at the execution layer*. Two distinct artifacts exist and they are routinely conflated:

  1. The **negotiated capability descriptor** — the JSON Schema / manifest that the lender returns in the handshake, carrying the borrower's requested narrowing (e.g. `region: enum[us-east-1]`, `max_rows: 100`, `fields: [id, status]`).
  2. The **execution binding** — the actual tool implementation the lender invokes when the borrower's request arrives, which was registered against the *original, un-narrowed* schema and dispatches on the *original* parameter space.

A conformant borrower validates its own outgoing call against the negotiated descriptor. It therefore believes the narrowing is enforced. But the lender's dispatcher validates against the *original* descriptor (or, worse, against nothing, trusting the handshake), so parameters outside the negotiated subset are accepted and executed. Least-privilege is asserted at the contract and absent at the syscall. This is a **scope-projection laundering** failure: the narrowing survives negotiation but not dispatch.

What Was Observed

A borrower agent in org A negotiated access to a lender tool in org B: `warehouse.query(sql, region, max_rows)`. A requested and received a narrowed descriptor pinning `region` to `us-east-1` and `max_rows` to `100`, with `sql` constrained to a read-only grammar. The handshake completed, both sides logged `capability_granted` with the narrowed schema hash.

On first real invocation the borrower sent `region=us-east-1, max_rows=100` as required. The lender's dispatcher, however, had been registered with the *original* handler that read `region` from an optional field defaulting to `"*"` and ignored `max_rows` entirely (it was a hint, not a limit, in the original contract). Because the borrower supplied `region=us-east-1` explicitly, that call was fine. The failure surfaced on the *second* call: the borrower's planner, having internalized the narrowed descriptor, omitted `region` believing the default was now pinned to `us-east-1`. The dispatcher filled its own default `"*"`, executed a cross-region scan, and returned rows from `eu-west-1` and `ap-south-1`. The borrower received data outside its granted scope, validated it happily against the negotiated descriptor (which said the response was `rows`), and wrote it into its episodic store.

The trace:

handshake:  borrower.negotiate(tool, projection={region:[us-east-1], max_rows:100})
            -> lender returns descriptor D' (narrowed), hash h'
            -> lender binds handler H (original, un-narrowed)   <-- divergence point
call 1:     borrower -> {region:us-east-1, max_rows:100} -> H -> ok
call 2:     borrower -> {max_rows:100}  (region omitted, "pinned by D'")
            -> H default region="*" -> cross-region rows
            -> borrower validates response shape only -> accepts

The invariant that broke: *the descriptor returned at negotiation must be the descriptor the dispatcher enforces at execution, or the borrower must be unable to rely on defaults it did not send.* Neither held.

Condition of Validity

The narrowing is only sound when **every field the borrower is permitted to omit has a dispatcher-side default equal to the negotiated pin**. Formally, for each parameter `p` with negotiated constraint `C_p`:

The failure is *latent* whenever the borrower always sends all narrowed fields explicitly — it hides until the planner learns to trust the pin and elides a default. That latency is why it survives integration testing: the happy-path test sends everything, the dispatcher's loose default is never exercised, and the grant looks correct.

A second validity condition concerns **response scoping**. Narrowing the request does not narrow the response. If the borrower requested `fields:[id,status]` but the handler returns full rows, the borrower's validator (checking only that `rows` is an array) accepts the over-broad payload. Response projection must be enforced by the lender's serializer against `C_response`, not by the borrower's optimism.

Decision Boundary

The boundary is drawn at **who owns default resolution**:

Concretely: a narrowing that changes a field from optional-with-broad-default to pinned-narrow is **not a projection of the original schema** — it is a semantic change. Projections that only *remove* parameters or *tighten* enums on required fields are safe to express as a subset descriptor. Projections that *change default semantics* are not, and must be represented as an explicit required-field contract or a scope token, or they will be silently un-enforced.

Operational Effect

Downstream, the over-broad rows entered the borrower's episodic memory tagged with the narrowed grant's provenance. On later retrieval, the borrower's policy layer saw rows whose provenance claimed `region=us-east-1` while the data was demonstrably multi-region — a **provenance/scope contradiction** that poisons any downstream auditor that trusts the tag. Recovery required invalidating the entire episodic segment written since the grant, not just the offending call, because the borrower could not reconstruct which rows arrived under the elided-default path. The blast radius of a scope-projection laundering failure is therefore *the grant's lifetime*, not the single call.

Guardrail: the borrower must log, per call, the *effective* scope it believes applied and refuse to persist results whose provenance cannot be reconciled with the values it actually transmitted. The lender must hash-bind the execution handler to the negotiated descriptor at grant time (`handler.schema_hash == descriptor.hash`) and reject dispatch on mismatch. Either side alone is insufficient; both are needed because the divergence is invisible to each in isolation.

import hashlib
from dataclasses import dataclass, field


class ScopeProjectionLaundering(RuntimeError):
    """Raised when a negotiated narrowed capability is not enforced at dispatch."""
    pass


@dataclass
class CapabilityDescriptor:
    fields: dict            # name -> {"required": bool, "allowed": set|None, "default": any}
    schema_hash: str = ""

    def __post_init__(self):
        raw = repr(sorted(self.fields.items())).encode()
        self.schema_hash = hashlib.sha256(raw).hexdigest()


@dataclass
class ExecutionBinding:
    handler_schema_hash: str
    defaults: dict = field(default_factory=dict)

    def dispatch(self, descriptor: CapabilityDescriptor, call: dict) -> dict:
        # Invariant 1: handler must be bound to the negotiated descriptor.
        if self.handler_schema_hash != descriptor.schema_hash:
            raise ScopeProjectionLaundering(
                f"handler bound to {self.handler_schema_hash[:8]} but "
                f"descriptor is {descriptor.schema_hash[:8]}; dispatch refused"
            )
        resolved = {}
        for name, spec in descriptor.fields.items():
            if name in call:
                val = call[name]
                if spec["allowed"] is not None and val not in spec["allowed"]:
                    raise ScopeProjectionLaundering(
                        f"{name}={val!r} outside negotiated scope {spec['allowed']}"
                    )
                resolved[name] = val
            elif spec["required"]:
                raise ScopeProjectionLaundering(
                    f"required narrowed field {name!r} omitted; no default permitted"
                )
            else:
                default = spec.get("default")
                if spec["allowed"] is not None and default not in spec["allowed"]:
                    # The exact latent bug: dispatcher default escapes the pin.
                    raise ScopeProjectionLaundering(
                        f"default for {name!r} ({default!r}) violates negotiated "
                        f"scope {spec['allowed']}; borrower may not elide this field"
                    )
                resolved[name] = default
        return resolved


def negotiate_and_call(borrower_request: dict) -> dict:
    # Lender narrows region to us-east-1 and max_rows to 100.
    narrowed = CapabilityDescriptor(fields={
        "region":   {"required": False, "allowed": {"us-east-1"}, "default": "us-east-1"},
        "max_rows": {"required": False, "allowed": {100}, "default": 100},
    })
    # Dispatcher registered against the ORIGINAL schema -> hash mismatch.
    original_hash = CapabilityDescriptor(fields={
        "region":   {"required": False, "allowed": None, "default": "*"},
        "max_rows": {"required": False, "allowed": None, "default": 1000},
    }).schema_hash
    binding = ExecutionBinding(handler_schema_hash=original_hash)
    return binding.dispatch(narrowed, borrower_request)


if __name__ == "__main__":
    try:
        negotiate_and_call({"max_rows": 100})  # borrower elides region, trusting the pin
    except ScopeProjectionLaundering as exc:
        print(f"BLOCKED: {exc}")