Back to Field Notes
Log

October 25: lanes that failed while the run said success, and a test server someone else answered

Scheduled agents reported success while one lane in three failed, because the model was never shown the shape of the answer it owed. And a day of chasing flaky tests to their causes, one of them a test server whose port another test took.

Covers
Written
Repositories
infinary.io, kremio-connect, Orca-strator
Pull requests
8
Reading time
7 min
#agents#output-contracts#flaky-tests#testing#releases#mcp
Contents

Ten pull requests merged across three repositories, two of them Field Notes. Of the other eight, two are worth telling: scheduled agents that looked healthy while part of each run was thrown away, and the flaky tests in Orca’s backend, each traced to a cause rather than retried until green.

PRs merged, besides Field Notes
8
lanes failing in "successful" runs
1 of 3
flaky test loops, before and after
4 of 20 → 0 of 70
catalog agents bumped for memory tools
18

Lanes that failed while the run said success

A scheduled catalog agent runs as several lanes, and each lane’s answer is checked against an output contract: a JSON Schema plus a few assertions, such as “every figure needs a lower bound” or “every section must cite the documents it used”. On the hosted runner, the portal was showing “1 of 3 lanes failed” for several agents, and “2 of 3” for Cash Forecaster, while each run reported success. We read 36 hours of the runner’s logs and sorted the failures (Orca-strator PR #85).

The fix tells the model what it’s checked against, and relaxes none of the checks:

  • A lane’s system prompt now carries its agent’s JSON Schema and the rule that the final message is one JSON object. “Finish by reporting X” is to be read as “put X in the matching field”.
  • A lane with tools is told its turn cap: ask for independent reads in the same turn, don’t repeat a failed call, and when the turns run out, answer with what was read and report the rest as unknown. Three lanes had been running out of turns one read at a time, and threw away everything they’d found.
  • A correct JSON object inside a line of prose or a code fence is read as that object. Text with no object in it still fails.

One caveat from the PR itself: the runner doesn’t log lane output, so what the model actually returned is inferred from which check fired, not seen. The change asks only for what the contract already checks, so it’s safe either way. Orca’s backend suite passed with it, 6071 tests.

The hosted runner moved to agent-runner v0.1.18, which carries this fix, the same evening. Its first scheduled run still had one lane run out of turns, for a reason this PR doesn’t touch. We’ll write that up when it’s fixed.

Flaky tests, fixed at their causes

Orca’s backend suite had a handful of tests that failed now and then under a parallel run. Orca-strator PR #92 changes no product code. Each flake was reproduced first, then fixed, then run again many times. Three of the causes:

The test server now binds its own socket, writes the port it got to a file, and serves on that socket, so there’s no gap to lose it in. Before the fix, 4 of 20 loops of the MCP test files failed. After it, 0 of 70.

  • Two tests sharing a run. Two test harnesses named their run run_{id(self):x}, and that run id is also the checkpoint thread. Python reuses a freed object’s address, and a gated run’s checkpoints stay in the store’s database, so a later test could resume an earlier test’s run. With a constant id, exactly the two failing tests fail every time. They now use random ids: 4 failures in 96 concurrent runs before, none in 96 after.
  • Keys left behind. Some tests set provider API keys in the process environment and never removed them. With an Anthropic key present, the economy tier picks anthropic/claude-haiku-5-5, which the pricing map bundled with litellm 1.105.1 doesn’t price, so a pricing stress test failed whenever it ran after them. It failed the same way for anyone with a key in their shell. A fixture now removes every provider key before each test and restores the whole environment after it.

One flake we couldn’t make fail on purpose: a test that slept 50 milliseconds and hoped a task had saved its state. We fixed that one from reading the code, and the PR says so. It and five tests like it now wait for the save itself. After the fix, three full runs back to back passed 6014 tests each.

Also

  • One site ahead of the fleet. Every box converges on one approved fleet image, so there was no way to try a new image on our own site, erp.infinary.io, without offering it to every other box at its next update window. The control plane now has a staff-only, audited override that puts one instance on a newer image (infinary.io PR #306). We chose it over the other way round, holding every other box back, because a hold is a write on every box, including ones provisioned in the meantime, and one missed box takes the release early without anyone noticing. The override is one write on one box. It may only point at a catalogued image of the same major version that is newer, and it stops having any effect once the fleet catches up, so a forgotten override can’t hold a box back. Merged, and deployed to the control plane the same evening.
  • Method tools in Kremio Connect, off by default. Frappe 16.53.0 ships its own MCP server, which we keep switched off. Kremio Connect PR #38 adds the tools it had and we lacked: finding, describing and calling whitelisted methods, run as the signed-in user, under Kremio’s own switches, tool rules and Action Log. They’re off unless an admin turns them on, the two call tools also need commit tools switched on, and only Desk users get them. They’re adapted from Frappe’s own MCP tools (MIT). An independent review of the first commit found five ways around the guards, and the second commit closed all five, with tests, before merge. Merged without a release: Kremio Connect stays 0.9.1. Its CI first failed on Frappe’s limit on new users an hour, which the test suite’s user creation hit; test sites now raise it.
  • A test that broke on every upgrade. The golden image’s tests baked the live list of app versions, but checked values written for one release. So any upstream version bump failed six tests, and the job stopped before the tests after them ran. They now bake a frozen copy, and one new test checks that the live list still bakes (infinary.io PR #322). It came up while preparing the next upstream release, Frappe 16.53.0 with ERPNext 16.52.1. That release window started on our own site the same evening and isn’t finished.
  • A footer stuck in June. The portal footer said “Portal v0.9.0”, a constant someone had to bump by hand. It will show the platform release the fleet runs, with the portal’s build commit on hover (infinary.io PR #309). Merged; the portal itself hasn’t been redeployed with it yet.
  • 18 agents bumped for their memory tools. Catalog agents gained the Agent Memory tools in an earlier PR (#292), but no versions changed, and versions can’t be overwritten on the hub, so publishing would have skipped them all. Each now has a minor version bump, and the site’s agent pages list what each one reads in your team’s shared notes, derived from the allowlists rather than typed by hand (infinary.io PR #304). The site is live with it; publishing the new versions is a separate step, still to come.
  • Docs: which model answers an Aria turn. The person’s own pick comes first, then the site’s model, and the site’s candidate list only fills in behind them (infinary.io PR #303).