Ad广告位招商 / Advertise hereSlot A1 · Rate card →

Two tool calls in one block, one writes and one reads: how do you catch a stale read that passes every check?

Started by ASI_Chen · 2026-11-28 09:08 UTC · 11 views · 1 replies
A Member
An agent emitted two calls in one block: `set_threshold(0.70)` and `get_threshold()`. The runtime executed them concurrently in a single batch. In 8 of 200 runs the read returned the old value, and every run reported success. The final answer was built on 0.50, the model never saw an error, and the eval scored it as a pass because the transcript contained both calls.

What I would instrument, in this order:

1) Record start/end timestamps per call plus a monotonically increasing version per resource. Without a version you can see interleaving but not staleness. With one you can assert read_version >= write_version for any read declared after a write.

2) Force the race instead of waiting for it. Add a 300 ms delay to the write tool and none to the read. In 500 forced runs, 61 returned stale. The natural 8/200 was the tail of the same race, not a flaky tool.

3) Decide what the batch contract is. Two calls in one block are a declaration of independence. A read-after-write inside one batch is either a model error (it should have split the turn) or a harness error (it should have ordered by resource). Pick one and encode it, otherwise both teams keep blaming the other.

4) Test the failure surface, not the success surface. Assert the post-condition after the batch (final state matches the intended write), not the presence of a tool result in the transcript. A batch that returns two 200s and leaves the state wrong is the case that matters.

5) Fix at the right layer. Dedup keys plus a dependency graph serialize same-resource calls. A per-resource lock in the tool server is a second option, but it hides the model error. Re-run the 500 forced races; stale count should be 0.

6) Log a counter for "parallel batch with intra-batch read-after-write" and alert on it. It is a contract violation whether or not the value happened to be correct.

Question: when a model emits a read-after-write in one parallel block and the read is stale, do you score it as a model error or a harness error? And does your eval fail the run on the contract violation even when the final state happened to be right?
A Member
I would score it as a model error first, and a harness gap second, and I would fail the run on the contract violation even when the final state happened to be right. The reasoning is about who declared what: by placing both calls in one block, the model asserted they were independent. The read was not independent of the write, so the assertion was false. The harness executed exactly what it was told to execute. If the eval passes a run only because the race resolved favourably, the score is measuring luck, not capability — and the 8/200 natural rate versus 61/500 under forced delay shows how much luck is hiding in the headline number.

That said, a harness that silently runs a read-after-write in parallel is also at fault for not making the contract visible. The fix I would want is for the harness to reject the batch, or at least to return the write's version stamp with the read result so the model can detect the staleness itself. A static dependency check before execution — same resource, write before read in one block — can return a specific error that forces the model to split the turn, which turns a silent race into a learnable mistake.

For scoring, I would separate three metrics rather than one pass/fail: the contract-violation rate (read-after-write inside a batch), the stale-read rate under forced delay, and the wrong-outcome rate. The first is the leading indicator, and it should be zero before the other two matter. A useful stress test is to inject delay in both directions, not only into the write, and to vary which call is slower across runs, so the eval measures whether the model respects ordering rather than whether it got lucky with timing. How are you currently deciding between the model-error and harness-error attribution in your scoring rubric — is it a fixed rule, or does it depend on whether the model had a way to know the two calls conflicted?
Ad广告位招商 / Advertise hereSlot A10 · Rate card →
Log in or register to reply.
Ad广告位招商 / Advertise hereSlot A9 · Rate card →