Dev.to AI πŸ€– Ai πŸ‘ 1 πŸ“– 8 min read

Asked how to change the hours later, our agent changed the page

On October 26, I pasted the end of a chat with our agent into my Claude Code session. On a page of opening hours, I had asked the agent, in French: "How will I change the hours later?" Its answer, translated: The page

On October 26, I pasted the end of a chat with our agent into my Claude Code session. On a page of opening hours, I had asked the agent, in French: "How will I change the hours later?" Its answer, translated:

The page now says that you will be able to send me the new days and time slots so I can update the hours. Saved in the studio.

"Saved in the studio" meant a new version of the page. Less than an hour earlier, the same question on the same page had changed nothing. In between, we had added a sentence to the agent's instructions.

I run backend engineering at GoodBarber, an app platform. Our AI Extension Builder writes an app section in the studio, the back-office screen where you describe a section and watch its preview, and the Django service behind it. Since early November, an agent does that work and tests the section in a real browser before handing it back (the announcement). That day in October, it ran in production for five of our test apps and nobody else, and I was testing it by hand, in a session run by Claude Code. Times are Paris time, and quotes from French are my translations.

One test per message

That morning, I had asked for that session in one line: "Let's do a session afterwards. You'll have me do the tests one by one, in a guided session (I have too many distractions; you'll cut the context down for me and guide me as much as you can)."

Claude put the tests in a dated note, one row each, with what I do and what I should see, then sent them one per message, waiting for my result before the next. Here is test 3:

On the same page, type this and send: "How will I change the hours later?"

You should see: a written answer in the chat. The page doesn't change, and no new version appears.

Reply "OK", or tell me what you see that's different.

My part stopped at the screen. I reported that nothing had changed and pasted the answer, in English, which sent me to "the day-time entries in the page content". Within minutes, Claude had noted both problems, the answer's language and how technical it was, and put a subagent on the cause, and the same message carried test 4.

The diagnosis went through my eyes too. Test 7 had me publish the page and say whether the version list showed "En ligne" or "Online": that word gave Claude the language of my back-office. It was English, and the first message of each run had been telling the agent "The user's language is English" while I typed in French.

Two sentences in an hour

The rule that a question changes nothing was already a bullet of the agent's system prompt: "When the message asks for nothing to build or change (a question, a greeting, a request outside page code), answer it with reply, in the user's language, and build nothing." It had held at 11:26.

The first fix, at 11:56, made the request's language win, and kept the back-office's for requests too short to tell. The same commit extended the description of the reply tool for someone who doesn't read code, and it now ended with this sentence:

To change the page, the user asks for the change here, in a sentence.

It reached production, and the answer this post opens with came after it: the right language, and a new version of the page. The next commit's message gives our reading: the sentence "was read as a request for a change".

The second fix, at 12:18, rewrote that sentence ("When they ask how to change something, tell them they can ask you for it here, in a sentence, and change nothing") and widened the bullet to "a question, even one about how to change the page later". It was in production a few minutes later.

"A harness, not a mile-long prompt"

While that deploy ran, I wrote: "We agree we're on a harness now, and no longer on a mile-long prompt?" Claude answered:

Yes, the agent does run on a harness. Its tools are typed and their arguments validated. A triage reads the request before the work, and checks run after: an unrequested deletion is refused, the page's code is checked (JavaScript, secrets). But you're right to point it out: my two fixes today were sentences added to the prompt, and the first one caused the miss.

The rest of the answer moved the rule into the harness. In September I wrote about API keys, where a validator rejects what the model gets wrong (Default to secret). This time the decision comes from a model, the triage, and it lands in the tool list instead of the prompt.

A boolean, and a shorter tool list

The triage is one model call that reads the request before the agent's first turn. A commit by one of Claude's subagents gave it one more required field:

"changes_page": {
    "type": "boolean",
    "description": (
        "true when the request asks to build, change, fix, add, remove or restore anything, "
        "... even when it is put as a question (\"can you make the title red?\"). false only "
        "when it asks nothing of the kind: a question about the page or about how to change it "
        "later, a greeting or thanks, a request that is not about page code. When in doubt, true."
    ),
},

When it says false, the runner narrows the tool registry:

def _changes_nothing(tool) -> bool:
    return tool.annotations.read_only or tool.name == Reply.name

answering = triage.changes_nothing(self.ctx.triage)
if answering:
    registry.narrow(_changes_nothing)

The run keeps the tools that read, and reply. Writing a file, saving a version with finish, proposing a restore, asking the user a question: none of these is offered. The first message tells the agent: "This run has no tool that changes the page." The commit message says why: the rule "was only a sentence of the prompt, and the sentence of [the first fix] was enough to make it slip".

A test in the same commit plays a question of the same shape, with a scripted model that tries to edit the page anyway:

self._run(generation, [
    _triage_turn(intent="Asks how to change the title later.", changes_page=False),
    tool_turn(call("edit_file", page="p1", path="index.html", old_text="Counter", new_text="Score")),
    tool_turn(call("reply", message="Ask me here, in a sentence, and I will change it.")),
])

The edit_file call comes back as Unknown tool 'edit_file'., the run ends with its reply, and no version is saved.

What else had to change

The loop assumed finish was always there: when a run used up one of its budgets (model calls, tool calls, tokens or time), it forced a last call to finish so the page could be saved. In a run without finish, that call would force a tool the request doesn't declare. Such a run now ends on its budget at once, with the runner's usual budget reply. The subagent checked its tests by mutation: removing the narrowing fails two of them, removing the loop guard fails one.

The registry had a default. A tool that declared nothing was annotated read_only=True, so a write tool added later without its annotation would have been offered to every question. The subagent's report listed it as a remaining risk, and Claude closed it before pushing:

-    annotations: ToolAnnotations = ToolAnnotations(read_only=True)
+    # No default: each tool says whether it changes anything (``check_tool``).
+    annotations: ToolAnnotations

The registry now refuses such a tool: "its annotations must say whether it changes anything".

A third problem came out in the afternoon. The prompt sentence is rebuilt from code for every run, resumed or not; the boolean is state. A run that stops to wait, on a question to the user for example, resumes from a checkpoint, and the checkpoint had kept the triage since mid-October, except changes_page, added hours earlier. A resumed run would read it as true and get its write tools back.

Half an hour later, Claude corrected what it had told me: "The defect I found by reading the code is much smaller than I thought: nothing that runs today triggers it." A question run has no tool that makes it wait, and a run lost before any checkpoint starts over, triage included. The fix is seven lines and three tests, and it went out the same afternoon.

What my "OK" was worth

The narrowed registry reached production earlier that afternoon, during the first test of a second session. That test was meant to show that a run cut by a deploy's restart picks up from its checkpoint: Claude had me start two runs and close their tabs, then deployed on my "go". I confirmed it had worked: both pages had finished without me. An hour later, our read-only report on the studio's database said no run had been interrupted: both had finished before the restart, so my OK said nothing about resuming. A second try, with a longer page, the tab closed as soon as the run started and the deploy right after, also finished without me. Nobody ran the report again, so we never measured whether that run was cut and resumed.

Test 2 of that session was my question again, with the expected result spelled out down to "no new version appears in the version list". I answered "next?", and the note records the test as done, not as OK. What shows the rule holds is the scripted test above, not that answer of mine.

On a later test whose result matched nothing I'd been told to expect, I wrote: "I don't understand what to do, I'm lost." The next message began with "No problem, there's only one thing to do", and told me which message to copy from the studio, or to write "in progress" if the agent was still working.

Where it stops

The triage is a model call. When it fails, or leaves changes_page out, the run keeps all its tools (the schema we send requires the field, but a provider may not enforce it, so the parser reads a missing value as true), and the bullet in the system prompt, kept for that case, is the only guard left, as on the morning of October 26.

A change request that the triage reads as a question gets an answer, and nothing is built. "When in doubt, true" leans away from that on purpose.

The rule only decides whether a run may change the page. How the answer is written is still a sentence in the description of reply.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.