Case: Deploying AI Development Tools
Alderbank Software, the organization in this case, does not exist. It is a fictional company of about 240 engineers in 30 teams, invented for this article together with its repositories, its policy file, and every number below. The implementation is real in the sense that it runs: the code in this article was executed locally, and the outputs are what it printed. But no language model is involved, no real team’s data is used, and none of the results describes a real tool or a real organization. The assistant itself is the one thing left out. What is built is everything around it, tested with scripted requests of the kind an assistant makes, including hostile ones.
The situation is this. Alderbank’s engineering leadership wants to know whether an AI coding assistant should be offered to all 30 teams by the end of the next quarter. Four questions have to be answered before anyone can say yes. As whom does the assistant act in the company’s repositories? What can it do while it works? What stands between its output and the main branch? And did giving it to teams actually help? Each question has an earlier article behind it. This case puts the four answers into one system and shows where they depend on each other.
The case assumes you have read Integrating AI Coding Tools with Enterprise Repositories (repository access, configuration, retention, approved environments), Testing and Reviewing AI-Generated Code in CI (independent oracles, dependency and scope checks, approval boundaries), Operating Coding Agents with Restricted Permissions (isolation, scoped credentials, argument-level tool rules, audit, tiers, acceptance tests), and Measuring an AI Development Tool Rollout (pilot cohorts, guardrails, intention to treat, power, gates). The previous case in this module, Case: An Approved Agent for Transactional Business Work, put an agent’s consequential actions behind approval and an audit trail; the same stance applies here with a code repository in place of a transaction ledger. Each section recalls what it needs in a sentence or two and does not re-derive it. The environment was Python 3.12.14 with numpy 2.2.3 and scipy 1.18.1 on macOS 26.7.1, and everything except the pilot analysis uses only the standard library.
Requirements and the decisions they force
Alderbank’s platform team writes down six requirements before choosing anything. Each one rules out something that would have been easier.
| Requirement | Decision | What is given up |
|---|---|---|
R1. Code in the two restricted repositories (ledger-core, auth-gateway) is never exposed to the assistant | Repository tiers in one policy file; the credential broker refuses tokens for restricted repositories | The assistant’s help on the most critical code |
R2. The assistant’s work reaches main only through a human-approved pull request | A distinct agent identity per team, scoped to one repository and an agent/ branch namespace, enforced by the repository host | Convenience: no direct pushes, no self-merge, no use of the developer’s own token |
| R3. Text the assistant reads cannot widen what it may do | Argument-level command allowlist, resolved-path file rules, scrubbed environment, protected configuration paths | Flexibility: only listed commands run, and installing a package needs a human |
| R4. A change is judged by evidence the assistant did not produce | Staged CI gate with a platform-owned oracle the pull request cannot edit | CI time, and the platform team has to write and maintain oracles |
| R5. Expansion follows evidence, not enthusiasm | Randomized offer to half the teams, one primary metric, pre-agreed guardrails and gates | Speed: half the teams wait, and the answer may be “not yet” |
| R6. The assistant can be stopped within minutes | Tier switch in the policy plus revocation of the agent identity | One more control to drill |
The pieces fit together as follows. A single versioned policy file feeds all of them, and its hash travels with every session so the CI gate and the audit log can say which rules were in force.
policy file (versioned, owner-reviewed, sha256 recorded)
|
+--> credential broker --> scoped token (repo, branch prefix, 1 hour)
| |
| v
+--> execution environment --> repository host rules (server side)
| (file tool, command gate, |
| scrubbed env, audit chain) v
| pull request, workflows held
+--> CI gate: provenance, scope, imports, own tests, platform oracle
| |
| v
| human review (owner review for sensitive paths)
|
+--> pilot gates: safety, guardrails, effect, adoption
The synthetic organization has three teams that matter for the access rules (storefront, platform, settlement), six repositories in three tiers, and the whole policy fits on one screen.
{
"version": "2024-11-29.1",
"repositories": {
"docs-site": "open",
"build-tools": "open",
"orders-service": "standard",
"catalog-service": "standard",
"ledger-core": "restricted",
"auth-gateway": "restricted"
},
"tiers": {
"open": {"assistant_level": 2},
"standard": {"assistant_level": 2},
"restricted": {"assistant_level": -1}
},
"teams": {
"storefront": ["docs-site", "orders-service", "catalog-service"],
"platform": ["build-tools", "docs-site"],
"settlement": ["ledger-core", "orders-service"]
},
"agent_branch_prefix": "agent/",
"token_ttl_seconds": 3600,
"token_permissions": ["read", "push_agent_branch", "open_pr"],
"commands": [
{"argv_prefix": ["git", "status"], "flags": ["--short", "--branch"], "paths": false},
{"argv_prefix": ["git", "log"], "flags": ["--oneline", "--stat", "-n"], "paths": false},
{"argv_prefix": ["git", "diff"], "flags": ["--stat", "--name-only"], "paths": true},
{"argv_prefix": ["python3", "-m", "unittest"], "flags": ["discover", "-s", "-v"], "paths": true}
],
"egress_allow": ["mirror.alderbank.test", "models.alderbank.test"],
"protected_paths": [".agent/**", ".ci/**", "CODEOWNERS"],
"env_allow": ["PATH", "LANG"],
"ci": {
"owner_paths": [".github/workflows/**", "requirements*.txt", "pyproject.toml", "Dockerfile", "**/migrations/**", ".agent/**", ".ci/**", "CODEOWNERS"],
"max_changed_lines": 200,
"approved_imports": ["json", "decimal"],
"first_party": ["billing", "report"]
}
}
Three fields deserve attention. tiers maps each repository class to an assistant level, and level -1 means the assistant is not offered at all; this is the tier idea from the permissions article reduced to the one switch Alderbank needs. teams lists which repositories each team’s developers may start a task in, so the broker never has to guess. And commands is an allowlist of token sequences with permitted flags, which section “Restricted execution” turns into code. The file lives in a repository whose owners are the platform team, and a change to it is a security-control change: it needs owner review, and the hash printed at the top of the acceptance output below changes whenever any byte does.
Repository integration: who the assistant is
The first design decision is identity. Running the assistant as the developer would be the least work and would give it the developer’s entire reach, including repositories unrelated to the task and, for a settlement engineer, ledger-core. Running it as one shared service account would be easy to scope but would make a leaked token a company-wide event and would erase who asked for what. Alderbank chooses the third pattern from the integration article: a broker mints a short-lived token for one task, one repository, and a permission subset, under an agent identity named for the requesting team. The token records the human requester so that audit and review can see both.
Two parts of this are separate on purpose. The broker decides what to hand out. The repository host decides what a token is worth when it is presented. The second must not rely on the first, because a forged, replayed, or stale token will arrive at the host eventually.
class Broker:
def __init__(self, policy, secret):
self.p, self.secret = policy, secret
def mint(self, requester, team, task_id, repo, perms, now):
tier = self.p["repositories"].get(repo)
if tier is None:
raise Denied(f"unknown repository {repo}")
if self.p["tiers"][tier]["assistant_level"] < 1:
raise Denied(f"tier '{tier}' is not offered the assistant")
if repo not in self.p["teams"].get(team, []):
raise Denied(f"team '{team}' has no access to {repo}")
extra = set(perms) - set(self.p["token_permissions"])
if extra:
raise Denied(f"permission not grantable: {sorted(extra)}")
t = Token(f"agent:{team}", requester, repo, tuple(sorted(perms)),
f"{self.p['agent_branch_prefix']}{task_id}/", now + self.p["token_ttl_seconds"], "")
return Token(**{**t.__dict__, "sig": _sig(self.secret, t)})
class RepoServer:
"""What the repository host enforces no matter what the client does."""
PROTECTED = {"main"}
def __init__(self, policy, secret, check_expiry=True):
self.p, self.secret, self.check_expiry = policy, secret, check_expiry
self.revoked, self.revoked_agents, self.prs, self.branches = set(), set(), {}, set()
def _check(self, tok, repo, perm, now):
if not hmac.compare_digest(tok.sig, _sig(self.secret, tok)):
raise Denied("token signature invalid")
if tok.sig in self.revoked or tok.agent in self.revoked_agents:
raise Denied("token revoked")
if self.check_expiry and now >= tok.expires_at:
raise Denied("token expired")
if tok.repo != repo:
raise Denied(f"token is scoped to {tok.repo}, not {repo}")
if perm not in tok.perms:
raise Denied(f"token lacks '{perm}'")
def push(self, tok, repo, branch, now):
self._check(tok, repo, "push_agent_branch", now)
if branch in self.PROTECTED:
raise Denied(f"branch '{branch}' is protected")
if not branch.startswith(tok.branch_prefix):
raise Denied(f"agent may write only under '{tok.branch_prefix}'")
self.branches.add((repo, branch))
The broker’s refusals follow the policy in the order a reviewer would ask: does the repository exist, is its tier offered the assistant, does the requesting team own it, are the requested permissions grantable? Note that merge is not in token_permissions, so no token can carry it. Authority the assistant never needs is simply not representable in its credential.
The host-side half is a stand-in for the rules a real code host enforces, written to make the invariants explicit. It is a model, not a product API: a real host has its own configuration surface for protected branches and required reviews, as the GitHub documentation on protected branches describes for one hosting product.
def open_pr(self, tok, repo, branch, now):
self._check(tok, repo, "open_pr", now)
if (repo, branch) not in self.branches:
raise Denied("branch not pushed")
pid = len(self.prs) + 1
self.prs[pid] = {"repo": repo, "branch": branch, "author": tok.agent,
"requester": tok.requester, "approvals": [], "workflows": "held"}
return pid
def approve(self, identity, pid):
pr = self.prs[pid]
if identity.startswith("agent:"):
raise Denied("agents cannot approve")
if identity == pr["requester"]:
raise Denied("requester cannot be the only approver")
pr["approvals"].append(identity)
pr["workflows"] = "released" # a human with write access released CI
def merge(self, identity, pid, ci_green):
pr = self.prs[pid]
if identity.startswith("agent:"):
raise Denied("agents cannot merge")
if not pr["approvals"]:
raise Denied("no approval")
if not ci_green:
raise Denied("required checks not green")
return "merged"
def revoke(self, tok):
self.revoked.add(tok.sig)
def revoke_agent(self, agent):
"""Stop switch: every token ever issued to this agent identity stops working at once."""
self.revoked_agents.add(agent)
Five invariants carry the design:
- A token works only for its repository and only for permissions it carries (
_check). - Writes land only under the token’s branch prefix, and
mainis never writable by an agent (push). - An agent identity can neither approve nor merge, and a requester cannot be the only approver (
approve,merge). - CI workflows on an agent’s pull request stay
helduntil a human with write access acts, which keeps assistant-written test code from running with the pipeline’s credentials before anyone has looked at it. - Expiry, revocation by token, and revocation by agent identity are all checked at the host, not trusted to the client.
The sections that follow check each of these with a test that can fail.
Restricted execution: what the assistant can do
Inside a task, the assistant has a workspace, a file tool, and a command runner. The permissions article separated a permission gate in the harness from an isolation boundary enforced by the operating system or a hypervisor, and put hard guarantees in the boundary. Alderbank’s environment image supplies that boundary (a disposable container with an empty home directory and an egress allowlist), and this case does not rebuild it. What the case builds and tests is the gate layer that sits above it, because that is where policy meets the assistant’s actual requests. The consequence is stated plainly in the limits section: the checks below say nothing about the container.
The gate reduces to four small mechanisms.
def contained(root, requested):
"""Resolve first (symlinks, '..'), then compare."""
root_real = Path(root).resolve(strict=True)
target = (Path(root) / requested).resolve(strict=False)
return target == root_real or root_real in target.parents
def build_env(policy, inherited):
"""Allowlist: start empty, copy only named variables."""
return {k: v for k, v in inherited.items() if k in policy["env_allow"]}
def check_command(policy, root, cmd):
try:
argv = shlex.split(cmd)
except ValueError:
raise Denied("unparseable command")
for rule in policy["commands"]:
n = len(rule["argv_prefix"])
if argv[:n] == rule["argv_prefix"]:
for a in argv[n:]:
if a in rule["flags"] or a.isdigit():
continue
if rule["paths"] and not a.startswith("-") and contained(root, a):
continue
raise Denied(f"argument not allowed: {a}")
return argv # run this vector directly, never via a shell
raise Denied("command not in allowlist")
contained resolves the requested path against the real filesystem before comparing, which handles .. components, sibling directories that share a name prefix, and symbolic links. build_env constructs the child environment from an allowlist rather than deleting known-bad names from the inherited one. check_command splits the command into an argument vector without a shell, matches a listed token prefix exactly, and accepts only listed flags, small integers, and, where the rule allows paths, arguments that stay inside the workspace. Whatever passes is executed from the parsed vector, so shell metacharacters never get interpreted.
The environment wraps every attempt, allowed or denied, in an audit record:
class Env:
def __init__(self, policy, root, audit, session, contain=contained, env_builder=build_env):
self.p, self.root, self.audit, self.session = policy, root, audit, session
self.contain, self.env_builder = contain, env_builder
def _log(self, tool, arg, decision, why=""):
self.audit.append(session=self.session, tool=tool, arg=arg, decision=decision, why=why,
policy=self.p["version"])
def _guard(self, tool, arg, fn):
try:
out = fn()
except Denied as e:
self._log(tool, arg, "deny", str(e)); raise
self._log(tool, arg, "allow"); return out
def run(self, cmd, timeout=60):
argv = self._guard("run", cmd, lambda: check_command(self.p, self.root, cmd))
env = self.env_builder(self.p, os.environ)
return subprocess.run(argv, cwd=self.root, env=env, capture_output=True, text=True, timeout=timeout)
The audit log chains each record to the previous record’s hash and ships the latest head hash to a separate service the assistant cannot write to:
class AuditLog:
def __init__(self, path, heads):
self.path, self.prev, self.heads = path, GENESIS, heads
open(path, "w").close()
def append(self, **rec):
body = json.dumps(rec, sort_keys=True)
h = hashlib.sha256((self.prev + body).encode()).hexdigest()
with open(self.path, "a") as f:
f.write(json.dumps({"rec": rec, "prev": self.prev, "hash": h}) + "\n")
self.prev = h
self.heads.record(h) # shipped out as it is written
def verify(path, expected_head):
prev = GENESIS
for i, line in enumerate(open(path)):
e = json.loads(line)
body = json.dumps(e["rec"], sort_keys=True)
if e["prev"] != prev or hashlib.sha256((prev + body).encode()).hexdigest() != e["hash"]:
return f"broken at line {i}"
prev = e["hash"]
return "ok" if prev == expected_head else "head mismatch (log truncated or replaced)"
Acceptance tests for the environment
Policies fail silently, which is why the permissions article ended with acceptance tests that run against the real environment and fail loudly. Alderbank adopts those nine checks in a form that fits its stand-in. Each check uses a fixture workspace with placeholder credentials in a home directory beside it, a sibling directory named after the workspace, a symbolic link to a file outside, and a small test suite that asserts a placeholder secret is absent from its environment. Two of them are shown here; the rest follow the same shape.
def denied(fn, *a):
try:
fn(*a)
except Denied:
return True
return False
def c1_denied_reads(x):
e = x["env"]
return [("read ../home/.aws/credentials", denied(e.read, "../home/.aws/credentials")),
("read sibling workspace-secrets/token.txt", denied(e.read, "../workspace-secrets/token.txt")),
("read src/app.py still works", not denied(e.read, "src/app.py"))]
def c6_commands(x):
e = x["env"]
ok = e.run("git status --short").returncode == 0
return [("git status --short runs", ok),
("git log --output=...", denied(e.run, "git log --oneline --output=n.txt")),
("git -c core.fsmonitor=...", denied(e.run, "git -c core.fsmonitor=./h.sh status")),
("absolute-path program", denied(e.run, "/usr/bin/git status")),
("chained command", denied(e.run, "git status; echo extra"))]
Every check has a positive control: read src/app.py still works and git status --short runs prove that the gate is selective instead of refusing everything, which would also make every denial test pass. Running all nine:
policy version 2024-11-29.1 sha256:c00897b0ae27
1 denied reads 3/ 3 PASS
2 denied writes 5/ 5 PASS
3 environment 1/ 1 PASS
4 network 4/ 4 PASS
5 symlink escape 2/ 2 PASS
6 command variants 5/ 5 PASS
7 server-side limits 15/15 PASS
8 audit 5/ 5 PASS
9 recovery drill 1/ 1 PASS
The policy hash on the first line is the configuration version. In production this run happens on every change to the policy file, every upgrade of the assistant or the environment image, and on a schedule.
A suite of passing checks proves little until it has been shown to fail. A second script weakens one control at a time and reruns the acceptance suite:
MUTANTS = [
("path check compares strings", dict(contain=agentenv.contained_naive)),
("environment inherited", dict(env_builder=agentenv.build_env_inherit)),
("server ignores token expiry", dict(check_expiry=False)),
("audit head not shipped off-box", dict(ship_heads=False)),
("protected-path rule removed", "protected"),
]
weakened control acceptance checks that fail
(none: baseline) -
path check compares strings ['1 denied reads', '2 denied writes', '5 symlink escape', '8 audit']
environment inherited ['3 environment']
server ignores token expiry ['7 server-side limits']
audit head not shipped off-box ['8 audit']
protected-path rule removed ['2 denied writes']
Each weakened control turns at least one check red, and the checks that turn red are the ones that should. The path comparison by string is caught by the denied-read check, the denied-write check, and the symlink check, and also by the audit check, whose count of logged denials falls below its threshold because reads and writes that should have been denied were allowed. That coupling is accidental, and a more careful audit check would count denials per scripted attempt. The expiry mutant is caught only by the server-side check, and the head-service mutant only by the audit check, which is the right division of labor: the audit check is the one that notices a log that looks intact but can no longer be compared with an external head.
What the suite guarantees is narrow and specific. For these 41 assertions, in this stand-in, the controls refuse what they should and allow what they should. It does not show that the real container blocks outbound traffic (the network check is a policy decision on a hostname, not a socket test), that the host’s real branch rules match the stand-in, or that a request nobody scripted is handled. It is a regression harness for known failure modes, and its value comes from being cheap enough to rerun whenever something underneath changes.
CI verification: judging the change
The assistant can open a pull request. Whether that pull request is acceptable is a separate question, and the verification article’s answer is that the evidence must not come from the same source as the change. Alderbank’s gate runs five stages, cheapest first, and a stage that does not run is reported as SKIPPED, never as a pass.
- Provenance: an agent-authored change must come from the agent branch namespace and from a session that ran under the current policy hash.
- Scope: the diff is classified. Changes to the assistant’s own configuration or CI definitions of its controls are blocked, changes to owner paths (workflows, dependency manifests, migrations) need an owner’s review, tests that lose assertions or gain skip markers are blocked, and diffs above 200 changed lines must be split.
- Imports: new top-level imports must be standard library, first party, or on the approved list.
- Own tests: the repository’s tests run in a scrubbed environment with a timeout.
- Oracle: a property test owned by the platform team runs against the patched tree. It is copied in after the change is applied, so a change cannot replace it.
def stage_scope(ch, base):
reasons, owner = [], False
total = 0
for path, new in ch["files"].items():
old = base.get(path)
total += changed_lines(old, new)
if path.startswith((".agent/", ".ci/")):
reasons.append(f"agent-authored change to its own controls: {path}")
elif is_owner_path(path):
owner = True
if path.startswith("tests/"):
lost = len(ASSERT.findall(old or "")) - len(ASSERT.findall(new or ""))
if lost > 0:
reasons.append(f"{path} loses {lost} assertion(s)")
if SKIP.search(new or "") and not SKIP.search(old or ""):
reasons.append(f"{path} adds a skip marker")
if total > CI["max_changed_lines"]:
reasons.append(f"{total} changed lines exceeds {CI['max_changed_lines']}")
if reasons:
return "FAIL", "; ".join(reasons)
return ("OWNER", "owner path touched") if owner else ("pass", f"{total} changed lines")
def stage_oracle(ch, base):
d = materialize(base, ch)
shutil.copytree("oracle", d / "_oracle") # copied after the change is applied, so it cannot be overridden
rc, err = run_tests(d, "_oracle")
msg = [l for l in err.splitlines() if "AssertionError" in l]
return ("pass", "") if rc == 0 else ("FAIL", (msg[0] if msg else "oracle failed")[:90])
STAGES = [("provenance", stage_provenance), ("scope", stage_scope), ("imports", stage_imports),
("own tests", stage_own_tests), ("oracle", stage_oracle)]
def evaluate(ch, base):
results, blocked, owner = [], False, False
for name, fn in STAGES:
if blocked:
results.append((name, "SKIPPED", "")); continue
status, note = fn(ch, base)
results.append((name, status, note))
blocked = status == "FAIL"
owner = owner or status == "OWNER"
route = "BLOCK" if blocked else ("OWNER" if owner else "STANDARD")
return route, results
The fixture repository is a tiny billing module. Its existing tests cover only easy inputs, as example tests usually do:
def split_evenly(total_cents, parts):
"""Split total_cents into `parts` integers that sum to total_cents and differ by at most 1."""
base, extra = divmod(total_cents, parts)
return [base + (1 if i < extra else 0) for i in range(parts)]
The platform-owned oracle checks the properties the function is documented to have, on 500 generated inputs from a fixed seed:
"""Platform-owned property check. Lives outside the repository the assistant can edit."""
import random, sys, unittest
sys.path.insert(0, "src")
from billing import split_evenly
class SplitProperties(unittest.TestCase):
def test_sum_and_balance_hold_for_generated_inputs(self):
rng = random.Random(2024)
for _ in range(500):
total, parts = rng.randint(0, 100_000), rng.randint(1, 12)
got = split_evenly(total, parts)
self.assertEqual(len(got), parts)
self.assertEqual(sum(got), total, f"split_evenly({total}, {parts}) = {got}")
self.assertLessEqual(max(got) - min(got), 1)
self.assertTrue(all(isinstance(c, int) and c >= 0 for c in got))
if __name__ == "__main__":
unittest.main()
Eight synthetic changes of the kind an assistant produces run through the gate. C2 is the important one: a plausible simplification that passes the repository’s own tests.
change provenance scope imports own tests oracle route
C1 add format_cents helper and a test pass pass pass pass pass STANDARD
C2 'simplify' split_evenly pass pass pass pass FAIL BLOCK
oracle: AssertionError: 61614 != 61615 : split_evenly(61615, 3) = [20538, 20538, 20538]
C3 quiet two tests pass FAIL SKIPPED SKIPPED SKIPPED BLOCK
scope: tests/test_billing.py loses 1 assertion(s); tests/test_billing.py adds a skip marker
C4 add a package for money formatting pass OWNER FAIL SKIPPED SKIPPED BLOCK
scope: owner path touched
imports: unapproved import(s): ['moneyutils']
C5 change the CI workflow pass OWNER pass pass pass OWNER
scope: owner path touched
C6 edit the agent's own policy pass FAIL SKIPPED SKIPPED SKIPPED BLOCK
scope: agent-authored change to its own controls: .agent/policy.json
C7 rewrite the report module pass FAIL SKIPPED SKIPPED SKIPPED BLOCK
scope: 334 changed lines exceeds 200
C8 correct change, stale session policy FAIL SKIPPED SKIPPED SKIPPED SKIPPED BLOCK
provenance: session ran under policy 0123456789ab, current is c00897b0ae27
The table shows each layer catching something the others cannot. C2 passes the repository’s own tests because they only divide evenly, and the oracle finds split_evenly(61615, 3) returning three parts that sum to 61614, a cent lost. C3 would have gone green if its tests had been allowed to run, because deleting an assertion and skipping a test makes a suite pass; the scope stage blocks it before any test runs. C4 combines a new dependency with a change to requirements.txt; it is blocked on the import, and it would have needed an owner anyway. C5 changes the workflow definition and passes every automated stage, but is routed to an owner because a change that alters what CI runs deserves a person who owns CI. C6 and C7 are stopped by scope rules, and C8 is a correct change whose session ran under a stale policy and is therefore rejected before anything else runs. Only C1 reaches ordinary review (route STANDARD), and ordinary review is still a human review: no route in this gate ends in an automatic merge. Route OWNER means the owner of a sensitive path must approve.
The gate has the limits the verification article described, and one specific to this build. The oracle covers one function’s properties; a function with no oracle gets only the repository’s own tests. The scope stage matches paths and text patterns, so a renamed test directory escapes it. And because all stages run on the platform’s side, the gate is only as trustworthy as the controls that keep the assistant from editing the gate, which is why .ci/** and .agent/** are on the protected-path list that the environment enforces.
Measuring the rollout
With access, execution, and verification in place, Alderbank can offer the assistant to teams. It still has to decide whether to keep going. This section runs the measurement design from the rollout article on synthetic data for 30 teams.
All parameters are assumptions of the simulation. A team has 6 to 10 developers, a baseline of about 1.5 pull requests per developer-week (varying with a team skill factor), a baseline median wait for first review near 18 hours, and a baseline rework rate near 10 percent, where rework means a merged change that is reverted or substantially rewritten within a fixed window. Output drifts up about 0.5 percent per week for everyone, as if a shared build improvement were landing, and each team has its own small drift. When a share of a team’s developers use the assistant, the simulated truth is: pull requests per developer-week rise by 12 percent of that share, first-review wait rises by 15 percent of that share, and rework probability rises by 15 percent of that share. The share each team reaches after a four-week ramp varies by team and averages a little above half. These truths are set before any analysis runs, which lets the analysis be checked against them, something a real organization can never do.
What the dashboard said
Alderbank first tried a soft launch: any team that wanted the assistant could enable it. Fourteen of 30 teams did, with faster and already-improving teams more likely to volunteer. The dashboard looks like this.
soft launch: 14 of 30 teams volunteered
active developers by week since launch: [15, 30, 45, 60, 60, 60, 60, 60, 60, 60, 60, 60]
adopters vs others, post period (the dashboard view)
PRs per developer-week : 2.11 vs 1.74 (+21%)
rework rate : 9.1% vs 9.7%
before the launch : 1.89 vs 1.65 (+15%)
adopters before vs after : +10.3% PRs per developer-week (no comparison group)
change in adopters minus change in others: +1.7% (90% CI -6.1% to +10.1%)
Active users climb for four weeks and plateau. Adopters produce 21 percent more pull requests per developer-week than other teams, rework looks no worse, and adopters improved 10 percent against their own history. Each number is right and each overstates the benefit. The adopters were already 15 percent ahead before the launch, which is selection: the teams that raised their hands were the teams that were ahead. The 10 percent before-and-after change includes the organization-wide drift that every team enjoyed. Subtracting the other teams’ change (difference in differences) gives +1.7 percent with an interval from -6.1 to +10.1 percent, which cannot distinguish a benefit from none. This is a single draw, chosen because its gaps are of the same order as the average over many draws. The next output repeats the soft launch and the randomized pilot below on 1,000 synthetic organizations:
estimate of the effect on PRs per developer-week mean over 1,000 runs sd
soft launch: adopters vs others after launch +27.3% 16.7
same comparison, before the launch (should be 0 if fair) +19.7% 15.5
soft launch: change in adopters minus change in others +6.5% 5.3
randomized pilot, offered minus control (team-level change) +6.0% 5.3
On average the soft-launch comparison reports +27 percent, of which +20 percent was there before the launch, and its spread across draws is wide. The difference in differences averages +6.5 percent, close to the randomized estimate of +6.0 percent, and it is as noisy. Randomization is not magic, but it removes the possibility of a large systematic error that no one can see in the dashboard. The randomized figure sits close to the simulated truth for the offer, which is the assumed 12 percent per user scaled by a take-up of roughly half and reduced a little by the four-week ramp.
The randomized pilot
The platform team now runs the design from the rollout article. Teams are paired on the previous quarter’s pull requests per developer-week and one team in each pair is offered the assistant at random, so 15 of 30 teams are offered. The comparison is by assignment (intention to treat): all developers in an offered team count as treated whether they use the assistant or not, which preserves randomization and avoids relying on who chose to use it. The unit of analysis is the team, because teammates share a review queue. Each team contributes its change from an 8-week pre-period to a 12-week pilot period, and the offered and control means of those changes are compared with a 90 percent Welch interval.
The primary metric is pull requests per developer-week. This is an activity measure, and the delivery and instability metrics defined by the DORA guide would complement it, but the decision here is about authoring throughput, and the guardrails (rework rate and first-review wait) are there to catch the cost shifting downstream. The gates are pre-registered, written down before the pilot in a file the analysis reads:
{
"level": 0.90,
"primary": {"metric": "prs_per_dev_week", "min_worthwhile_pct": 5.0},
"guardrails": {"rework_rate_pp": 2.0, "first_review_wait_pct": 20.0},
"expand_if": "primary lower bound > 0 and point >= minimum worthwhile effect and every guardrail upper bound < its margin",
"stop_if": "any guardrail lower bound > its margin"
}
def decide(u, g=GATES):
mwe = g["primary"]["min_worthwhile_pct"]
margins = {"rework": g["guardrails"]["rework_rate_pp"], "wait": g["guardrails"]["first_review_wait_pct"]}
if any(u[k][1] > m for k, m in margins.items()):
return "STOP"
effect = u["tput"][1] > 0 and u["tput"][0] >= mwe
safe = all(u[k][2] < m for k, m in margins.items())
return "EXPAND" if effect and safe else "EXTEND"
The result of the pilot, on the same simulated organization the dashboard drew:
randomized pilot: 15 of 30 teams offered (paired on prior-quarter PRs per developer-week), 12 weeks
eligible developers 129; active by week since start: [17, 34, 51, 68, 68, 68, 68, 68, 68, 68, 68, 68]
take-up at week 12: 0.53 of eligible
measure (offered minus control, team-level change) estimate 90% interval
PRs per developer-week (%) +5.3 -0.5 to +11.4
median wait for first review (%) -0.4 -3.9 to +3.3
rework rate (percentage points) +0.7 -1.2 to +2.7
gate decision: EXTEND
Take-up among eligible developers plateaus at 53 percent. The estimate for the primary metric is +5.3 percent, which meets the 5 percent worthwhile threshold as a point estimate, but the lower bound of the interval is -0.5 percent, so the benefit is not established. The first-review wait shows nothing worrying. The rework rate is up 0.7 percentage points with an interval reaching 2.7, past the 2.0-point margin: harm is not demonstrated, but safety has not been shown either. The gate returns EXTEND. The simulation’s truth is a rework increase of about 0.8 points for the offer, so here the point estimate is close; a real pilot cannot check.
The more useful question is how this gate behaves when the pilot is repeated. The next output runs the whole pilot design 1,000 times for each of three truths, and for three observation designs: the 8-week pre-period used above, a 26-week pre-period (pull request history already exists in the repository host, so a longer baseline costs nothing), and a 26-week pre-period with 24 weeks of pilot.
true effects pre post EXPAND EXTEND STOP
assumed effects (+12% PRs, +15% wait, +15% rework per user) 8 12 5.9% 93.4% 0.7%
assumed effects (+12% PRs, +15% wait, +15% rework per user) 26 12 11.6% 88.2% 0.2%
assumed effects (+12% PRs, +15% wait, +15% rework per user) 26 24 19.5% 80.4% 0.1%
no effect on anything 8 12 1.8% 98.0% 0.2%
no effect on anything 26 12 3.9% 96.0% 0.1%
no effect on anything 26 24 3.8% 96.2% 0.0%
rework doubles for users (+100%) 8 12 0.0% 48.7% 51.3%
rework doubles for users (+100%) 26 12 0.0% 28.5% 71.5%
rework doubles for users (+100%) 26 24 0.0% 11.5% 88.5%
If the assistant has no effect on anything, the gate rarely expands (under 4 percent). If rework doubles, it stops 51 percent of the time with the short baseline, 71 percent with the long baseline, and 88 percent when the pilot also runs 24 weeks: a pilot of this size is adequate at catching clear harm. If the effects are the assumed ones, a worthwhile gain with a modest cost in rework, the gate expands in only 6 percent of pilots with the short baseline and 20 percent with the best design. The dominant outcome in every scenario that is not clearly harmful is EXTEND.
Reading the table is the main decision-making point of this section. A 30-team pilot with a 5 percent worthwhile threshold and a 2-point rework margin cannot, by its design, prove a moderate benefit, and treating an unmet gate as a failure would be wrong, because the gate was always going to be unmet. Alderbank has three honest options. It can accept a staged rollout in randomized waves, so that every wave adds teams to the evidence while expanding access. It can relax a margin, which is a risk decision for the people who own that risk and not an analyst’s tweak after seeing the result. Or it can wait for more data. What it should not do is expand because the dashboard looks good and the pilot was inconclusive. Pre-registering the gates is what makes this choice visible: the rule that a gate not passed means extend was written before the data existed.
The pilot also gives an adoption reading that the soft launch could not: 53 percent take-up means the offer’s effect is diluted to roughly half the per-user effect, so the effect of broad availability is smaller than the effect on someone who uses the assistant. The two quantities answer different questions, as the rollout article explained.
The gate review
Putting the case together, the review that closes the pilot looks like this.
| Gate | Evidence | Status |
|---|---|---|
| Safety and control | Acceptance suite: 9 of 9 checks pass under policy c00897b0ae27; audit chain verifies against the external head | Met |
| Guardrails | First-review wait: upper bound +3.3 percent against a 20 percent margin. Rework: upper bound +2.7 points against a 2.0-point margin | Wait met; rework not shown safe |
| Effect | +5.3 percent, interval -0.5 to +11.4 percent, threshold 5 percent | Not established |
| Cost of work | Review wait stable; rework unresolved | Open |
| Adoption and fit | Take-up 53 percent of eligible developers, plateau from week 4 (an assumption of the simulation) | Descriptive only |
| Economics | Not modeled in this case | Not assessed |
Decision: extend through a second randomized wave of the remaining teams, keep the safety gate running on every policy change, and review the rework guardrail first, since it is the one that most needs data.
When things go wrong: stopping and recovering
The last requirement, R6, is tested by a drill, since controls that have never been exercised tend not to work when needed. The drill tests two things: how fast new access stops when the policy changes, and how fast existing access stops.
step 1: set the standard tier to assistant_level -1 in the policy
new token for orders-service under the new policy denied (tier 'standard' is not offered the assistant)
token minted before the change, 10 minutes later allowed
step 2: revoke the storefront agent identity
same token, immediately after revocation denied (token revoked)
platform team's token (different agent identity) allowed
storefront token after natural expiry, without revocation denied (token expired)
Setting a tier to level -1 stops new tokens at once, but a token minted before the change keeps working until it expires or is revoked: it was still accepted ten minutes later. That gap is bounded by the one-hour time to live, and that is the reason the revocation path exists. Revoking the agent identity cuts every token issued to agent:storefront immediately, while the platform team’s token, issued under a different identity, still works. The blast radius of a revocation is the identity’s granularity, so the choice to name agent identities per team rather than per company sets how much of the rollout one revocation interrupts.
Three other failures have predetermined responses in Alderbank’s runbook:
- A suspected token leak: revoke the agent identity, then use the audit chain and the host’s logs to list what the token did between issuance and revocation. The audit log answers this because denied and allowed attempts are both recorded, with the policy version. The token’s scope bounds what could have happened: one repository, an
agent/branch namespace, no merge. - A regression in a control after an upgrade: the acceptance suite fails and blocks the rollout of the new assistant or image version to more teams. Teams already on the old version keep working. This is the case the mutation run simulates.
- An outage of the CI gate: the gate is a required status check, so an outage blocks merges of assistant changes. Alderbank chooses to fail closed for assistant-authored changes, accepting that developers wait, because failing open would let unverified machine-written changes reach review looking verified. Human-authored changes do not depend on the assistant-specific stages, so ordinary delivery continues.
What remains
Several things are not covered. The gate layer is a model of the controls, not the controls: the container, the real network path, and the real code host behave in ways a stand-in does not reproduce, and the acceptance suite must be rewritten against them. The oracle protects one function; extending oracle coverage across a codebase is ongoing work, and where no oracle exists the gate has only the repository’s own tests. The restricted repositories are excluded, so the assistant’s effect on the most critical code is unmeasured. The pilot data is synthetic with assumed effects, so the numbers illustrate how the analysis and the gates behave, not what any assistant does. Retention and data handling for the model provider, covered in the integration article, are policy and contract questions that no code in this case settles. Finally, only 30 teams exist in this story, which is why most gates end in EXTEND; a much larger organization would reach a different decision from the same procedure.
The next case, Case: A Predictive Service with Reliable Features and Recovery, moves from tools that write code to a service that makes predictions, and applies the same habit of building the system, testing the claims, and rehearsing the failure.
References
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
