ADR-162 — The fork review lane: a maintainer's gesture admits one commit, on untrusted-workspace floors that land first
- Status: Accepted — the operator decided it on 2026-11-05: re-implement from main with the dormant branch as the spec (debt-leap #113, option B), then #115 (Q1), #116 (Q3), #117 (Q4), #118 (the provider-side fetch residual) and #119 (Q2), each option A. Built through U6 and U7's first part: the floors (U1–U5), the gesture and its per-author bound (U6) and the fork-lane pool are on main; the pool's own boundary (#2965), the CNI verification and the live proof are not yet (what ships).
- Date: 2026-11-05
- Deciders: jo (#113, #115–#119); analysis and design by Claude
- Serves: #874 (the admission half), #1730 (the guarantee's remainder), #1639 (U1 closes it). Spec, read-only:
fleet/c3-fork-lane-2@201d6ed4e(62 commits on849d78703, v3.190, 24/09) andleap/kimi82@31d80e119(2 commits on it: #1730 R2's reads, R4's unit row, R6–R8) - Amends: ADR-033 — an untrusted launch fails closed on every degraded arm (decision 5); ADR-033 carries the note
- Relates to: ADR-059 (tier precedence) · ADR-129 §4 · ADR-132 · ADR-154 (the pool boundary Q3 runs on) · ADR-161 (decision 7 is one of its inputs)
Context
PR #1670 (squash 6898e6c78) landed the lane's enforcement half. store.RunTrust rides the run document (both stores), the queue message, resume, retry and fork; an untrusted run gets no publish grant, no forge_token by either carrier, no commit status; the runner refuses a fetch that misses RepoSHAExpected; launchWebhookTarget keeps lane kinds disjoint and refuses an untrusted target without a pin; a board-mode route refuses provenance. webhooks.Config.ForkLane exists and nothing can set it; orgusage.ForkAuthorSubject has no caller. Nothing sets RunTrustFork.
Main has grown trust readers since. admitRun refuses an untrusted run without a per-run sandbox (#1773); admitSandboxCredentials refuses one no credential reaches (#1768, moving into ADR-161's resolver); the skill channel serves only owned skills — claw through ExecuteSkillPinned, claude_code through --add-dir (#1719); the connector resolution answers reads only and skips the workspace catalog tier for a run the tenant does not control (pkg/connection/trust.go, #1802).
Main does not contain a steered agent. A sandboxed agent holds its LLM credential as container env (sandbox_credential.go); Layer 2 substitutes only declared workflow secrets and cannot hold a forfait (docs/secrets.md); the ambient stamp (AmbientLLMRefused), which refuses the launcher's own env, has no producer. The egress proxy holds only where the network does: docker reaches it through proxy env alone (SupportsNetworkPolicy: false), and the kubernetes per-run policy binds only on an enforcing CNI, admits kube-dns and admits the runner pod on every port. No deployment can run a fork run today: the in-process runview.Launch refuses an untrusted or pinned launch; the chart ships ITERION_SANDBOX_OVERRIDE=none to every runner unless runner.sandbox.enabled (off by default), which #1773 refuses; and under networkPolicy.enabled (on in values-prod.yaml) the release-wide policy closes the runner's proxy port to a sandbox pod.
The branch is the floors, not the gesture. It holds 25 untrusted-workspace floors behind a bench (e2e/untrusted_*_test.go: one hostile checkout through a real Engine.Run and real claude/pi/opencode spawns) and #1730's lesson: a guarantee established once and re-derived downstream from a mutable location fails, so it becomes a handle (os.Root) and an in-memory value whose zero value refuses. The gesture itself was never written. Main rewrote every file the branch modifies (claw_backend.go +2104 lines, runtime/sandbox.go +1402): 124 of 245 conflict, so its diffs are a spec, not patches. #1639, closed on 28/10 as fixed by #1670, is reopened: main's stampHandoffs takes no trust, and the refusal exists only on the branch.
Decision
- The opt-in is a gesture on a fork-lane config, never a record.
ForkLaneis settable at creation (POST /api/teams/{id}/webhooks) and immutable: PATCH refuses a change, which would re-read parked debounce targets as the other kind. The gesture is a/commandon a fork pull request, delivered to that config and routed by its own table (default/revi→review-pr). Onlygithubmay carry a fork lane, an allowlist checked at creation, typed: GitLab's MR ref is unwired, Forgejo's head-repository proof, author id and ref have no witness, and generic has no pull request. The ordinary GitLab MR lane stops stamping "trusted" on a head neither project names: it fails closed likeforkGuardRefusal. - Who opts in. A commenter whose live forge permission on the base repository reaches the route's
min_replier_role, never belowdeveloper(write). The self-comment loop guard stays; theAuthorizedReplierslogin short-circuit is not consulted on this lane, because a login is renameable. - How the commit is pinned. The handler resolves the pull request through the forge API and admits only a PROVEN fork of a PUBLIC base: open, head repository named and not the base, base visibility public (
forge.PullRefgains it). A private base is refused, typed, before the bound is metered: an untrusted clone holds noforge_token(#1670), and one handed to it would persist in the fork's workspace (.git/config, the credential store). The handler launches on the base'sCloneURLandrefs/pull/<n>/headwithlaunchProvenance{Trust: RunTrustFork, ExpectedSHA: HeadSHA}. An optional SHA argument narrows the gesture to that commit, or the launch is refused. The runner refuses a push between the gesture and the fetch, naming both commits; a new head needs a new gesture. - The base repository's configuration may stop a fork run, never steer or grant it.
applyWebhookVarLayersapplies neitherLaunchVarsnorOperatorLaunchVarsto an untrusted target;trustedVarNamesstays empty; the hold label blocks the gesture (Q2). Model routing resolves from the database cascade, because it spends the tenant's money, not the repository's. Gate relaunch and auto-fix stay refused on a fork-lane config. - The bound fails closed.
gateMonthlyCapsmeters a fork target twice: on the org's budget as ADR-033 decides, and onForkAuthorSubject(org, provider, the PR author's numeric forge id);forge.PullRefgains that id, since today it carries only the login. The bound is runs and dollars per month, held on the org beside its quota, with a platform default in the settings ladder of 20 runs and $20 and an explicitunboundedas the escape hatch (Q4). This subject is the perimeter against an outside party, not operator policy, hence the amendment to ADR-033: every arm ofgateLaunchthat admits a launch unmetered refuses an untrusted subject — a team or org it cannot read, no counter, a metering error — whichever surface enters (delivery, debounce flush, retry sweeper).launchSubjectcarries the trust as a required field, and the admission handle releases both counters on rollback. The dollars are charged where spend is measured: the author subject rides the run document and the queue message (aSchemaVersionbump under docs/cloud-queue-schema-rollout.md), and the runner'srecordOrgSpendcharges it beside the org. The org purge matches the escaped key spelling. - What the run may read and write. It reads the base clone at the pinned commit (the base is its only remote, fetched before the sandbox starts) and the bot's own skills through the pinned channel. It reads no connector: the facade is not mounted and the resolution refuses reads too, tightening #1802, because what the run reads can leave through decision 7's one route. It writes its sandboxed workspace and its own events and artifacts. Nothing reaches the forge, the board, the host capabilities, the tenant's memory (either way) or a hand-off seed (either way). Nothing the checkout declares is executed or loaded: its hooks,
.mcp.json,devbox.json,devcontainer.json,.env, slash commands, context files and bot bundles. Plugin MCP servers are not booted either, because they would start inside the checkout. - The container holds no credential and has one route out.
review-pr's reviewers holdbash, and a fork's diff can steer them. The run spends a sealed API key or gateway credential that crosses as a Layer 2 placeholder, which the sandbox proxy substitutes in headers toward that credential's host. That host is the proxy's whole allowlist:allowlistwith no preset, becauseiterion-defaultadmits the code hosts, the registries and**.googleapis.com. A request to it that authenticates with anything but the placeholder is refused. The proxy is the only route only where the network enforces it, so an untrusted run is admitted only on a driver whoseSupportsNetworkPolicyholds: kubernetes today; docker refuses, typed, until it isolates the container's network. The per-run policy drops kube-dns, because the proxy resolves on the runner side and the container reaches it by IP, and admits the runner pod only on the proxy's port and the run's own listeners (U5). Before the first spawn, the sandbox start proves the floor: a probe that ignores the proxy env and dials the cluster API service, the credential's host and the runner pod's metrics port directly must fail, or the run is refused, typed; a non-enforcing CNI applies the policy as a no-op, and only this probe sees it. Every channel the proxy cannot hold is refused, typed: a forfait (Layer 2 cannot substitute an OAuth credential), a file login, the launcher's ambient env and theITERION_SANDBOX_TLS_INSPECT=offhatch. Every untrusted run carries the ambient stamp, whichambientStampRefusalhonours today and under which #1768's channel 2 stops counting. The rule is one input of ADR-161's resolver. - Where the guarantee is enforced. Four layers, and every predicate is
Trusted(), so an unknown trust loses: the server (disjointness, the pin and the bound atlaunchWebhookTargetandgateLaunch, plus #1670's grant and secret refusals); runtime admission (admitRun: the sandbox, the enforcing driver, decision 7's credential); the proxy and the per-run policy, proven at start (the egress); and the floors. The floors read one value resolved per run fromruntime.WithTrustand handed down, never re-derived from the workspace:delegate.Task/IOTaskcarry it across the sandbox wire, and a child run (store stamp and wire) and a node's processes (ITERION_RUN_TRUST, cooperative) inherit it. Every host-side read or write derived from the workspace goes through the workspace handle,<workDir>/.claude's family and the catalog under<workDir>/botsalike, and an untrusted run regenerates no catalog: even through the handle, the fork would author the orchestrator's routing table. - Backend parity: every floor on both, or a typed refusal.
- Project settings: claude_code drops
projectandlocalfrom--setting-sourcesat the one builder every spawn takes. claw registers only iterion's own hook groups, from memory, and claude_code gets the same groups through--settings. - Skills: #1719, on both.
- Slash commands: claw stops resolving the checkout's. claude_code gets them only through the floored project source.
- MCP: neither backend autoloads
.mcp.jsonor boots a plugin server. The bot's own stdio servers start from/, and strict mode is forced. - Memory: claw's
memory:block and auto-memory are both withdrawn. - Connectors and host capabilities: one resolver each, checked when the tool is called.
- Credential and egress: decision 7 on claw, claude_code and pi alike, as one rule.
- Other backends: pi gets its three floors. codex, opencode, grok and kimi refuse with
ErrUntrustedWorkspaceRefused, and the protocol's zero value refuses.
- Project settings: claude_code drops
- Where it runs. Only through the publisher, on a runner whose sandbox resolves active on an enforcing driver (#1773, decision 7) — in the cloud, Q3's dedicated pool. The in-process launch keeps refusing an untrusted or pinned launch: it clones nothing and compares no pin (
RepoSHAExpectedis read only inpkg/runner), and local mode has no webhook store to deliver a gesture.
Operator decisions
- Q1 — what the maintainer sees: A (#115). The server writes a note on the fork PR naming the run link and the pinned commit, and nothing the run wrote. Rejected: (B) only the console and the delivery row, because the maintainer gets no answer where the gesture was made; (C) the review posted by a separate comment-only credential, because it puts prose an attacker can steer under iterion's identity and needs its own security review.
- Q2 — the hold label: A (#119). It blocks the gesture, because the base's configuration can only stop a fork run (decision 4). Rejected: (B) ignored, per #874's letter and the
/commandrule that labels pause only automation, because the base would lose its one per-PR stop. - Q3 — where fork runs execute in the cloud: A (#116). A dedicated runner pool that resolves a kubernetes sandbox for every run, named by the fork-lane config and stamped
RunnerPoolby the publisher, behind ADR-154's pool boundary, on a CNI that enforces NetworkPolicy. Its standing policy admits the siblings to the pool's runner pods, so the per-run proxy composes withnetworkPolicy.enabled; under the release-wide policy it does not (cloud-deployment.md § NetworkPolicy egress). Chart work: #2965, and a per-poolrunner.sandbox.enabled, global today. Precondition (U7, ops): the cloud cluster's CNI (matryoshka) is verified to enforce NetworkPolicy before the pool is enabled; the start probe then witnesses it per run. Rejected: (B)runner.sandbox.enabledfor the whole deployment, because every trusted bot that declaressandbox:moves into a sibling pod and the release-wide policy must be off or open to the proxy port, which no value does; (C) self-hosted only, because the cloud would keep refusing every fork run. - Q4 — the per-contributor bound: A (#117), as decision 5 states: runs and dollars on the org, charged to the author subject at the runner. Rejected: (B) on the fork-lane config, because the key has no config segment, so two configs of one org would share one counter under two caps; (C) no bound beyond the gesture, because the gesture bounds who admits a run, not what an outside author's runs spend.
- The provider-side fetch residual: accepted (#118), documented in the Consequences. Rejected: a proxy floor that inspects request bodies and refuses server-side tool declarations, because it is provider-specific and guards data decision 6 already keeps public.
Branch → main
| Branch element | Main today | Unit |
|---|---|---|
Trust on delegate.Task/IOTask, router task (stampWorkspace), sub-bot compile (compileUnit(…, trust)) | absent; the cloud child inherits through the wire copy, runview fork copies it | U1 |
Child stamp in both stores, the launch's tenant on every spawnRun store call (d844c4be2), an unreadable parent refused, typed (cb05bad73) | absent: spawnRun's store calls run under context.Background(), which Mongo's tenant filter panics on once they read the parent; no ErrChildParentUnreadable | U1 |
ITERION_RUN_TRUST; .env skipped by helpers and carriers | carrier absent; #2844 already skips .env for engine-spawned children and __ helpers, leaving only the ITERION_DOTENV_FORCE hatch to lose | U1 |
stampHandoffs keyed on trust, both directions | absent: stampHandoffs takes no trust (#1639, reopened) | U1, closing #1639 |
Workspace handle, zero value refuses; R1–R8 (08c2379d2 + kimi82), R7's CopyFrom atomic on the trusted passthrough too | absent; main added two writers the handle must take (owned_skills.go, skill_channel.go) | U2 |
The checkout's bundles regenerate no catalog (ce04b53ea) | absent: regenerateBotCatalog scopes the write to the run's bot id, with no trust floor and no handle | U2 |
claude_code setting floor + inline --settings; claw hooks from memory; mergePluginHooks writes nothing | absent; the empty-list --setting-sources "" has landed | U3 |
pi context files, --approve, checkout skills, codex-bridge seed; codex/opencode/grok/kimi refusal | absent | U3 |
| Slash commands not resolved from the checkout | absent; the size ceiling has landed | U3 |
claw skill tool refused; shadowed skill overwritten | obsolete: #1719's channel serves owned skills only, and #1730's "pin a skill-less reviewer" lifts | — |
MCP: .mcp.json names-only, plugin servers withheld (MCPPrepared, admitMCPCatalog), stdio servers from /, strict forced | absent; #1945's launcher placement is the sandbox seam it plugs into | U4 |
bot:// sources refused; memory and auto-memory withdrawn; workspace_trust_withdrawal event | absent | U4 |
| Host capabilities: one resolver, call-time check, no board/runs listener | absent; hostmcp records trust for the connector facade only | U4 |
Board door: a reserved __iterion_ bot-arg refused to every tool caller, set_bot dropping it (90a52c3ec, ef7eff78c, c9a3c422e) | absent, and trust-independent: trusted runs change too | U4 |
| Connector project catalog floor | obsolete: #1802 at the resolution; its reads are withdrawn by decision 6 | U4 |
devcontainer not read, host_state: none, no .git mount or git identity, repo_devbox off | absent (resolveRepoDevbox takes no trust) | U5 |
Network floor allowlist + iterion-default, the raw key left in the container | replaced by decision 7: the key crosses as container env, ResolveNetworkPolicy takes no trust, the stamp has no producer, no admission reads SupportsNetworkPolicy, the per-run policy admits kube-dns and every runner-pod port | U5 |
sandbox_skipped marker, sandbox_no_credential_warning | obsolete: #1773 and #1768 refuse instead | — |
The gesture, settable ForkLane, var layers, hold label, author bound, GitLab | never written | U6 |
Migration
Each unit lands alone and ports its rows of the branch's bench, each row seen red on main with the floor removed and green with it. Nothing sets RunTrustFork until U6, so U1–U5 leave a trusted run as it is except at four points: U1 refuses a child whose parent cannot be read, U2's CopyFrom replaces atomically on the trusted passthrough, U4's board door serves every caller, and U4's call-time capability check refuses a node that names a host tool its workflow never granted — a listing the compiler only warns about, which pre-U4 served the call. Each point carries a trusted-path witness in its unit. Order: U1, then U2–U5 in any order, then U6, then U7 once Q3's chart work has landed and its CNI precondition holds.
- U1, the carrier. Covers the trust on
Task/IOTaskand every task assembler, the compile seam, the child stamp in both stores with the launch's tenant on everyspawnRunstore call, the process environment withITERION_DOTENV_FORCElosing, and the handoffs:stampHandoffsreads the run's trust, which closes #1639. Witnesses: the carrier, child-run and dotenv benches,handoff_untrusted, asubbot:launch through the service on the Mongo store, and the unreadable-parent conformance row in both backends, a trusted child refused too. - U2, the handle (#1730). Every host-side reader and writer derived from the workspace holds it: the mirror family, plugin hooks, owned skills, the skill channel. An untrusted run regenerates no catalog.
CopyFromis atomic and keeps the source mode on both branches. Witnesses: the.iterion-managedescape row,CopyFromhardlink and concurrency on the trusted and untrusted branches, the pruner sidecar, and a checkout bundle whoseskillslinks out of the workspace writing nothing (a trusted run regenerates as before). - U3, agent configuration. Covers the claude_code and claw settings and hooks, slash commands, pi, and the typed refusals. Witnesses: the real-CLI setting-source probe, every spawn path, and a hook veto through a dangling link.
- U4, MCP, sources, memory, connectors, host capabilities, the board door. Witnesses: the MCP-channel bench, memory in both directions, a host tool named in
command:refused, a connector read refused through the facade and through a tool node, and the board door refusing a reserved key andset_botdropping it for a trusted caller. - U5, the sandbox, the credential and the network floor. The host-state floor resolves before the credential admission, which then judges the floored mount (ADR-161's
SandboxHomeState); otherwise #1768 would admit a run whose only credential is a login no longer mounted. Then decision 7: the publisher stampsAmbientLLMRefusedon every!Trusted()run, the crossing hands placeholders, the allowlist is the credential's host, admission asks the driver'sSupportsNetworkPolicy, and the start probe runs. Before ADR-161's U2 the credential rule lands at today's arms (selectedAnthropicCredEnvForCLI,ClawSandboxCredential, pi's), which become parity rows of ADR-161's bench. U5 also owes decision 7's narrowing of the runner pod. On main a sandbox reaches three per-run listeners there, each on an ephemeral port beside the metrics port and, above a runner concurrency of one, other runs' listeners: the egress proxy, the host MCP listener (/api/v1/mcp/board, also the connector facade) and the ask-user listener (pkg/askusermcp, interactive nodes only). An untrusted run keeps the proxy and an interactive workflow's ask-user listener (review-prhas none), bound beforeDriver.Startwrites the policy since kubernetes advertises the downward-API pod IP; U4 starts no host MCP listener for it. Witnesses: a devcontainerpostCreateCommandcanary, the host-state mounts, devbox; the container env holding the placeholder and no key value, with realclaudeand claw spawns authenticating through it;api.github.com, a registry andstorage.googleapis.comrefused, a foreign key toward the provider host refused, and a client that ignores the proxy env failing to connect; the rendered policy naming exactly the proxy's and the run's own listener ports, and the probe failing on the runner's metrics port; a docker fork run refused at admission and a kind (kindnetd) fork run refused by the probe; forfait-only, file-login-only and ambient-only runs refused at admission. - U6, admission. Covers decisions 1–5, Q1, Q2 and Q4, and the delivery-row reasons; the bound lands in both counter twins, with the author subject on the document and the wire and the runner's second charge. Witnesses: a real GitHub delivery replayed through the handler on a fake forge (fork admitted, with a note carrying only the run link and the pinned commit; same-repo, withheld head, private base, login-allowlisted non-writer and stale SHA refused, the private base before the bound is metered), a PATCH flip and a Forgejo config refused, the bound denying the N+1th run on its run count and, after a charged run, on dollars, and a metering error, a missing counter and an unreadable team each refusing, the last through the retry sweeper.
- U7, deployment and proof. Covers Q3's chart work and the publisher's pool stamp, plus
docs/webhooks.md's table rewritten to what ships. Ops precondition before the pool is enabled: matryoshka's CNI is verified to enforce NetworkPolicy. Proof: one livereview-prrun on a lab repository's fork PR, through a real delivery, sandboxed under the prod values (networkPolicy.enabled: true) with the start probe passing. It is also the first cluster validation of the kubernetes driver's Layer 2. Its cost goes in the commit.
Consequences
- A fork contributor gets a review only after a write-level maintainer says so, for one commit of a public repository, in a sandbox that holds no credential value and whose one route out the network enforces, with nothing published by the run.
- The lane spends an API key or a gateway credential: a team funded only by a forfait is refused, typed, and so is a deployment without an enforcing driver.
- The residual, accepted (#118), is what the run holds, through the route it keeps. A steered agent can spend the placeholder through the proxy for the run's lifetime, outside iterion's meter. A provider-side tool that fetches a URL the request names, authenticated by the tenant's substituted key, can carry out what the run read. Decision 6 keeps that to the public base, the fork's diff and the bot's own prompts and skills, so a bot whose skills are not publishable stays out of the fork-lane table.
- The floors protect any future untrusted class (a mirror, an imported tree), because they read
Trusted()and notIsFork(). - Trusted runs change at the migration's four points, and an ordinary GitLab MR whose payload names neither project is refused.
- The per-author row stores an outside contributor's numeric forge id under the 400-day TTL, purged with the org.
- Out of scope: the GitLab and Forgejo fork lanes; a private base, whose fetch needs a token kept out of the workspace (a runner-owned clone, then a credential-free local clone into the sandbox); the docker driver's network isolation; ADR-161's resolver itself, to which U5 adds one input and the placeholder crossing; and the forge-integration toggle that would provision a fork-lane hook.
