Agent Harness Tutorial · End to end · Zoom level 3
How we take care of it: freshness
freshness catches an irreversible write against a stale row.
How we took care of it.
- Before an irreversible write, a row read more than 30 seconds ago is read again.
- The write then goes against what is true now.
| It reads | when each row was last read |
| Kind | rule |
| Provided by | harness |
| If it fails | re-read the row first |
| Where in the code | H loop/freshness.py |
| Runs at | 4 · Before the tool |
Real exampleGap F-126: rows seen only inside a list are missed (flow 11).
More on this: What goes in.
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
async def refreshed(planned: list[tuple[ToolCall, IdempotencyKey]], run: Run) -> bool:
"""`refresh`, put into the run's transcript; whether anything was re-read."""
held = await refresh(
planned,
fresh=run.fresh,
registry=run.registry,
tools=run.tools,
identity=run.identity,
run_id=run.run_id,
iteration=len(run.trace.tool_calls),
now=run.now(),
span=run.span,
)
run.messages.extend(held.messages)
run.seen_results.extend(held.results)
return bool(held.messages)