Skip to content

Build1 publisher3 min readPublished

A broken three-line duration parser illustrates the limits of prompt-only repairs

In a dev.to walkthrough, miruky uses one bad rstrip call to separate five layers of agent engineering. Which layer do you change when a repair passes all three examples and still accepts 1e3s?

The Engineer · Build desk

What happened

  • The broken baseline parser returns 250.0 for "250ms", 2.0 for "2m" and 5.0 for the invalid "5ss", because it strips the unit characters off the string and then calls float on what is left.
  • Python's rstrip treats its argument as a set of trailing characters to delete, converts nothing, and the string-methods documentation describes exactly that character-removal behavior.
  • miruky shows that a suffix-based repair can satisfy all three required examples while still accepting "-1s", "1e3s" and "2 m", none of which the article's contract allows.
  • The starting repair prompt requires seconds as a float, names 0.25, 1.5 and 120.0 as expected results, keeps the function name, and restricts the code to the Python standard library.
  • The August 2026 preprint Graph Engineering in the Era of LLM Agents works through prompt, context, harness and loop engineering before proposing graph engineering for tasks, agents and runtime state.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • constraint A grammar decides what counts as valid, and a grammar has to be enforced by code: three examples in an instruction cannot reject an input they never mention, so the rejection lands in tests or in the program around the model.
  • decision When a repair passes every example and still widens the accepted input, the next edit is a choice of layer, and another pass at the prompt is one option out of five.
  • exposure A model can report that tests passed when nothing ran, and a prompt can only ask; that claim stays unverified until the surrounding program runs the tests itself.
  • cost The three-line edit is the cheap part: specifying accepted input, executing tests, handling failed repairs and recording which source the reviewer approved is the bill, and it falls on whoever owns the pipeline.

`rstrip("ms")` removes trailing characters drawn from the set {m, s}. It strips characters and converts nothing, and Python's string methods document that behavior [2]. Most people calling it think they are calling something else. So "250ms" reaches `float()` as "250" and the code returns 250.0 where the intended value is 0.25, too large by a factor of 1,000 [3][4][19]. "2m" returns 2.0 against the 120.0 the repair prompt requires, low by a factor of 60 [3][10][20]. "5ss" returns 5.0, an input the article's grammar rejects [3][5].

The worked prompt pins the return type, three expected outcomes and a standard-library boundary, and it closes with a line aimed at the model: "Do not claim to have run tests unless a tool actually executed them" [10][11]. The contract sets the accepted number grammar: `[0-9]+(?:\.[0-9]+)?` followed immediately by `ms`, `s` or `m`, with surrounding whitespace ignored [5]. miruky keeps that policy in `CONTRACT.md` so later stages preserve it, and writes that a repair which changes what counts as a valid duration has changed the task [6]. OpenAI's prompting documentation, which the piece cites, recommends explicit requirements and evaluating behavior as prompts and model versions change [18].

"The practical distinction is what you change when the system fails," miruky wrote [14]. The stages in the piece differ along three axes: what the model is asked to do, what information it receives, and how the surrounding program handles its work [24]. Adding a fourth example changes the first. The second changes when the model is handed `CONTRACT.md` rather than a summary of it. The third changes when the program, not the model, decides what happens after a repair fails.

Five headings describe overlapping work. miruky writes that the responsibilities overlap and that one harness can own context selection, a repair loop and graph execution [15]. Anthropic describes its Managed Agents harness as the component that calls the model and routes tool calls [16]. LangGraph supports nodes containing either model calls or conventional code [17]. The article's graph section stays with an executable workflow graph, while the August 2026 preprint it draws on has a broader scope that includes task organization and agent coordination [23].

The contract here was chosen for the example, and miruky says another application's policy might differ [7]. Copy the tests only if your duration grammar is the same one. A service that accepts "2 m" or scientific notation needs its own grammar, and against that grammar the repair that passes in the article is the wrong repair. Whatever the contract, the failure question is the same. The text available breaks off as it turns from the prompt stage to the context layer [21].

What to watch

  • Whether the article's later stages judge repairs against the same CONTRACT.md grammar or relax it to make a repair pass.
  • Whether harness vendors pick up the preprint's graph-engineering vocabulary in their own documentation.
  • Whether repair loops start attaching the test runner's own output instead of the model's account of it.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories