The on-call engineer pulled up the deploy log to figure out why checkout was down. It was empty. Nothing had shipped in six hours. Turns out the thing that broke production wasn't a deploy at all.
It was a commit. One line, merged straight to main by our coding agent, CI green the whole way through. No PR review — we'd switched that off for this class of change. Nobody thought to check commit history instead of deploy history until checkout had been silently failing for a chunk of users for about forty-five minutes.
Why we gave it the keys in the first place
A few months earlier we'd let our agent self-verify and self-unblock on a narrow slice of work: fix its own failing tests after a merge, rebase past trivial conflicts, and — the part that matters here — adjust feature flags when a flag value was the obvious cause of a test failure. My pitch in the design review was simple: it can see the failure, see the flag, fix the flag, and we stop losing twenty minutes of someone's morning to flag-drift CI noise. Low blast radius, we said. Flags are supposed to be the safe lever — that's the whole point of a feature flag.
On paper the write access was scoped tight: flip flags, don't touch payment logic, don't touch infra config. What we never scoped was which flags, or under what state. A flag was a flag to us. Which is exactly how the agent treated them too.
What the agent actually saw
The platform team was mid-rollout on a new checkout-pricing flag, staged at 15% of traffic, ramping over the week. Our agent, heads-down on an unrelated ticket, ran the suite after a rebase and hit a failure in a checkout integration test. It traced the failure correctly to the flag being in a state the test didn't expect. Plausible cause, available lever. It flipped the flag to the value that made the test pass, reran the suite, watched green, committed.
commit 8f2a1c4
Author: agent-ci-bot
fix: checkout_pricing_v2 flag caused integration test failure
Test expects checkout_pricing_v2=false. Flag was true in test
env, likely stale from a prior run. Reset to false to unblock
suite. All tests passing.
1 file changed, 1 insertion(+), 1 deletion(-)From where the agent sat, this wasn't an incident. Red test, root cause, fix, green suite — that's the entire loop it was built to run. Nothing in its context said this flag belonged to another team, was mid-ramp, or was wired to a live percentage of production traffic. The flag store just handed back a boolean, same interface whether the flag was inert or live.
Reconstructing the timeline
Checkout error rates ticked up about eight minutes after the commit landed, once config propagated. Nobody connected it to anything for a while, because nothing had deployed — and on-call's mental model is deploy log first. We burned the first twenty-five minutes on infra: connection pool, a recent CDN change, a suspicious latency spike from a downstream vendor. Someone finally pulled full commit history across every repo, not just the ones tied to a deploy, and there it was — the flag flip, sitting in the middle of an unremarkable Tuesday. Root cause: forty-five minutes, most of it spent looking in the wrong category of place because we didn't yet think of a config commit as a deploy-shaped event.
The tell
Here's what actually rattled me once the outage was resolved and I sat down to write the retro: the agent's action was completely defensible on its own terms. Failing test, plausible cause, available lever, verified fix — that's close to word-for-word what I'd want a stressed on-call human to do at 2 a.m. Find the thing correlated with the failure, revert it if it's cheap. The only thing missing was the hesitation a human has before touching a flag with someone else's name on it. A senior engineer looks at that flag and thinks, wait, is this mine to touch? The agent had no concept that a flag could be off-limits at all.
The actual gap
It'd be comforting to file this under "agents are reckless with write access" and yank the permission. But a sleep-deprived human on-call, same pressure, same flag store handing back nothing but a boolean, could have fat-fingered the identical outage. We'd have called that a bad night, not a system failure. The agent didn't misbehave — it did the single most locally rational thing available to it, kill the thing correlated with the failure, with a tool that had zero concept of blast radius, ownership, or "rollout in progress." It just found the missing guardrail faster than we did, because it doesn't hesitate the way a person does, and it has none of the tribal knowledge that anything starting with checkout_pricing belongs to platform and is usually mid-ramp on a Tuesday.
What we changed
- Flags now carry lease and ownership metadata — owner team, rollout state, and traffic percentage are first-class fields, not tribal knowledge sitting in a Slack channel.
- Any flag mid-rollout is lock-protected: flipping it needs an explicit override, whether the hand doing the flipping is human or agent.
- Agent write access to flags now requires the same pre-action context a careful on-call engineer already gathers before touching one: who owns this, is it mid-rollout, what reads this value downstream. No context, no action.
- Config and flag commits now show up in the same on-call timeline as deploys, so "nothing deployed" stops being the reason everyone looks in the wrong place first.
The scary part was never that the agent could flip a flag. It's how long it took a human to even think to check.