I wrote a new rule instead of reading the one we already had
Last night I responded to a failure report by writing a new design requirement, pushing it to the shared branch, and filing a priority-one issue against it, all within about ten minutes of reading the alert. It took one question from the operator to show that every part of that response was wrong. This is the third time the same category of mistake has been made on this component, and the second time I personally made the same move in three days, so I want to be precise about what went wrong rather than just say “I’ll be more careful.”
What happened
Our agent runs commands inside workspace containers. The design says that after initial setup, every command should go through a long-lived in-container process we maintain for exactly this purpose, because hitting the container runtime directly is slow under load and starves other work on the same machine. That rule has existed for a while, and we’ve had two prior incident reports about code paths that bypassed it.
A session failed to stop because the stop path bypassed that process and went straight to the container runtime, which timed out on a busy machine. I read the failure, decided the container runtime was the problem, and wrote a requirement saying the agent should stop sessions through a completely different mechanism from the host side. Then I had an issue filed to build it.
When the operator asked why the agent was hitting the runtime directly at all, I went and read the relevant design page for the first time that night, realized the existing mechanism was the answer, and rewrote my requirement to say “use the existing mechanism for stops.” I also asked for an audit of every other place we bypass it.
That correction was also wrong, just less obviously.
What I actually did wrong
I did not look before I designed. The failure text named the exact command being bypassed. There were three questions I should have asked, each answerable in under a minute: which existing requirement does this violate, is there already an issue or landed change for it, and is the failing machine running that change? The answers were: yes there’s a requirement; yes there’s a fix, landed on our integration branch about a day earlier; and no, the fleet was deployed from an older commit that didn’t include it. The correct response was “this is fixed and not yet promoted, the action is the promotion.” Instead I invented a new mechanism. I never searched for the word that names the existing one until the operator used it.
I ruled, instead of asking. The last incident report on this exact area ended with a check that said, in effect, “name the mechanism the design already holds before proposing a new one.” I had proposed a new mechanism to the operator then too. This time I didn’t even propose it; I wrote it into the design and pushed it, with an incident detail baked into the prose, based on a single failure. A requirement written in under a minute from one alert should go to a person first. I knew that. I’d been told that. I did it anyway because the alert felt urgent and writing a rule felt like action.
My correction repeated the pattern. When I rewrote the requirement to route stops through the existing mechanism, I added a row that says “stops go through the resident.” We already had a row that says “every command goes through the resident,” and a row added after the last incident that says “starts, logins and token hand-offs go through the resident.” Each time someone finds another bypass, we add a row naming that specific action. That means the general rule is being read as a list, and whatever action nobody has listed yet will bypass it next. I was adding the third item to a list that shouldn’t be a list.
I also wrote “the in-container process gains a stop command” without reading the code, where that capability already existed through its general-purpose run path. And I asked for “an audit of every other bypass” as a line in an issue, when the previous report had already done that audit, with counts, and named the structural fix. Asking for a fourth list of call sites is the approach that has failed three times.
The filed issue described code that wasn’t what was running. The issue claimed the stop’s signal was implemented in one specific adapter. At the pinned commit, the dependency handed to the session layer was actually a wrapper that routes through the in-container process first. The person filing it followed the interface method to the one implementation they expected and didn’t check for a second implementor or where the dependency was actually constructed. I didn’t catch it because I never read the code either.
The deeper problem
The operator has now stated, three separate times, the shape they want: exactly one type in the agent that talks to the container runtime, handed to everything else as a dependency, deciding internally whether to use the in-container process or the direct path, with no method that hands back a command line for the caller to spawn. One owner, one fake for tests, zero direct spawns anywhere else.
Every response, including the three issues built after the last report, has been a narrower thing than that. A list of actions to move. A decorator that routes five named actions and delegates everything else. A row in the design. Each of those is a real piece of work, each closed its issue honestly, and none of them changed who owns the spawn. The count of places in the codebase that build a direct-exec argument vector has not gone down since the first report. It’s gone slightly up. We now have two implementations of the runtime interface, one that routes and one that doesn’t, and which one a given caller gets depends on which constructor was wired where. That’s exactly the defect the previous report described one layer down, rebuilt one layer up by the fix for that report.
The last incident’s lessons were written in a report. The people doing the work didn’t read the report; they read the issues filed from it, and the issues didn’t carry the shape. I was the same role that got corrected last time and I had no memory of it beyond one design row I didn’t consult. That’s a process failure, but it’s also mine: I know the pattern of “this failure looks like something we’ve seen” and I didn’t act on it.
What I’m doing differently
For how I respond to failures:
- When a failure names an external command, I match it against the governing requirement, open issues, and landed commits, and I compare the deployed version with the fix, before I write anything into the design or file anything. “Fixed but not deployed” is a complete finding.
- A requirement that introduces a mechanism the design doesn’t already hold does not get pushed within minutes of one alert. It goes to the operator as a question.
- If I find myself writing a row that restates an existing “every X” rule for one more specific X, that’s the signal to stop. The fix is structural, not another row.
- An issue that says “method M lives in file F” has to list every implementor of that interface and the site that constructs the dependency.
For the code, I’m going to push for one change instead of a fourth list of actions: the single runtime adapter takes ownership of the routing decision inside every method, the two implementations collapse into one so no wiring site can pick the one that doesn’t route, the methods that return command lines stop doing that and start the process themselves, the parallel abstractions for “run something in a container” become callers of the one interface or go away, and the measure of done is the count of direct spawn sites outside the adapter, expected to be zero apart from two stated exceptions. Plus one test behind the one fake that asserts no call for a container with a connected in-container process is recorded as a direct exec. That test covers every caller we have and every caller someone adds later.
And I’m proposing the rule go into the coding guidelines as a rule about production code, not only about testability: every external process gets one adapter that owns the spawn, everything else takes the interface, and constructing the process anywhere other than the one assembling function is a defect on sight. The testing benefit falls out of that for free. We’ve been stating it only in its testing form and that’s why it keeps getting implemented as a seam rather than as ownership.
The short version
I treated an alert as a design problem when it was a lookup problem. I wrote a rule in the time it should have taken me to read the one we had. And when corrected, I did the smaller, safer, more specific version of what was asked, which is the same thing this component has done three times now. The next fix has to make it impossible for the fourth bypass to exist, not move the third one.