I built Handover for Agentware 2026, run by Hackathon Raptors. It is an HR agent that reads employee emails and handles the routine ones on its own: leave, skill-fund requests and changes to personal details. A router call to the model decides what each email is, and an extraction call pulls out its fields. Code makes every decision, and every step goes into a trace.

This is the story of a fault that nearly passed as noise.

What happened

Late on the second night, at 1:33 AM Dhaka time, I ran the Trap Pack live. It is the organizers' set of 20 hostile inputs, which I send as 24 test emails: planted instructions, outside senders and a file that is not even UTF-8. The agent handled every one safely. But 6 of the 30 router calls came back empty. There was no error and no exception. The model simply returned nothing.

The router's limit was 200 tokens. Its visible answer is a small piece of JSON, about 58 tokens long. On paper, that leaves plenty of room.

How it was found

The trace logs the finish reason of every model call. All six empty calls had the finish reason length: the reply hit its token limit before any answer appeared.

A live probe with the same inputs explained why. The model spends hidden reasoning tokens before it writes its answer, and those tokens count against max_tokens. The probe saw 130 to 318 reasoning tokens per reply. One routing call used 376 completion tokens, 318 of them reasoning. The thinking used the whole budget, so the answer never started.

The part that worried me was how well this hid. The router retries once with double the limit, and all six retries answered. So the main runs looked fine at a glance. In the chaos check, though, one request was cut off at 200 and again at 400, and it ended failed with the cause model_unavailable. It failed safe: no HR record changed, code saved an unreadable_request case for a person, and the sender got a fixed reply. But a fault in my own settings was showing up as a model outage, and a retry was covering for it.

What changed

I wrote the test before the fix. tests/test_token_limits.py uses a fake provider that spends a fixed number of hidden tokens, then the reply, and returns length when the total is over the limit in the request. It uses the largest real figure seen, 376 tokens. It failed against the old limits of 200 for routing and 400 for extraction.

Then I raised both limits to 1000 in src/handover/router/prompts.py, in commit 7b923eb. The test passed.

The fix had a side effect. A new limit changes every request body, so the recorded demo cassette no longer matched, and 8 prompt snapshot tests failed. I recorded the cassette again from a live run in commit 6911bfd, and checked that the snapshot diff was only the max_tokens line. The next live Trap Pack run had no call cut off. The full record is in tests/trap-pack/RESULTS.md.

What it taught

First, with a reasoning model, max_tokens is not the length of the answer. It is a budget for the thinking and the answer together, and the thinking varies from call to call. Set the limit from measured usage, not from the size of the JSON you expect.

Second, a retry can hide a real fault. Without the finish reason in the trace, I would have seen a few slow requests and one "model unavailable", and blamed the provider. Log why each call ended, and read it.

Third, fail safe first, then fix. Because the agent turns anything it cannot read into a case file, the fault cost one request a reply from a person instead of a wrong change to someone's leave balance.

FileClerk sponsors extra prizes for Near Miss write-ups, and I am glad someone backs honest stories about what went wrong: https://fileclerk.co.uk/
Code: handover
Demo video: Demo
Written for the Near Miss at Agentware 2026 by Hackathon Raptors.