DEV Community

Cover image for We repaired the model's numbers twice
RLM Labs
RLM Labs

Posted on Originally published at rlmlabs.ai

We repaired the model's numbers twice

Twice in four weeks I wrote code to correct the model's numbers for the model. Both times the correction hid the next failure. A repair is a confession the input was wrong, and I had stopped reading the confession.

On 1 August 2026 a user asked Merlin to look something up on the web. In session 52183a7b the planner wrote a four-task plan, with routing hints saying which task depended on which. The run died three strikes later without running a single search. The rejection:

E_SCHEMA_INVALID
validation failed (1): routing_hints index 4 out of range (tasks has 4 items)
hint: routing_hints[].index must be a valid index into the tasks array
Enter fullscreen mode Exit fullscreen mode

The planner had numbered its tasks in prose as 1 to 4 and reused those numbers in the hints. My hint was true and useless. The hint never said indexes start at zero. The model sent the same plan again, twice, and the loop detector closed the run:

LOOP_DETECTED: REPEATED_ERROR: Same error 'E_SCHEMA_INVALID' occurred 3 times
Enter fullscreen mode Exit fullscreen mode

I shipped two fixes the same day. The message now stated the convention and did the arithmetic. And a repair shifted a set of hints down by one whenever the set was invalid read as zero-based and a complete, valid plan read as one-based.

The next day I deleted the repair. A bare number does not say which base the writer used. The overrun was the safe case, because validation caught the overrun. The dangerous case was a one-based plan whose numbers happened to stay in range: every dependency attached to the neighbouring task, and nothing reported a thing. My repair fixed the case validation already caught and did nothing for the case nobody saw. Tasks now carry short keys, and hints name tasks by key. An unknown key fails by name, and the rejection lists the keys which exist.

The second repair lasted longer and did more damage.

On 28 July, in session abae6151, three planning rounds of about seven minutes each had died over a number my own gate computed:

"must use inspection_shard=1, not 0"
Enter fullscreen mode Exit fullscreen mode

The rule I wrote then: a gate rejects only over fields the model owns. A value the server computes gets stamped by the server, never bounced back for the model to copy. The rule was right. The stamp assumed position equals role: index 0 is governance, indexes 1 to N are inspection shards, then requirements and design.

On 25 August, run 10 (session 0ab18863) wrote a coherent plan with nine inspection shards when ten were required, and died after three byte-identical rejections. A diagnostic for exactly this case existed, written on 17 August after an earlier run died the same way: the plan declares 9 but 10 are required, do not renumber. The diagnostic never fired. The stamp ran first, branded the model's requirements task as shard 10, and the count matched. The model received complaints about tasks with nothing wrong in them and sent the same plan three times. The stamp had silenced the diagnostic every day since the diagnostic was written. I had built the diagnosis and parked the repair in front of the door.

The fix: a repair runs only when its premise holds. A plan with no shard numbers gets stamped, because there is nothing to disagree with. A plan whose count disagrees with the layout skips every repair and gets the diagnosis on the first rejection. Diagnostics are now tested through every repair, in the order production runs them.

The test: before a repair rewrites input, write down the premise the repair assumes and check the premise on the input. A repair run on input breaking its premise does not fail. The repair rewrites the input until the premise holds, and erases the evidence every later check needed.

Source: session 52183a7b from my logs, and Spec 008, AC-008-002-11 (superseded) and AC-008-002-14. Session abae6151 and run 10 from Spec 001, AC-FR005-09, and Spec 018, AC-018-009-16 and AC-018-010-13.

Top comments (0)