---
title: "What an agent gets wrong about robots.txt, and what it costs"
description: "One line copied from a staging config — Disallow: / — removes a site from search without raising anything a developer would look at. Here is the family of crawl-policy defects that fail silently, and how to see them."
url: https://harpywatch.com/blog/what-an-agent-gets-wrong-about-robots-txt
kind: article
author: "The HarpyWatch team"
published: 2026-11-19T09:00:00+00:00
tags: ["AI Agents", "SEO"]
publisher: "HarpyWatch"
---

# What an agent gets wrong about robots.txt, and what it costs

An agent is asked to set up a deployment. It finds an existing config in the
repository — the staging one, because that is the one that was checked in — and
copies it forward. Among the files it copies is a `robots.txt` containing two
lines:

```
User-agent: *
Disallow: /
```

On staging that file is correct. It is the right thing to do, and somebody was
being careful when they wrote it. On production it means: no search engine
should crawl any page of this site.

The deploy succeeds. The site loads. Every test passes. Nothing in the systems
anybody is watching raises a fault, that day or in the month after it.

## The failure is invisible in every way a developer normally looks

Go through the checks a person actually runs after a deploy.

Open the site in a browser: it works. Every page renders, every link resolves,
the styling is right. Run the test suite: green, because no test asserts
anything about a file that is not part of the application. Check the logs: they
are clean, because serving a static text file is a success. Look at the status
code: `200`. The file is being delivered exactly as written.

Watch the analytics for a day: normal. This is the part that closes the trap.
Crawlers do not respond to a new robots policy immediately, and the pages
already indexed do not vanish on Tuesday. They decay. Rankings slide, the
indexed page count drops, and organic traffic falls over weeks — slowly enough
that it reads as seasonality, or a competitor, or an algorithm update, or a bad
month.

By the time somebody thinks to open `/robots.txt`, the deploy that caused it is
six weeks back in a log nobody is correlating against a traffic chart. And the
recovery is not symmetrical with the damage: removing the line is one commit,
and getting the pages re-crawled and re-ranked takes as long as it takes,
because that clock belongs to somebody else's system.

## The adjacent versions of the same mistake

`Disallow: /` is the loudest member of a family. Every sibling has the same
property — correct in one environment, silently destructive in another, and
undetectable by looking at whether the site works.

**A `noindex` meta tag left in.** `<meta name="robots" content="noindex">` in a
layout template, added while a section was being built and never removed. This
one is worse than the robots file, because it removes pages that have already
been indexed rather than merely preventing new crawls, and it lives in the
application's own HTML where nobody thinks to look for configuration. The
header version, `X-Robots-Tag: noindex`, is worse still: it is invisible in
view-source.

**A canonical pointing at staging.** `<link rel="canonical"
href="https://staging.example.com/pricing">` on the production pricing page is
an instruction telling search engines that the authoritative version of this
page is somewhere else — a host that is probably password-protected, probably
itself marked `noindex`, and possibly not resolving at all. The production page
renders perfectly and volunteers that it is a copy.

**A sitemap listing a hostname that no longer exists.** The sitemap is
generated at build time from a base URL in configuration. Get that wrong and
you publish a document full of URLs on the old domain, the staging domain, or
`http://` when the site is `https://`. Crawlers follow it, get redirects or
failures, and learn that the site is unreliable rather than that the sitemap is
wrong.

**A `Disallow` that is narrower and therefore harder to spot.** `Disallow:
/api/` looks entirely sensible until the site is a single-page application
whose content is rendered from those endpoints, or until a marketing route
happens to live under that prefix. The site is not gone from search. Part of it
is, which nobody notices at all.

None of these throw. That is the whole category: **configuration that instructs
a third party to do something, where the third party is not in your monitoring
and does not report back.**

## Why agents produce this specific mistake

Not because the reasoning is bad. Because the reasoning is good and the context
is missing.

An agent copying a staging config forward is doing something defensible — the
file existed, it was in the repository, it was the pattern in use. There is
nothing in the file that says which environment it belongs to. Environment
distinctions in most repositories are conventions carried in people's heads and
in a deploy script's variable substitution, and a `robots.txt` sitting at a
fixed path is not marked as environment-specific in any way a reader can see.

The same applies to the canonical tag and the sitemap base URL. Both are
absolute URLs written into build configuration. Both are correct for exactly
one environment. Neither carries any indication of which.

And the feedback loop that would normally correct this does not exist. An agent
verifies its work by running things and looking at output. Every available
signal here says success. There is no observation an agent can make within its
own session that distinguishes a correct robots file from a catastrophic one,
because the difference is not in the file — it is in which hostname is serving
it.

## Checking a file that cannot fail

If a defect never produces a fault, the only way to find it is to write down
what the right answer is and compare the served one against it. That is an
assertion, not an exception handler, and it has to be made deliberately because
nothing will prompt you for it.

`robots-policy` is that assertion. It fetches the file from the public
hostname and evaluates the directives against what you say they should be, so
`Disallow: /` on a production asset is a failed check within one interval — not
a traffic trend six weeks later. And `sitemap-health` fetches the sitemap,
parses it, and confirms the URLs it lists actually resolve, which is what
catches the stale hostname and the `http://` base URL.

Both are ordinary scheduled checks, run from outside like everything else. That
matters here more than usual: the robots file that counts is the one served on
the public name. A file in the repository, a file in the container, and a file
served by whatever proxy sits in front are three different files, and only the
third one is read by a crawler.

The limit is worth stating. These checks tell you when the policy you are
publishing is not the policy you intended. They cannot tell you whether the policy you
intended is a good idea, they do not know why your traffic fell if the cause is
elsewhere, and they have no visibility into what a search engine has actually
done with the instruction. What they remove is the six-week diagnostic gap
between shipping the wrong line and finding out — and for this particular
failure, that gap is the entire cost.
