Skip to content

How are the gRPC contracts between the processes written, generated, and checked?

Decided 2026-10-04: A. Commit generated code. The decision and its reasons are in the I52I52 (closed): S04-architecture, S09-policy-credentials-audit, S10-tech-stack: first .proto contracts and settings schemaS04-architecture says all IPC is protobuf over gRPC and S10-tech-stack adds proto/ "with the first RPC". comment that starts Decision (2026-10-04):. Source: I52I52 (closed): S04-architecture, S09-policy-credentials-audit, S10-tech-stack: first .proto contracts and settings schemaS04-architecture says all IPC is protobuf over gRPC and S10-tech-stack adds proto/ "with the first RPC".. Affects S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves., S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded., S10-tech-stackS10-tech-stack: Technology ChoicesFix languages, libraries, packaging, and repository layout, with the reason for each choice. and S02-toolchainS02-toolchain: ToolchainStandardize how this repository manages runtime versions, repo tasks, and CI..

host: trustedwbwb-hostdwb-vmdSwiftwb-proxydwb-netdsessionwaits on I46vmwaits on X18,descriptors not gRPCstream headeraudit, approvalsguest, untrustedwb-guestdmay be any old versionguestEthernet frames, not gRPC

Figure 1. The contracts I52I52 (closed): S04-architecture, S09-policy-credentials-audit, S10-tech-stack: first .proto contracts and settings schemaS04-architecture says all IPC is protobuf over gRPC and S10-tech-stack adds proto/ "with the first RPC". asks for. Two of them can’t be written yet (red labels). Not every link is gRPC: descriptors pass from wb-vmd as SCM_RIGHTS messages, and wb-netd hands each stream to wb-proxyd as raw bytes behind a header. The guest end is adversarial and may run an older version.

The issue lists the generated-code question without options. These are mine.

buf generate writes Go and Swift code into the packages, and the result is committed. mise run ci regenerates and fails on any difference, and runs buf lint and buf breaking against main.

  • Cost: generated diffs in pull requests. Generated paths need explicit exclusions from cspell, swift format lint and SwiftLint.
  • Gains: a fresh clone builds with plain go build and swift build, on every OS, without buf.

Every build and test task runs buf generate first, and Git ignores the output.

Go code is committed as in A. The Swift package generates its code at build time with a SwiftPM build plugin.

  • Cost: two mechanisms for one contract. buf no longer checks the Swift side, and the plugin must be pinned through Package.resolved.

Each option leaves the SEC* controls unchanged. The contracts themselves serve SEC11-root-gains-nothingSEC11-root-gains-nothing: Guest root is not a privilegeFull control of the guest grants no control over enforcement, secrets, or policy.: every handler that reads guest bytes gets a fuzz target (S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq…).

Item Recommendation Waits on
buf Exact version in .mise.toml, checksum in mise.lock (aqua:bufbuild/buf). nothing
Plugins Local only, never remote:, which calls the Buf Schema Registry over the network and would break the offline ci. Go plugins pinned with tool lines in go.mod. Swift plugins built from pinned SwiftPM dependencies. Both are covered by dependabot. nothing
grpc-swift grpc-swift 2, with grpc-swift-protobuf and grpc-swift-nio-transport. It needs Swift tools 6.1 and macOS 15, and Package.swift already declares 6.2 and macOS 15. nothing
Layout proto/wraithbox/<area>/v1/*.proto, packages wraithbox.<area>.v1. A breaking change means a v2 package (I48I48 (closed): S04-architecture: process supervision, failure, version skew and host resource limitsS04-architecture names the processes but not how they are supervised, what happens when one fails, or how they are upgraded:). nothing
Stream header One length-prefixed protobuf message at the start of each stream from wb-netd to wb-proxyd: VM, project, session, hostname, port, label. I36I36 (closed): S07-egress-gateway: attribute network flows to projects in the shared work VMThe work VM hosts every trusted project, and its wb-netd sees one guest MAC and one leased IPv4 address (S07-egress-gateway "Addressing")., which defines the project and session fields
Settings schema Keys, types and defaults of config.toml and projects/<id>.toml in S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded.. An unknown key is an error that names it (NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it.). nothing
state.db Numbered, forward-only migrations, run by wb-hostd at start. It refuses a database newer than it knows (I49I49 (closed): S10-tech-stack: installation, restore image download, upgrades and migrationsS10-tech-stack "Packaging and signing" gives the shape of the macOS app bundle.). nothing
Terminal stream Messages for attach, take-over, detach, input, output, resize, signal, and exit status including “session lost”. I46I46 (closed): S05-cli, S06-vm-lifecycle: session lifecycle, detach, sleep and failureS05-cli and S06-vm-lifecycle describe starting a session and its summary at the end, but not what happens in between, or when things go wrong:
wb-hostd to wb-vmd VM lifecycle RPCs, and the descriptor channel next to them. X18-vsock-handoffX18-vsock-handoff: Host-guest socket and descriptor hand-offCan wb-guestd, written in Go, open AFVSOCK sockets in a macOS guest?
Audit events OCSF 1.8 classes. X24-openshell-artifactsX24-openshell-artifacts: OpenShell artifactsDo the OpenShell parts that S07-egress-gateway, S09-policy-credentials-audit and S10-tech-stack build on exist in the assumed form, under a permissive license, at a version that can be pinned: the networkpolicies sche…
RequirementA. CommitB. Build timeC. Mixed
NFR07-maintainabilityNFR07-maintainability: MaintainabilityMost code is cross-platform Go. one contract, small native partsone generatorone generatortwo generators
FR17-same-everywhereFR17-same-everywhere: Same on every hostThe same wb commands, flags, policy files, and behavior on every host OS. same build on every OSplain buildextra step on Windowsplain build
Offline mise run ci (S02-toolchainS02-toolchain: ToolchainStandardize how this repository manages runtime versions, repo tasks, and CI.)local pluginslocal pluginslocal plugins
Review noisegenerated diffsnoneGo diffs
Lint and spelling configurationpath exclusionsas todayGo exclusions
Details and glossary

Why buf breaking matters here. wb-guestd in an old image may talk to a newer wb-hostd (I48I48 (closed): S04-architecture: process supervision, failure, version skew and host resource limitsS04-architecture names the processes but not how they are supervised, what happens when one fails, or how they are upgraded:). buf breaking compares the .proto files with those on main and fails on a change that would break an old peer, such as a renamed field. That turns the compatibility rule into a check instead of a review habit.

Why strict settings. A misspelled key in config.toml, such as a resource limit, would otherwise be ignored without a word. An error that names the key is what NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it. asks for.

Glossary

  • protobuf (.proto): a language-neutral way to describe messages. Code generators turn one description into Go and Swift types.
  • gRPC: remote procedure calls over HTTP/2 using protobuf messages.
  • buf: a tool that lints .proto files, checks for breaking changes, and runs code generators.
  • Plugin: a code generator buf runs, one per language.
  • Drift: committed generated code that no longer matches what the generator would make from the current .proto files.
  • SCM_RIGHTS: the Unix mechanism for passing an open file descriptor from one process to another over a Unix socket.