Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Server onboarding and process ownership

Proposed contract. An operator needs to know three separate things about an upstream: what was declared, what was admitted and what is ready. Normalize each supported authoring surface into a validated, namespaced declaration before spawning a process or connecting. Keep a stable server ID independent of its display name and an immutable generation for its effective configuration. Record source and override provenance by field. Configuration inspection and health output expose reference names, credential availability and generation only.

Declaration sourceValidation before admissionAcceptance oracle
Stdio processExecutable and argument vector, cwd, explicit environment inheritance and per-server overrides, required credential referencesChild fixture observes exactly the specified cwd, arguments and named inputs. A sentinel from an unrelated server is absent.
Adapter around a CLIParser/adapter identity and version, executable provenance, bare-name policy, cwd and process contractFixture in an explicit cwd succeeds. Disallowed bare command and missing cwd fail before launch.
Remote MCP URLCanonical URL, allowed protocol revisions, authorization audience, runtime version expectation and transportFixture identifies protocol era, returns capability snapshot and identity, can reject a credential for the wrong resource.
OpenAPI-derived serverSpec identity and digest, permitted operation IDs, server URL and auth referenceRefresh of the same spec preserves tool identities. Duplicate operation IDs or new write operations cannot acquire permission from naming.
PluginPlugin version, configured adapter, resulting tool namespace and ceilingsCollision with another server is a validation error. An update cannot widen authority.
Registry findPublisher/namespace, pinned manifest version and source; resolve into one of the declarations aboveRediscovery does not silently change executable, endpoint or pinned version. Deletion/deprecation has a visible status.

For credential references declare the source explicitly when possible. Preserve existing precedence for pre-existing declarations after verifying the resolver. Reject missing required references before swapping. Give only the named child its resolved inputs. For change detection, record an in-process credential generation supplied by the resolver. Never persist a verifier derived from a low-entropy secret. A restart that loses a memory-only grant must fail with a named unsatisfied requirement; unattended reconnect requires a separately authorized resolver. Redact command arguments and URLs that may contain credentials from logs.

Reconcile. Validate the entire desired generation before making any routing change. Reuse unchanged live attachments. Stage independent replacements, negotiate protocol/credentials, fetch capabilities, apply policy and validate health. Commit the routing/catalog generation atomically, then drain the retired instance within its configured budget. If concurrent start is unsafe for an exclusive process, mark the pending restart explicitly, drain, stop, replace and restore the prior declaration if replacement fails. Report that server’s downtime and any uncertainty about its in-flight operations. A removal first denies new calls, invalidates disclosure and subscriptions for that namespace, drains or terminates old attachments, and drops affinity state. A compare-and-swap at commit prevents overlapping reloads from presenting a mixed catalog. Removals and permission reductions take precedence over retaining an older candidate on failure.

Ownership during a front-end restart. Use the decision recorded in #1384, one separate supervisor process per stdio instance, re-executing the same binary. The supervisor is a byte pump that owns that child’s process, pipes, and bounded raw output while unattached. Framing and partial-frame handling remain in the daemon’s StdioTransport reader. If the buffer overflows, the supervisor reports dropped bytes on attach. Treat the protocol stream as discontinuous and outstanding requests as indeterminate, reset the stream when it cannot be safely resynchronized, and never pass a partial frame as a reply. The front end owns RPC correlation, client authentication, ceilings and attribution. A frontend crash can preserve the process and still lose an outstanding call’s result. The supervisor fences an old epoch before accepting writes from its replacement. An ID used by two clients must remain distinct throughout handoff. Isolate the per-instance supervisors from the front-end service’s kill-on-stop lifecycle and provide an instance-private socket namespace. Verify adopted supervisor identity, generation and ownership before any reap; a stale PID or another daemon’s state directory is insufficient evidence. Under systemd the front-end socket can use Accept=no and be passed to the matching service. Socket activation preserves queued incoming connections, not established application streams or child state. In inline mode arbitrate direct launches through a per-instance ownership mechanism and positively identify the instance in readiness responses. A CLI targeting SSH or tsnet must never bootstrap an unrelated local daemon after a remote failure.

Migration. The body of #9963 identifies Drew’s adoption of per-instance supervisors on October 27. It gates supervised-by-default on Phase 2’s attach path and retains direct-child FD takeover as a legacy fallback. The #9962 Phase 2 tracker is closed completed. See the pinned source reconciliation below for the implemented portions of Phase 3 and the deliberate opt-in pause. Phase 3 tests must include both startup scan branches (adopt configured instance and reap verified orphan), status naming a protocol refusal, restart through the supervisor, and Darwin exemptions reduced to legacy-handoff tests only. Drain and retire old supervised frontends by epoch. For pre-upgrade children that cannot be attached with verified framing and ownership, drain to a scheduled restart. A downgrade to a frontend with an unsupported supervisor protocol must refuse attachment and preserve the working generation. Do not start a second copy of an exclusive upstream. Handle host reboot separately from frontend restart. Persist only sanitized, versioned metadata required for supported reconnect paths, use atomic replacement and restrict file permissions. For values that are themselves bearer credentials or authorize a session on their own, hold them in memory; cold-start reauthentication may be required.

Fault to injectObservable pass condition
Kill old frontend before/after epoch commit, with a blocking stdio test callUpstream seen once, same process nonce/open count, only the elected epoch can forward frames; lost outcome classified explicitly.
Kill a single instance supervisor with requests pendingAn affected generation becomes unavailable and outstanding outcomes are marked unknown. An independent upstream remains usable. Replacement never reissues an ambiguous write.
Concurrent reload, removal and reconnectAt most one admitted generation for new work. Removed namespace disappears from discovery and cannot receive a new invocation through a stale handle.
Simultaneous inline commands with daemon absent, delayed readiness, and startup errorSingle launch winner, each waiter receives same instance identity or causal error, bounded wait and deterministic probe of poll intervals.
Two daemon instances on one hostDistinct supervisor socket, activation listener, persistence and tsnet state; stopping or reloading A leaves B’s test call and process nonce unchanged.
Tailnet control unavailable; SSH channel reconnectsPer-listener readiness names the failed reach. Local healthy listener remains usable if permitted by declared startup policy. No privilege or target changes during reconnect.
Oversized JSON, per-event SSE overflow, unbounded sequence of legitimate small events, compressed responseExact-boundary message accepted; bound+1 rejected with a classified event, response body closed, next independent call succeeds. Long-lived streams bounded per decoded frame with backpressure and cancellation, finite responses bounded in total after decoding; body/header/idle limits reported by their own stage.

Transport observability. Report instance, frontend epoch, supervisor generation, protocol revision and listener health, successful discovery time, reason for degraded state, calls accepted/completed/denied/indeterminate, buffered bytes/high-water mark and server restart count. Aggregate over the same call records used for audits. Harmless protocol discovery/list/ping probes require explicit documented behavior per upstream. A costed tool invocation is never the default liveness probe. Separate reachability, authentication, discovery compatibility and operation-specific availability.

Current supervision boundary

A clean default change depends on a socket key for a pool instance. A name-only key cannot distinguish two instances for the same server. Pin the configured namespace, pool scope, instance slot and negotiated era for the duration of the child. During migration, adopt a legacy name-only socket only if exactly one live instance can own it. Quarantine an ambiguous match without redirecting a second namespace to it. Preserve the old listener until the new attachment handshake and exclusive ownership succeed. The negative control is two same-name instances returning different sentinels through the same frontend restart. Current socket key · Phase 3 tracker