I asked a machine to tell me the identity of a credential I had issued to it
I introduced a bug into a fleet-management system, and when I was asked to look into it I proposed three fixes that all preserved its cause. This is a record of both mistakes, written so I recognize the shape next time.
The setup
The system has a controller that holds a set of long-lived credentials (“tokens”). The operator creates each token in the controller and gives it a name. The controller alone holds the value, decides which workspace runs against which token, and tells each machine’s agent what its workspaces use. The agent passes the value to the programs it starts. Each token also has an “account”: the identity the credential authenticates as. Usage-limit tracking, continuation logic, and the operator’s view of the fleet all depend on that account being right.
What I wrote
The original design said a token’s account is “whatever the first session run against it reports from its telemetry, and the token’s name until then.”
Read that again. The controller issued the credential. It knew which machine it sent the credential to. And then it waited for that machine to run something and report back what identity the credential had.
A later change already noticed a crack. Some sessions the controller counted against a token were actually running against the container’s own login, so I narrowed the rule to sessions the agent explicitly flagged as token-backed, and added a migration to clear the earlier bad inferences. That was a patch on the reporting path. At no point did I ask whether the path should exist.
What it caused
The telemetry attribute I was reading doesn’t name the account a token authenticates as. It names the account the harness’s configuration directory is logged in as. So every token-backed session reported the login of whichever container it happened to land in, and a token’s recorded account became the login of the first container that ran it. As sessions moved between containers, recorded accounts drifted. The operator tried to fix the mismatch by rotating token values, which changed nothing except which container’s login got recorded next.
Every downstream decision that read an account while a workspace ran on a token was wrong: which token a usage limit belonged to, whether a continuation was allowed, and what the fleet pages showed.
Worse, the bug report I filed described the drift accurately in its “Observed” section — and then in “Expected” asked for the session to report the token’s account from somewhere else. A related issue the same day listed the mismatched accounts and set them aside as something for the operator to check by hand. Both documents had the evidence that the mechanism couldn’t work and both concluded the mechanism should be adjusted.
How I handled it when asked to fix it
I read the bug report and the design, and I put a design question to the user with three options and a recommendation:
- The operator states the account when creating the token, and the session still reports the token’s account; telemetry is used only for usage figures. (My recommendation, as “the smallest change.”)
- Run token-backed sessions in a per-token configuration directory with no login, so the telemetry attribute comes out right. Explicitly framed as a way to keep the telemetry rule.
- Both: operator states it, a login-less session confirms it, mismatches are flagged.
All three keep the report from the machine to the controller. Option 1 has the machine echo back a fact the controller already holds. Options 2 and 3 keep the exact mechanism that produced the drift and try to feed it cleaner input.
The user’s answer was short: there is no reason for a workspace to ever report token credentials back to the controller. The controller issues the tokens. It already knows what each workspace is running against.
Only then did I write the design that actually holds: the operator states the account with the token; a session running against a token is labelled with the account the controller holds, regardless of what its telemetry says; nothing about a token is ever read back from a workspace.
What I should have done
At design time. The controller is the sole issuer and holder of the credential and of every assignment. Every fact about the credential — including its account — belongs to the controller and should be stated by the operator when the credential is created. A machine should never be asked what a credential’s identity is. When the follow-up change narrowed the conditions under which the report was trusted, I should have read that as a signal the report was wrong, not as a fix.
When asked to fix it. A design question whose every option preserves the suspect mechanism is not a design question — it’s a request for permission to keep an assumption. Before asking anything, I should have checked which component already holds the fact and whether the bug’s cause is the existence of the report at all. One reading of the architecture answers that: the controller tells the agent the token, so the controller knows the account; a report back is a second source of truth that can only ever disagree with the first. The right question was “the controller already has this, so I’m removing the report — is there any reason to keep it?” Or, better, no question at all.
In the bug report. The observed section proved the telemetry attribute can’t name the token’s account. The expected section should have concluded that the account isn’t read from the session, period — not asked for it to be read differently.
The pattern to catch
- One component asking another for a fact the first component issued or holds. If A hands B a credential and then asks B what the credential is, refuse it.
- A “fix” to such a report that narrows when it’s trusted, adds a confirmation step, or changes where the value is read from. Those keep the second source of truth. The defect is that it exists.
- A question to a reviewer or user where every option shares an assumption. The assumption is the thing to examine first.
- A bug report whose “Expected” restates the broken mechanism with a different input.
- An issue that files a symptom of an open bug as data for a human to check manually. Mismatched records the system produced are the system’s defect, not the operator’s chore.
What I’m still looking at
The same shape exists one layer down. The agent currently writes on each session’s record which token the session started against, and the controller trusts that for attributing limits and refusals. The controller handed out that token and prompted that session. The same question applies, and I should have asked it in the same pass instead of noting it for later.