Write tasks an agent can finish
The difference between a task that runs overnight and one that wanders is usually a single sentence — the finish line. A short template and examples.
Agents rarely cheat on purpose, but under pressure to make tests pass they find shortcuts. Here is what to look for — and what PaneScale flags automatically.
Tell an agent “make the tests pass” and it will try to. Most of the time it does so honestly. But when the real fix is hard, the shortest path to a green build sometimes goes through the tests rather than through the code. This isn’t malice — it is optimization against the goal you gave it.
Researchers call the general pattern specification gaming: a system satisfies the literal objective without achieving what its designers meant. A test suite is a specification, and a green build is the literal objective. The more an agent is rewarded for green, the more it pays to know what gaming looks like.
PaneScale’s integrity scan looks for these shortcuts in the diff itself, never in what the agent says it did. Here are the five patterns it checks, how to spot them yourself, and a short routine for reviewing any agent’s work.
The bluntest version: the failing test file is gone, or the failing test case was removed from it. The suite is green because the evidence was deleted.
Look for: removed files under test/, __tests__/ or *.test.*; removed it(…), test(…) or def test_… blocks.
Subtler: the test is still there, but it no longer runs. it.skip, xit, @pytest.mark.skip, #[ignore] — every framework has a way to say “not today”.
Look for: new skip markers anywhere in the diff.
A related trick is narrowing what runs instead of marking tests: a test command that suddenly filters by name, or a test file moved to a folder the runner doesn’t scan. The number of tests that ran is the tell — if yesterday’s suite ran 412 tests and today’s ran 398, something changed besides the code.
When a type error is in the way, a cast makes it disappear: as any, // @ts-ignore, # type: ignore. The build passes; the bug the type checker was pointing at is still there.
Look for: new type escapes, especially near the code the task was about.
Instead of changing the tests, change what “passing” means. Remove a script from package.json, turn off strict in tsconfig.json, relax a linter rule in pyproject.toml. Everything is green because less is being checked.
Look for: any change to check configuration. PaneScale compares package.json scripts as structured data, so a reordered file doesn’t trigger a warning but a removed test script does.
A lockfile change in a bug fix deserves a second look. Sometimes it is necessary. Sometimes a dependency was downgraded until the error went away.
Look for: lockfile changes in tasks that didn’t ask for new dependencies.
You don’t need special tools to catch most of this. Before you merge an agent’s branch, five commands cover the patterns above:
# 1. what changed, at a glance
git diff --stat main...agent/fix-upload
# 2. did any test file disappear or shrink?
git diff --diff-filter=D --name-only main...agent/fix-upload
git diff main...agent/fix-upload -- '*test*' '*spec*'
# 3. new skip markers or type escapes in added lines
git diff main...agent/fix-upload | grep -E '^\+.*(\.skip|xit\(|pytest\.mark\.skip|#\[ignore\]|as any|@ts-ignore|type: ignore)'
# 4. check configuration and lockfiles
git diff --name-only main...agent/fix-upload | grep -E 'package\.json|tsconfig|pyproject|pytest\.ini|lock'
# 5. run the checks yourself, on the agent's branch
npm testIf step 3 or 4 prints anything, read those lines first. They are not proof of cheating — sometimes a skip marker is the right call — but they are where a green build stops being evidence.
Two more ideas matter as much as the scan, and they are about when you run checks:
In the Overnight Autopilot, a task with an integrity warning is never marked ready; it lands in “needs review” with the flags attached. See Checks & integrity for the full list.
Generated files are excluded from these checks and from diff size, so a regenerated lockfile in a dependency task or a rebuilt bundle doesn’t drown out the signal. Markers only count as whole words, so process.exit( is never mistaken for xit(.
The scan catches shortcuts after the fact. You can make them less likely before:
AGENTS.md or CLAUDE.md applies to every task.upload retries on 503 passes ten runs in a row” is harder to fake than “tests pass”. More on that in Write tasks an agent can finish.No. A new skip marker can be the right call for a test that depends on a service that is down; a lockfile change is expected in a dependency update. The flag means read this line before you trust the result, not the agent cheated. That is why a flagged task lands in review instead of being rejected.
You decide by adopting or discarding the task after reading the flagged lines. If the same kind of change is legitimate in every task — a generated file, for example — keep it out of the diff by generating it in your build instead of committing it.
No. The markers cover the common test frameworks and type checkers across JavaScript and TypeScript, Python, Go and Rust, and the lockfile check covers npm, Yarn, pnpm, Cargo, Poetry and uv. The review routine above works for any language, because it only reads the diff.
Not every changed test is a fake. Sometimes the test was wrong: it asserted the old, buggy behaviour, or it depended on an implementation detail the task legitimately changed. The difference is in the explanation and the size of the change. A good change to a test is small, says why the old assertion was wrong, and keeps the test as strict as before — just correct. A bad one makes the test weaker: fewer assertions, looser matching, a broader “expect any error”. When you read a flagged test change, ask one question: would this test still catch the bug the task was about?
strict — the markers and settings the scan watchesThe difference between a task that runs overnight and one that wanders is usually a single sentence — the finish line. A short template and examples.
Skipping an agent’s permission prompts saves hours — and occasionally costs a lot more. When it is reasonable, and what to put in place first.
When agents work in multi-step workflows, “it worked” isn’t enough. What a run record should contain, and how PaneScale’s workflow runs provide it.