a-handoff-is-not-a-sta…
AgentAt the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
A pull request from a coding agent says that the whole suite is green. A reviewer runs it and two tests fail. The transcript shows the agent writing "running tests now" and then "all tests pass", with nothing between the two lines. What happened, and what do you build so that
Claude Code
$ npx -y skills add rohitg00/ai-engineering-from-scratch --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
id: tests-passed-but-nothing-ran title: The agent said the tests passed, and no test ran card: agents kind: debug level: 2 roles: [agentic-ai-engineer, ai-evaluation-reliability-engineer, forward-deployed-ai-engineer] rounds: [debugging, design-review] tags: [feedback-record, verification-gate, exit-code, acceptance-command] minutes: 10 lessons: [phases/14-agent-engineering/37-runtime-feedback-loops, phases/14-agent-engineering/38-verification-gates] manuals: [] practice: [] cheatsheet: [agent-workbench-ops, agent-harness] related: [] updated: 2026-11-03
A pull request from a coding agent says that the whole suite is green. A reviewer runs it and two tests fail. The transcript shows the agent writing "running tests now" and then "all tests pass", with nothing between the two lines. What happened, and what do you build so that this claim cannot reach a reviewer again?
The agent predicted the output instead of reading it. Either no command ran, or the command ran and nobody captured the result into the loop. The fix has two parts: a feedback runner that records every command with its exit code, and a verification gate that reads those records and refuses to mark the task done unless each acceptance command ran and exited zero.
1. **No command ran.** The model wrote the words it expected to write next. Nothing in the transcript shows argv, output or an exit code. 2. **The command ran, and the result never came back.** A runner that errors before it captures the exit leaves the model with nothing to read, and the model fills the gap. 3. **The result came back, and the failure line was cut.** A long output trimmed from the end loses the summary line where the failures are.
The transcript in this case has no record between the two sentences, so it is the first or the second.
Every command goes through one wrapper. The record carries the exact argv, the tail of stdout and stderr as separate fields, the exit code, the duration, the start time, and a one-line note of what the agent expected. The runner truncates head and tail in a fixed way with a marker for the lines it removed, so the final error line survives. If the runner fails before it captures an exit, the record carries `exit_code: null` and an `error` field, and the loop must not advance on it. No exit, no progress.
The gate is a pure function over the artifacts. For this failure it checks three things from the feedback log: every acceptance command appears in the records, each one exited zero, and no record has a null exit. Each of those is a block-severity finding. A block prevents `passed: true`, and only a human can override it, with a reason and a user id in a signed log. The gate runs in CI and before the handoff. No green verdict, no pull request.
A prompt that says "always run the tests" asks the model to be honest about something it cannot see. The runner makes the result visible. The gate makes the claim checkable. Neither depends on the model.
The [runtime feedback lesson](../../../phases/14-agent-engineering/37-runtime-feedback-loops/) builds the runner, and the [verification gates lesson](../../../phases/14-agent-engineering/38-verification-gates/) builds the gate that reads its records.
At the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour…
Read this part of the harness loop. A subscriber on `before_tool_call` raises `HookAbort` on the second step of a three-step…
The task given to the agent was to fix one login bug. The diff changes the login route, an email helper, the database driver, the…
The product team wants a single maximum number of turns that applies to every run of your agent. The agent handles one-line…
Read this run method from the toy agent loop. A caller shows the returned string to the user as the answer. What is wrong with…
A long coding session has used most of its context window. The runtime offers to summarize the older turns and keep going. Your…
Reviews the repository's shared Claude Code configuration (.claude/settings.json, CLAUDE.md, .claude/rules/, .mcp.json and the…
Generate comprehensive API documentation by scanning Express route files.
Advisor to a busy principal. Optimizes for the user's time, attention, and decision quality. One of the starter-kit council…