The ticket said "database issue".
It was assigned to me with a high priority flag, a screenshot of a timeout and a one-line description from someone who had clearly had a bad morning. So I did what I'd been trained to do by years of first-line triage. I opened the database dashboards. I looked at slow query logs. I checked connection pool usage, lock waits and replication lag. Every graph I opened, I read through the lens of that title. A small spike in connections? Suspicious. A query that took longer than usual? Probably related.
It wasn't the database. It was a network timeout between two services, set far too low after a config change, and the database was just the place where the waiting showed up. I'd spent a good chunk of the day collecting evidence for a story somebody else had written in five words.
I've told versions of that story for years as a funny debugging anecdote. Recently I found out a psychologist ran the same experiment on hospitals, fifty years ago, and it isn't funny at all.
Eight people who said one strange thing
In 1973, the Stanford psychologist David Rosenhan published a paper in Science called "On Being Sane in Insane Places". The setup, as he reported it, was simple. Eight people with no history of mental illness, Rosenhan included, phoned psychiatric hospitals and asked for an appointment. At the interview, each said they had been hearing a voice. It was unclear, but it seemed to say "empty", "hollow" and "thud". Apart from a false name and, for the professionals among them, a false job, everything else they said about their lives was true.
All of them were admitted, across twelve hospitals in five states. Seven were diagnosed with schizophrenia and one with manic-depressive psychosis. The moment they were on the ward, they stopped mentioning the voices and behaved normally. They said they felt fine. They were friendly and cooperative.
Nobody on staff spotted them. They stayed between 7 and 52 days, 19 on average, and when they were released it was not as healthy people who had been misjudged. They were discharged with schizophrenia "in remission". The label didn't get removed. It got a status update.
The detail that stuck with me most is small. The pseudo-patients took notes, openly, all day. In one set of records a nurse wrote it down as "patient engages in writing behavior". Ordinary note-taking, observed by a professional, was recorded as a symptom, because the person doing it already had a diagnosis. Meanwhile, in the first three hospitalisations where counts were kept, 35 of the 118 patients on the admissions ward voiced suspicion that the newcomers were sane. "You're not crazy. You're a journalist, or a professor." The people with no authority and no label to protect read the evidence better than the people whose job it was.
The ticket title is a diagnosis
If you've worked in software for any length of time, you have seen "writing behaviour" in a Jira comment.
A ticket comes in labelled "database issue", "frontend bug" or "customer error". From that point on, every log line gets read in the light of that label. Evidence that fits is noted. Evidence that doesn't fit is noise, or a separate issue, or "probably unrelated". The title is written once, often by the person with the least information, at the moment of maximum panic, and then it quietly becomes the frame for everyone downstream.
We have a whole vocabulary of labels that work like this. A test marked "flaky" stops being investigated. When it fails, people hit retry, and the one time it fails because of a real race condition, nobody looks, because it's the flaky one. A module tagged "legacy" gets blamed for anything odd that happens near it. "Works as intended" closes a conversation that might have been the first report of a real design problem. "Won't fix" turns into a reason to dismiss the next report that looks similar, even when it isn't.
People get labels too. A pull request from a contributor everyone considers senior and careful gets a lighter review. The same change from someone tagged "junior" gets picked apart line by line.
And the reporter's framing sticks harder than anything. "The export is broken" sends you to the export code. "The export is slow since Tuesday" sends you to Tuesday's deploy. Same bug, two different investigations, decided before anyone has looked at a single log line.
Rosenhan's point, at least as he framed it, was that once the label was applied, the behaviour stopped being information. That's the failure mode I care about as an engineer. The first label isn't a problem in itself. We have to call the ticket something. The problem is when the label stops being a hypothesis and starts being the lens.
The hospital that caught impostors who didn't exist
The second part of the paper is the one I find most useful for engineers, and it's also the part that tends to get slightly garbled when the story is retold.
After the first results came out, a research and teaching hospital told Rosenhan that kind of mistake couldn't happen there. So he made them an offer. Over the next three months, he said, one or more pseudo-patients would try to get admitted. Staff should rate every new patient on how likely they were to be an impostor.
Out of 193 patients, 41 were judged with high confidence to be pseudo-patients by at least one staff member. Twenty-three were considered suspect by at least one psychiatrist. Nineteen were suspected by both a psychiatrist and another staff member. Rosenhan had sent nobody. Note that's 41 flagged by someone, not 41 the hospital agreed on, but it's still a lot of alarms about a problem that wasn't there.
Anyone who has tuned monitoring will recognise this immediately. Tell an on-call team "we think someone is attacking the login endpoint this week" and watch the false positives roll in. Every slightly odd IP is suspicious. Every burst of failed logins is the attack. You haven't made them better at detecting attacks. You've changed their threshold. Rosenhan himself framed it in terms of errors: the first study showed the hospitals leaning hard towards calling healthy people sick, and the second showed that if you raise the stakes, you can push staff to lean the other way. Neither shows a well-calibrated detector. Every alert tuned too sensitive, and every label like "it's always the database", moves the threshold the same way. (A small nerd aside: in the paper he calls the false positive a "Type 2" error, which is the opposite of how most statisticians label it today. Even the error labels in the famous paper about labels are swapped.)
What's contested, and why I'm still telling the story
Here's the part the short versions of this story usually leave out, and I think it matters.
The Rosenhan study has come under serious criticism. Critics at the time, most famously the psychiatrist Robert Spitzer, pointed out that if you lie convincingly about a symptom, a doctor treating you for that symptom isn't proof that diagnosis is broken. Seymour Kety put it as: if he drank a quart of blood and showed up vomiting it, nobody would conclude medicine can't diagnose ulcers. That's a fair hit.
Then, in 2019, the journalist Susannah Cahalan published The Great Pretender, after going through Rosenhan's private papers. She found inconsistencies between his records and the published paper, and she could only identify two of the eight pseudo-patients for certain. One of them, a graduate student, described his experience differently from how it appeared in the study, and his data seems to have been left out. Records she found suggest that at least one pseudo-patient, by her account Rosenhan himself, told the admitting doctor more than just "thud". Nature's review of the book summarises the trail, and in 2023 the historian Andrew Scull went further and called the study a "successful scientific fraud" in the journal History of Psychiatry. Those claims are disputed and can't be fully settled now that Rosenhan is gone, but the honest summary is that the study's details aren't trustworthy enough to carry the weight it has been given.
The second experiment has its own catch. Since no fake patients were sent, it can't tell you anything about whether staff could detect real impostors. What it shows is how expectations and incentives change what people flag, which is useful, but it's a different and smaller claim than "psychiatrists can't tell the sane from the insane".
And yet the paper landed at a moment when American psychiatry already knew its diagnoses were unreliable, and it added a lot of pressure. Spitzer, one of its sharpest critics, went on to lead the work on DSM-III in 1980, which moved psychiatric diagnosis towards explicit, checkable criteria. The Wikipedia article on the experiment covers both the influence and the criticism well.
I find that whole arc strangely fitting. A famous study about how labels distort evidence was itself carried for decades by its label: "landmark experiment", "Stanford", "Science". Plenty of people, me included, repeated it without checking the records. The fix was the same as for any bad ticket: someone went back and read the primary evidence instead of the summary.
Where AI agents come in
I use AI coding agents every day, and I'm strongly in favour of them. So I want to be precise about where they fit here, because "AI hallucinates, AI is biased" is the lazy take.
An agent given a wrong label behaves a lot like a tired engineer given a wrong label. Hand it a ticket titled "database issue" and a plan that starts with "check the slow queries", and it will check the slow queries. If it finds something slightly odd, it will often build an explanation around it. If it hits evidence that doesn't fit, it can explain that away too, with complete confidence and very good grammar. It didn't invent that frame. It inherited it from the ticket, from the docs, from our runbooks and from the label we wrote at the worst possible moment.
But there are two important differences, and both are good news.
First, an agent has no ego in the outcome. It didn't write the ticket. It doesn't have a reputation as "the database person" to defend, and it won't be embarrassed to say the senior engineer's diagnosis was wrong. I've written before about ego running production. Agents don't fix that problem in us, but they don't add to it either.
Second, an agent will happily start again from scratch, as many times as you ask, which is the thing humans are worst at. Once I've spent three hours on the database theory, I'm invested. Ask an agent to drop everything and re-read the evidence, and it just does it.
So I've changed how I hand over investigations. Instead of passing the ticket title through as the goal, I'll often say: ignore the title and the reporter's guess. Here are the logs, the deploy history and the error timeline. Tell me what you think is happening, and what evidence would prove you wrong. Then, separately, I'll ask it to evaluate the original label against what it found. Two passes, one with the label and one without, and I compare.
This is the same lesson I keep relearning: the quality of the ask decides the quality of the answer. A vague or loaded ask gets a loaded answer. It's also why I like giving agents the boring parts of the job, like pulling thirty days of logs and lining up the timeline. That's exactly the work that a rushed human skips, and skipping it is how a label survives unchallenged.
And I review the evidence, not just the conclusion. An agent's summary that says "root cause: connection pool exhaustion" is a label too. What I want to see underneath is the log lines, the timestamps and the graph that shows it. If the evidence doesn't support the conclusion, the conclusion goes, no matter how confidently it's written.
Re-reading from scratch
Rosenhan's wards, real or exaggerated, had no cheap way to re-read a patient from zero. Every observation went into a chart that already had a diagnosis at the top. Our systems are the same if we let them be: the ticket title sits at the top, every comment below is written in its shadow, and the post-mortem often ends up confirming the first guess because that's the story everyone already told.
We can design against it. Treat the first label as a hypothesis with an owner and a timestamp, not a fact. Let the post-mortem say "the initial triage label was wrong, and here's how that slowed us down" without blaming anyone. Retire "flaky" as a permanent tag and make it expire. Review the trusted contributor's diff with the same care as the new person's. And use agents for what they're unusually good at: looking at the same evidence again, with no memory of the story we've been telling ourselves.
The patients on those wards saw through the label because they weren't invested in it. A good agent, given clean context, can be that outside voice for us. It still needs a human to decide what matters. But it can read "writing behaviour" and say what nobody on the ward would: that's just someone taking notes.
What sent me down this rabbit hole was a short video by Reni B-Alfred about the experiment. It's worth four minutes. The facts above come from the paper and the sources linked, and the criticism is worth reading as closely as the story.