Skip to content

design: transport adapter contract — declarations, levels, asymmetric routing (multi-transport head) #13929

Backlog

Description

@dezren39

Design: the transport adapter contract (multi-transport head design)

Parent epic: #13926 — Multi-transport reach: any protocol as a carrier. Direction recorded on #13752 (comment 7118605020). This is the programme's head design: everything else in the epic plugs into the contract defined here.

1. Problem + context (with evidence)

Drew's direction (2026-11-23): the P2P / ID / fleet stack should be reachable over many alternate transports and proxied alternate systems — Spritely-style relays, Tor, Noise, ActivityPub, ATProto, email, MQTT, HTTP/REST, MCP, IRC, Zulip, Slack, Discord bots, Gopher, Gemini, telnet beside SSH, physical media — each at a declared level (read / bidirectional / write-capable / sync-equivalent), with asymmetric send/receive paths as a first-class requirement ("send over carrier pigeon, receive over fax" is a design requirement, not a joke).

Today every path we have invented its own shape, because no contract exists:

Four instances, four shapes. Each new carrier added ad hoc multiplies integration and security-review cost, and nothing today can express "reachable at read level over X, writable over Y, replies come back over Z" — the asymmetry Drew requires.

2. Goals and non-goals

Goals

  • One adapter contract that every carrier family in the epic's inventory can be expressed in without special cases.
  • Every adapter declares its properties up front (machine-readable), including its level per direction.
  • Asymmetric routing as a core property of the message envelope, not an adapter feature.
  • Identity on every path binds back to the fleet CA / ID identity — or the gap is explicitly declared (proxies).
  • Levels are proven live before they are recorded as held.

Non-goals

3. Alternatives considered

  • Do nothing; keep adding transports ad hoc. Cheapest this quarter; the four existing instances show the cost curve — every new path re-invents addressing, gating, and metering, and asymmetry stays inexpressible. Rejected.
  • One central gateway service translating everything. Single custody and trust point; contradicts the federated/stateless direction of the relay work and design: fleet transport & pooling — host selection without Tailscale, iroh for non-Muse agents, generic pool primitive #13752. Rejected.
  • Adopt a multi-transport library wholesale (libp2p-style). Strong for overlay transports; silent on email, chat proxies, federation protocols, and physical media. Kept as a component choice inside individual adapters, not as the contract.
  • A thin contract: declaration + routing core, adapters independent (chosen). The contract standardises only what must agree — declarations, envelope, routing, gating, metering — and leaves each adapter's internals free.

4. The contract

4.1 What every adapter must declare

A machine-readable adapter declaration (the registry entry):

Field Meaning
name, version Adapter identity
shape transport or proxy (see §4.4)
addressing How a peer/user is named on this carrier, and the mapping to fleet-CA / ID identity
levels Level held per direction (send / receive), from §4.2
delivery At-most-once / at-least-once; ordering guarantee; whether causal metadata survives; latency class; size limits; offline behaviour
identity_binding cryptographic (end-to-end, both ends are our stack) / mapped (proxy-held mapping table) / none (public read-only)
capability_gating What capability a sender needs at each level; how revocation reaches this path
metering What is counted (messages / bytes / actions) and where the counter lives
custody (proxies only) Who holds the platform credentials; the platform trust statement; the translation boundary (§4.4)

4.2 The four levels, defined precisely

  • read — the adapter delivers inbound messages/observations to the stack. No outbound path exists or is used. (Delivery semantics still matter: read over email is durable and complete; read over a chat system is an editable, deletable stream. The declaration says which.)
  • bidirectional — messages flow both ways over this adapter. Not necessarily one connection: an email adapter declaring SMTP-out + IMAP-in is one adapter at bidirectional.
  • write-capable — the stack can originate state-changing actions on the far side (post, publish, execute), not merely messages. Distinct from bidirectional because writes carry authority: this level requires the capability-gating declaration to be non-empty.
  • sync-equivalent — the adapter can carry the data plane's full sync protocol (per investigation: capability auth + p2p transport — p2panda-first, honestly compared #13779's compositions) with convergence intact: causal metadata survives, bulk transfer works, withholding/replay behaviour is declared. Reference instances: sneakernet bundles (design(id-apps): D4 — sneakernet bundles for ID #13889), iroh-class transports.

4.3 Asymmetric routing rules

  1. Every message envelope carries an explicit reply route (adapter + address). A sender never assumes the reply arrives on the path it sent on.
  2. The routing core selects the send adapter and the expected receive adapter independently; a route is a (send, receive) pair, either side of which may be any registered adapter at a sufficient level.
  3. Delivery receipts, where an adapter supports them, travel the declared reply route.
  4. Timeouts and failure handling are per-direction: a dead send path says nothing about the receive path.
  5. Level checks apply per direction against the pair: e.g. a write sent over a write-capable adapter may legitimately receive its result over a read-level adapter.

4.4 Transport adapter vs proxied alternate system

Drew listed both shapes deliberately; the contract treats them differently.

  • A transport adapter carries the stack's own messages end-to-end. The far end is another instance of our stack (or a peer implementing the same contract). Identity binds cryptographically at both ends; the carrier sees framing/ciphertext, not content or authority.
  • A proxied alternate system terminates at a platform we do not control — a Discord/Zulip/Slack bot, an ActivityPub server. The proxy speaks the platform's protocols in the platform's identity model; messages are translated at the proxy boundary; the far end may be a human, not our stack. Identity binding is a mapping table held by the proxy, not a cryptographic property of the path. The platform can read, retain, rate-limit, and revoke.

Consequences in the contract: a proxy must additionally declare custody (who holds the platform credentials), the translation boundary (which message types survive translation, and what is lost), and a trust statement (what the platform operator can see and do). Gating differs: a transport adapter gates by capability end-to-end; a proxy gates at the proxy, whose own authority is its platform identity plus its mapping table — so a compromised proxy can forge within its platform scope, and proxy declarations must state that scope as a ceiling.

4.5 Security analysis per level

  • read: inbound injection and spoofing are the risks. Per the design: fleet transport & pooling — host selection without Tailscale, iroh for non-Muse agents, generic pool primitive #13752 ticket doctrine, the carrier is untrusted: authenticate the payload (signatures, CA binding), never the channel. A read adapter must not let carrier-side metadata (sender fields, headers) become identity claims.
  • bidirectional: adds session confusion and cross-path correlation, plus downgrade: a peer reachable at sync level on a strong path must not be trickable into accepting write authority asserted over a weaker path. Authority claims are verified against the capability, not the path — and the path's declared level caps what may be accepted from it.
  • write-capable: adds authority amplification and confused-deputy risk (worst at proxies, §4.4). Revocation propagation must be declared: on a store-and-forward path (email, sneakernet), a revoked capability may still be in flight — the receiving side verifies at receipt time, never at send time.
  • sync-equivalent: adds full-state exposure to the path and convergence attacks (withholding, replay, selective delivery on store-and-forward media). Bundles verify before merge (design(id-apps): D4 — sneakernet bundles for ID #13889's rule); replay windows and ordering claims live in the delivery declaration.

4.6 Data model

Three durable objects: the adapter declaration (above), the route (a named (send-adapter, receive-adapter, address-mapping) triple a peer or service is reachable by), and the envelope (payload + reply route + capability reference + per-path metadata the declared delivery semantics require). No other shared state; adapters keep their own internals.

5. Proposed first-adapter order (grounded in what exists)

  1. HTTP/REST, by formalising the bridge (Bridge: class/name notes, public wake signal, and Archer hook #13895) — code exists; proves the declaration shape against a real adapter at near-zero build cost.
  2. Email — already designed as a bootstrap carrier in design: fleet transport & pooling — host selection without Tailscale, iroh for non-Muse agents, generic pool primitive #13752 (Delta Chat pattern is researched); store-and-forward makes it the natural first proof of asymmetric routing.
  3. MCP, by formalising the mcpx door (mcpx: public endpoint at mcpx.security.cab with OAuth/Google-SSO front door and machine bearer #13657) — live today; validates the contract against a request/response tool protocol rather than a message protocol.
  4. MQTT — first true pub/sub bus; small, well-understood; its QoS levels stress-test the delivery-semantics vocabulary.
  5. Sneakernet bundles — rides design(id-apps): D4 — sneakernet bundles for ID #13889's D4 design; becomes the sync-equivalent reference instance.
  6. IRC as the first proxied system — simplest chat shape, relay-friendly, no platform gatekeeper; then Zulip / Slack / Discord bots under the proven proxy rules.
  7. Federation protocols (ActivityPub, ATProto) — largest surface; their native identity models must be reconciled with the CA binding deliberately.
  8. Overlay/relay transports (Spritely-style Noise XK relays, Tor) — deepest work; builds on design: fleet transport & pooling — host selection without Tailscale, iroh for non-Muse agents, generic pool primitive #13752's own roadmap.
  9. Gopher / Gemini / telnet — small, well-specified; cheap wins that prove less about the contract, so they are opportunistic (any free lane) rather than sequenced blockers.

6. Build slices (dependency-ordered; each sized for one lane/session)

  • S1 — Contract + declaration schema + registry. The §4 contract as a dated design record in doc/ plus a machine-readable declaration schema and a registry home. Acceptance: the four existing instances (bridge, mcpx door, email-bootstrap, sneakernet) are each expressed as declarations with no special cases; schema validation runs in CI.
  • S2 — Routing core. Envelope with explicit reply route; independent send/receive adapter selection; per-direction level checks. Acceptance: loopback test adapters demonstrate the pigeon/fax case in tests — send via adapter A, reply via adapter B — plus downgrade rejection (§4.5).
  • S3 — Bridge formalised as the HTTP adapter. Acceptance: bridge registered with its true levels; existing behaviour unchanged; metering counters emitted.
  • S4 — Email adapter. Acceptance: live round trip between two stack identities over email only; cross-adapter asymmetric proof (email out, HTTP in) passes; revocation verified at receipt.
  • S5 — MCP adapter formalisation. Acceptance: mcpx door expressed as a declaration; a tool call routed through the contract's envelope.
  • S6 — MQTT adapter. Acceptance: pub/sub round trip; declared QoS mapping honoured; offline queueing matches the declaration.
  • S7 — Proxy shape proven with IRC. Acceptance: custody/translation/trust declarations written and reviewed; read + bidirectional live; write off by default and gated when enabled.
  • S8 — Sneakernet adapter formalisation (with design(id-apps): D4 — sneakernet bundles for ID #13889). Acceptance: bundle round trip declared and proven sync-equivalent; verify-before-merge enforced.

Follow-on families (federation, overlays/Tor, Gopher/Gemini, telnet, Zulip/Slack/Discord) are filed as children of #13926 once S1–S8 evidence exists, in the §5 order.

7. Rollout + rollback

The contract is additive: nothing existing changes behaviour. Adapters join by registering a declaration; an adapter is disabled by removing its registration (one flip, mirroring the provider enable/disable rule). Rollback for any slice is deregistration; the primary broker/iroh path is untouched throughout.

8. Verification plan

  • A conformance test kit from S2 onward: every new adapter runs the same suite — declaration validation, per-level live proof, the asymmetry test, metering check — before its levels are recorded as held.
  • Each slice's acceptance criteria (above) are verified live, with the proof recorded on the slice's issue.
  • Security checks from §4.5 are test cases, not review comments: downgrade rejection (S2), receipt-time revocation (S4), proxy scope ceiling (S7).

9. Open questions (each with a named decider)

  • Q1. Does the contract live at the fleet layer, the ID layer, or a shared library both consume? — Decider: Drew (on Archer's recommendation; the four instances span both layers today).
  • Q2. May a proxied system ever hold sync-equivalent? (Recommendation: no — proxies cap at write-capable.) — Decider: Drew.
  • Q3. Metering: per-adapter counters only, or unified into the fleet/PM metering plane? — Decider: Archer (implementation detail within the existing metering direction).
  • Q4. Telnet: in scope only behind a relay/overlay, never plaintext on an uncontrolled segment? — Decider: Drew.
  • Q5. Federation identity (ActivityPub/ATProto): fleet-CA cross-certification, or mapping-table treatment like proxies? — Decider: Drew.

Links

Epic #13926 · transport design #13752 · P2P synthesis #13779 · ID-graph epic #13880 · sneakernet D4 #13889 · bridge #13895 · mcpx door #13657 · ID wire-format neighbour #5674

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-24T00:58:40Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Activity

  1. developing-today commented on Nov 24, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    S1 declaration/schema boundary: the Draft 2020-12 schema, four-entry registry, CI workflow, and dated contract record are now drafted in lane oc-code-05 worktree oc-code-05/13929-s1. Local oracle passes: nix shell nixpkgs#check-jsonschema -c check-jsonschema --schemafile config/transport-adapters/schema.json config/transport-adapters/registry.json → ok -- validation done (4 declarations, 0 schema errors); git diff --check passes. Next: review the assembled diff, commit, open a merged-ready PR; I will not merge it.

  3. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    S1 implementation is ready for merge: PR #13995, branch oc-code-05/13929-s1, head 8c95eb783255…. It adds the dated §4 record, schema, four common-shape declarations, and CI validation workflow. Local validator: nix shell nixpkgs#check-jsonschema -c check-jsonschema --schemafile config/transport-adapters/schema.json config/transport-adapters/registry.json passed (4/4 declarations, 0 errors); git diff --check passed. PR automation checks currently report skipped; the new workflow is configured for PR path changes and main pushes. Per S1 instructions I have not merged; Archer should merge from this record.

  4. dezren39 commented on Nov 24, 2026

    @dezren39
    MemberAuthor

    Assessment: Dragonfly as a distribution method for ID

    Lane DRAGONFLY-ID, 2026-11-23 — answering Drew's question: could Dragonfly (the CNCF P2P file-distribution system) be useful for distribution in ID, server to server across trust boundaries, using hashes to ensure reliability — or not?

    Short answer: Dragonfly's hashes ensure consistency inside one trusting cluster, not authenticity from a publisher. Its digest machinery proves "everyone in this cluster got the same bytes the seed peer fetched" — it does not prove "these are the bytes the publisher intended," because nothing in the system is signed and a task names a location, not content. So: no for cross-trust-boundary distribution as the mechanism; yes for bulk movement between our own servers when the expected digest arrives over our own signed channel and is pinned into the request; yes, as designed, in front of a container registry.

    How Dragonfly actually works (from its own protocol, docs, and security self-assessment)

    • Roles. Manager is the control plane (console, dynamic config, cluster relationships, preheat jobs; MySQL/Redis backed, and optional — a lightweight mode drops it). Scheduler holds each task's metadata and builds the download DAG, picking an optimal parent peer per piece. Seed peer (a dfdaemon in seed mode) is the only role that fetches from the origin ("back-to-source"). Peers (dfdaemon on every node) download pieces from each other and re-serve them.
    • Flow. A peer registers a task with the scheduler. On first sight, the scheduler triggers the seed peer, which fetches the file from the origin URL, slices it into fixed-size pieces, and reports each piece's metadata to the scheduler as it lands. Peers then pull pieces from the seed and from each other under the scheduler's direction, reporting piece results back; the scheduler's record of the task's piece set is what later scheduling trusts.
    • Task identity. The task ID is SHA256(filtered URL, digest, tag, application, piece length) (idgen TaskIDV2 in the API). Note what that means: with no digest supplied, a task names a URL, not content. Two different byte streams served at the same URL are the same task. This is the opposite of content addressing.
    • Digests, and where they come from. Each Piece carries a digest of its data (blake3 in current builds; the protocol also permits sha256/sha512/md5/sha1/crc32), and each peer verifies received pieces against the digest in the piece metadata. But that metadata originates from whichever peer fetched the piece first — ultimately the seed peer computing digests over the bytes it pulled from the origin. The digest chain is anchored at the origin fetch and the first fetcher's honesty, and is carried in-band inside the cluster. No signature exists anywhere in the protocol: not on the task, not on the piece set, not on the scheduler's record. The scheduler's task record — created at first registration from the requester's parameters (URL, optional digest, tag, application, request headers) — is the closest thing to a manifest, and it is a cluster-internal record, not a publisher's commitment.
    • The one external anchor is opt-in. A requester may supply a whole-file digest (Download.digest, e.g. dfget --digest), documented as "verify the integrity of the downloaded file using the specified digest." It becomes part of the task ID and the requesting dfdaemon verifies the assembled file against it. If the requester doesn't supply it, nothing outside the cluster vouches for the bytes. Piece-digest calculation itself is a tunable (download.calculateDigest, default on; the Helm docs suggest turning it off for image pulls to save CPU).
    • Authentication/authorization. Optional mTLS between components (cert-manager-issued cluster CA in the Helm install, or manager auto-issued certs; the chart's peer gRPC defaults ship insecure: true, so many deployments run without it). The manager's console/API uses username/password + RBAC, JWT signing, and a Personal Access Token for the preheat API. All of this authenticates cluster membership and operators — never content or publishers. The project's own CNCF TAG Security self-assessment lists as an explicit non-goal: "Dragonfly does not provide download access control… you need to control the access from the source side."

    The exact trust anchor: the Dragonfly cluster itself — the scheduler's task record plus the seed peer's back-to-source fetch from the origin URL (over whatever TLS/auth that fetch carries). Membership in the cluster is the trust boundary. That is a reasonable design for its intended world: one administrative domain accelerating its own downloads.

    Verdict per shape

    (a) Cross-trust-boundary, server to server, authenticity must travel with the data — does not fit. A receiving domain would have to trust the sending domain's scheduler, seed peers, and origin fetch, because the hashes only attest to cluster-internal consistency. Pinning a signed whole-file digest from an ID record would rescue correctness, but reduces Dragonfly to an untrusted bulk pipe whose output is verified wholesale at the end: piece-level poisoning by a compromised first fetcher is undetectable in-band, and there is no incremental verification during the transfer. ID already has the stronger primitive natively (below), so there is nothing to gain here.

    (b) Bulk blob movement between our own servers, expected digest delivered over an already-authenticated/signed channel — fits, with one named layer on top: always pin the digest. Set Download.digest from the signed manifest (our signed record / broker ticket) on every request, keep piece-digest calculation on, and run the cluster under mTLS. Then Dragonfly's assumptions hold exactly: one trust domain, the authenticity anchor supplied externally, and its real value — fan-out efficiency — is delivered: one back-to-source fetch, peers feeding each other from idle bandwidth, preheat ahead of demand. This is a genuinely good fit for many-receiver large-blob movement inside the estate (VM images, model weights, backup bundles, build artifacts), where origin egress and wall-clock are the costs. Caveat: the end-to-end check is whole-file at completion, not per-chunk during streaming.

    (c) P2P layer in front of a container registry — fits; this is its designed job. dfdaemon proxies registry pulls for the runtime, and the manager offers registry-triggered preheat. Crucially, authenticity in this shape never depended on Dragonfly: containerd verifies blob digests against the OCI manifest regardless of transport, so Dragonfly is a pure accelerator and the digest anchor stays in the registry/manifest layer where it belongs. This matches the estate's standing registry posture (GHCR now; Zot when self-hosting earns it — Dragonfly in front of either, the CNCF landscape review's placement of Dragonfly as a distribution layer, not a registry).

    Against what ID already has

    ID's data plane (per #13779's adopted composition) names content by its hash, and the records that reference those hashes are signed — authenticity travels with the data by construction. Blob bytes move with bao-tree-style verified streaming (the iroh-blobs model): the receiver verifies each chunk against the content's hash tree as it arrives, from any peer however untrusted, and can stop at the first bad chunk. Meadowcap-style grants and signed broker tickets bind those references to identities and authorizations.

    • What Dragonfly would add: production-proven bulk fan-out machinery ID does not have — a scheduler that builds and repairs a distribution DAG across many receivers, seed-peer back-to-source, preheat, and persistent-task import/export. For shape (b) workloads that is real, and nothing in the current stack does many-receiver large-blob fan-out as efficiently.
    • What it would duplicate, more weakly: verified distribution. Its per-piece digests give cluster-internal consistency anchored in cluster membership; ID's content addressing + verified streaming gives publisher authenticity anchored in the data itself. Adopting Dragonfly for verification would be a downgrade.

    Consequence for this design (#13929)

    If Dragonfly is ever registered as an adapter here, its honest declaration is: shape = transport; identity_binding = none at the content layer (cluster-membership mTLS aside, payloads are not authenticated by the carrier); it cannot claim sync-equivalent. Under §4.5's rule — authenticate the payload, never the channel — it is admissible only where the envelope already carries a signed digest/commitment and the receiver verifies before use: in practice, inside one trust domain, or across domains only as an end-verified bulk carrier, which shape (a) shows ID has no need of. No change to #13779's composition and no change to the registry posture follow from this assessment; it confirms both, and adds the digest-pinning condition for any intra-estate bulk use.

    Sources: Dragonfly API protocol definitions (common/v2 — Task, Piece, Download; dfdaemon/v2 piece responses), idgen TaskIDV2, dfget --digest documentation, d7y.io security + configuration docs (mTLS, autoIssueCert, calculateDigest, chart security defaults), Dragonfly's CNCF TAG Security self-assessment (actors, download-task flow, the download-access-control non-goal), CNCF blog on Dragonfly architecture/deployment.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions