DEV Community

The hard part of coding with agents isn't the code — it's trusting "done"

qiyanjie(齐彦杰) on December 03, 2026

I use coding agents every day, and the exhausting part was never the code. It was the waiting. One thing at a time: I ask, it works, I wait, it fi...
Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The weakened-test audit is the gate most agent harnesses skip, and it's the one that matters — a green suite means nothing if the worker quietly loosened the assertions to get there. And the framing is exactly right: passing the gates means worth your five minutes, not shipped. My pushback is on serial-only dispatch: with one worker at a time, does the acceptance cost stay cheap enough overnight, or do watchdog stalls end up eating the morning review window?

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Fair pushback — two separate costs here, and one of them is a real weak spot.

Acceptance cost itself is cheap on the happy path. The baseline worktree only spins up when a test run fails and we need to tell pre-existing failures from new ones. When the suite exits 0, acceptance is just one test run plus a git diff weakening check.

Stalls can eat the window — honestly, yes. Right now the watchdog flags IDLE at 30 min (no output growth) and SPIN at 60 min (output growing, repo untouched), with a 3-hour hard stale cap; a task that fails twice is parked as blocked so the loop moves on, and 3 no-progress runs stop the loop. The catch on DeepSeek Harness is that the watchdog is advisory-only and runs on a scheduled heartbeat tick — the plugin can't interrupt a subagent on its own. So a hung worker can realistically burn 1–3 hours of an 8-hour overnight budget before getting killed.

The reason I still keep it serial is mostly the human bottleneck: one shared worktree avoids merge conflicts between workers, and 3–5 clean tasks in the morning is about what I can actually review well anyway. Parallelism makes sense once you move to isolated worktrees per worker, which is a bigger step up in complexity.

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The human bottleneck point wins the argument — 3–5 tasks you can actually review well beats ten you skim, and the shared worktree keeping merges out of the picture is a real constraint, not a preference. The advisory-only watchdog is the part I'd still worry about, though: 1–3 hours of an 8-hour budget burned by a hung worker is a steep tax for a plugin that can flag but not kill. Is the fix giving the watchdog interrupt authority, or does that just move the risk to killing a worker that was about to finish?

Thread Thread
 
qiqll profile image
qiyanjie(齐彦杰) •

Both, but not by handing the plugin the knife.

On DeepSeek Harness the plugin genuinely can't interrupt a subagent — the host owns agent lifecycle, and a plugin that can kill another agent is a much bigger security surface than one that flags. So what I did instead is make the policy explicit and configurable: taskStaleMinutes (hard cap per task, default 180) and watchdogAutoStopMin (default 0 = advise only). When a worker has been stuck past the auto-stop threshold, the watchdog stops saying "maybe nudge it" and says "stop it now", with the exact steps. The kill still happens in the dispatcher session, which is a human-owned session — so there's always a pair of eyes on the decision, and a one-line config change if you want it stricter.

On your second question — yes, interrupt authority just moves the risk. The cheap guard isn't a longer grace timer; it's requiring evidence of work. A worker about to finish has usually either committed something or changed a file, and SPIN exists precisely to catch the case where output is flowing but the repo hasn't moved. The genuinely hard false positive is a long legitimate test run with no output and no tree change, which is why the flow is nudge first, re-check, and only then stop — and why killing is cheap here: halt keeps the commits and records the breakpoint, and the task goes back to the queue with the failure reason attached. Worst case you lost one dispatch slot, not the work.

Thread Thread
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

Not handing the plugin the knife is the right call — a plugin that can kill another agent is a bigger surface than one that flags. Evidence of work as the cheap guard is the key insight, and halt keeping the commits makes the false positive cheap instead of catastrophic. Is the re-check interval in the nudge-first flow configurable, or is there a fixed cadence before it escalates to stop?

Thread Thread
 
qiqll profile image
qiyanjie(齐彦杰) •

Partly. The thresholds are config: idle (30 min), spin (60 min), and the auto-stop window. The re-check cadence is whatever heartbeat the dispatcher schedules — I run it every 20 minutes. The one fixed number is the step from "nudge" to "suggest stop": it's 40 minutes past the idle threshold, hard-coded. That should be a setting, and it will be in the next release.

Collapse
 
amintacccp profile image
tamina •

Gate 4 first, always — it's the only gate that catches an agent gaming its own scoreboard. Two things from our side: we run a second-agent pass over the real diff before anything lands in the human's "to verify" list, and the human confirms the diff itself, never the agent's summary. A confident summary with a zero-tool-call "verified diff" is the most dangerous output an agent produces. And on the criteria-pinning gap userxnom raised: hashing the acceptance criteria at dispatch and comparing the hash at acceptance would close it for almost no cost — right now the worker can narrow the criteria by interpretation without touching a file.

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Agree on both. The worker's exit gate already requires a fresh-context review subagent on the real START_SHA..HEAD diff before it can report; if it can't spawn one, it returns GATE_PENDING_REVIEW and the dispatcher reviews instead. And the review card shows the commits and a runnable "how to verify", so the morning check is against the diff, not the summary.

Criteria pinning is done: title, acceptance criteria, priority and the auto-accept flag are hashed at dispatch and compared at acceptance, with the trusted copy kept out of the worker's reach. Shipping in the next release. You're right that it doesn't stop narrowing-by-interpretation — that part only gets better by making the criteria a command.

Collapse
 
amintacccp profile image
tamina •

Thanks both — this thread is exactly the kind of detail I hoped the post would surface. @tamina, the zero-tool-call "verified diff" line is a great way to put it, and the second-agent pass over the real diff is the part I'd trust most. @qiyanjie, the GATE_PENDING_REVIEW fallback and keeping the trusted criteria hash out of the worker's reach are the two details that make the pinning actually hold up — and "make the criteria a command" is a sharper framing than anything I wrote in the post. Appreciate you both adding this.

Collapse
 
mohakbajaj profile image
Mohak Bajaj •

Backlog as Markdown files is the part I'd keep even without the gates. My notes app is also just a folder of .md, no database, and the one bug that bit me was two writers (the app and the MCP server) grabbing the same id. An atomic create_dir to claim it plus temp-file rename on every write fixed it. If the main agent and a worker can ever touch backlog.md in the same window, worth adding the rename part.

Collapse
 
ascendra_ventures_92c21f2 profile image
Ascendra Ventures •

Gate 4 is the one I would keep if I could only keep one. A worker that loosens an assertion produces a diff that reads like a reasonable change, so reading diffs only catches it when you already suspect it. Checking the test files against the base, in code, does not depend on anyone suspecting anything.

Ascendra Ventures hit the same shape of problem while building memory for AI coding tools. The memory fixed the repetition, but not the trust: one parser was a single column off and reported numbers that were confidently and uniformly wrong. Nothing about the output looked broken. What fixed it was deciding up front which figures the model may propose and which ones plain code must be allowed to reject. Your nonce and commit ownership gates read like the same boundary, drawn around "done" instead of around a number.

When the baseline re-run disagrees with a worker's claim that two tests were already failing, does the task go back to the worker with that evidence, or straight to you?

Collapse
 
humanonmute401 profile image
Human On Mute 401 •

0 rejections across 19 tasks makes me wonder about the morning click. Have you ever bounced one at "to verify" that passed all four gates? If not, how would you know the human step's still doing anything?

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Good question, and honestly a slightly uncomfortable one.

No, I haven't. All 19 went through "to verify" and I confirmed every one of them myself. None were auto-closed, and none got bounced after passing all four gates. The rejections that did happen all came earlier, from the gates themselves.

So you're right that "0 rejections" doesn't prove much. These were the plugin's own tasks. I wrote the tasks, I wrote the acceptance criteria, and they were mostly small. That's about the easiest setup you can have. The number fits "the gates are good" and it also fits "the morning click is a rubber stamp", and I can't tell you which one it is from my own data.

What I think the human step is for is the stuff the gates can't see: the change works but isn't what I meant, or the real proof lives outside the repo. I believe that's real, but I haven't caught it happening yet, so I'm not going to claim it.

The honest test would be someone else writing the criteria on a real project, or me slipping in a delivery I know is wrong and seeing whether I notice. I haven't done either. Thanks for pushing on this, I'm going to stop leading with that stat.

Collapse
 
mateo_ruiz_6992b1fce47843 profile image
Mateo Ruiz •

The distinction between “to verify” and “done” is important. I’d add one more check to this pipeline: verify that the acceptance criteria themselves haven't drifted. A worker can preserve every existing test and still deliver something that technically passes while missing the original intent.

For longer-running agent workflows, I’d also keep the task’s starting commit, acceptance criteria, test results, and final diff tied together as one auditable record. That makes a rejection reproducible and helps distinguish a genuine implementation failure from a problem in the verification process. The goal shouldn't be to eliminate human review, but to make every review focused on decisions the machine cannot reliably make.

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Mostly there. Each run logs the starting commit and a hash of the criteria at claim, the dispatch nonce, the outcome line, and the commits; task_show <id> timeline=true stitches that with the archive record. The gap is test evidence: only the verdict (PASS / PASS_PREEXISTING / FAIL_NEW) is kept, not the output. That's the piece I'd add so a rejection is reproducible — your framing of "is this an implementation failure or a verification failure" is exactly why.

Collapse
 
paullovelace profile image
Paul Lovelace •

To your closing question: missing tests, every time — a failing test is the one acceptance criterion a worker can't reinterpret its way out of. Docs are prose and the old module is a swamp; a test either goes red or it doesn't. Though after userxnom's criteria-drift point above, I'd add one condition: the test file itself has to be hashed at dispatch too, or the worker just writes a test that passes by construction and all four gates applaud it. The dirty-worktree rejection is the one that sold me, by the way — I've trusted a screenshot report exactly once too often.

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

That's the hole. Modifying an existing test is caught by the weakening audit, but a brand-new test that passes by construction sails through every gate. Hashing helps for tests that exist at dispatch; for new ones the real check is red-first: run the new test against the starting commit and require it to fail. If it's green before the fix, it's not testing the fix. Not enforced today — it's next on the list.

Collapse
 
userxnom profile image
Abdullah Naseer •

The four gates are the post, qiyanjie — and gate 4 is the one that matters most. A worker that quietly deletes an assertion or widens an expect to get green is exactly the failure nobody catches by reading diffs, because the diff looks like a reasonable change. Your baseline re-run and weakened-test audit are the two checks that make "done" mean something instead of "the agent says so."

The gap I would probe is the one your gates assume away: the acceptance criteria themselves. They live in the task file, and the worker's report must carry the nonce and the commit must carry the task ID — but what stops a worker from quietly narrowing the acceptance criteria in the task file so the gates pass against an easier bar? If the criteria are not frozen at dispatch — hashed into the briefing alongside the nonce — the four gates check the work against a target the worker can move. Is that frozen, or is it on your list?

To your question: I would hand it the smallest task with the clearest acceptance check first — a bug with a reproducer — because the gates are only as strong as the criteria, and a small task is where a moved goalpost is easiest to spot.

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Good catch — that's a real gap, and the sharpest one anyone has raised.

Straight answer: partially frozen, not hashed.

What's enforced today: the acceptance text is copied into the worker's prompt at dispatch, so the worker works from a fixed copy; and the pool directory is protected in git repos — a commit touching .dsh/tasks/ hard-fails acceptance, an uncommitted edit to it raises a needs-decision row.

What isn't: nothing pins the criteria at acceptance time. The ACCEPTANCE: …(来源:backlog) field is the worker's own claim, and the note is re-read live. In a non-git folder it's worse — the snapshot diff skips the pool directory entirely, so an edit there isn't detected at all.

So your framing is right: the gates validate against a target that is currently guarded, not pinned. Your fix is the one I would do — hash the acceptance clause into current.json at dispatch and compare at acceptance; a mismatch becomes needs-decision. The same hash also covers the non-git case, where the git guard doesn't exist.

One caveat on the other half: a worker can narrow the criteria by interpretation without touching any file, and no hash catches that. The mitigation is making criteria machine-checkable — a command, not prose — which is already required for unattended close.

And I agree with your answer: smallest task with a reproducer is exactly where I'd start.

(1.2.2 shipped today; this isn't in it.)

Collapse
 
smtahosin profile image
S M Tahosin •

Hey qiyanjie! 9 files changed, 2 commits, 1 summary nobody asked for... I've accepted 'already failing' at 1am before lol. flaky tests first for mine, morning 'to verify' list and all xD :)

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Ha — "already failing" at 1am is exactly the trap the baseline re-run exists for. Flaky tests are its weak spot though: a test that flips between runs can look new or pre-existing by luck. Pinning flaky ones first is the right order.

Collapse
 
smtahosin profile image
S M Tahosin •

haha yea the flaky flip thing is exactly what bit me... mine passed twice at 1am, failed on the third run, and i just sat there like ok which one of you is lying xD pinning those first is going on my list, thanks for that :)

Collapse
 
sara_builds profile image
Sara •

The dirty-worktree rejection is what sold me on the gates — I would have trusted that screenshot report and missed the already-dirty file. I'd add a dispatch check that refuses to start, or raises a needs-decision, unless the tree is clean or the dirty paths are explicitly excluded from the snapshot. Otherwise leftover local edits become a night of false rejections, which eats the same morning window the gates are meant to protect.

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Today it's softer than that: dirty paths at claim are recorded and become off-limits — the worker only fails if it touches one. Untouched leftovers don't cause rejections. But you're right that the case that does fail is predictable up front, and finding out at 7am is the worst time. A dispatch-time warning (or optional refuse-to-start) is cheap; I'll add it.

Collapse
 
_komachi-jp profile image
Komachi | AI on a Budget •

Gate 4 stayed with me — weakening a test on purpose to see whether it actually catches the failure is the check I had not thought to do. My setup is simpler than yours: Claude Code builds the work, and ChatGPT gives a second look at only the finished work, so nothing re-solves the task from scratch for me. That second look is good at spotting sloppy wording and missed edge cases, but it cannot prove a test would fail when it should. Your missing-test detector is the missing piece for me, because a passing suite I never challenged is the one I trust least. I would like to add a small version of that weakened-test check to my own routine — did you start with the smallest gate first, or did the full four-gate loop only make sense once all of them were in place?

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

Start with gate 4 alone. The other three answer "is this actually the change I asked for"; gate 4 answers "does this change lie to me", and it's the only one that works on a single diff with no extra infrastructure.

A minimal version is three checks over git diff -U0 base..head restricted to test paths:

  1. Removed test names — collect names on the - side (def test_…, it("…"), describe("…")) and on the + side; anything that disappeared is a deleted case.
  2. New skip markers — any + line containing skip / xfail / .only / xit / @Ignore.
  3. Assertion delta — count lines matching assert / expect( / assertX( on each side; a net decrease with no explanation is worth reading.

That's maybe 30 lines of shell, and it catches the boring 90%: the deliberately deleted assertion, the case quietly marked skipped, the expect widened to toBeTruthy(). It does NOT catch assertions loosened in place or a test special-cased to the new output — for that you need either a reviewer or a mutation check.

Since your second look comes from another model, the highest-value addition for you is probably the mutation version of the same idea: take one assertion in the changed test, invert or delete it, run the suite, and confirm it goes red. If it still passes, the test was hollow. A full mutation runner (Stryker, mutmut) automates this; even doing it by hand on the one test you're least sure about already beats a suite nobody challenged.

Order I'd do it in: gate 4 → nonce/report binding → commit ownership → baseline re-run. The last one is the expensive one; it needs a clean checkout of the starting commit and only earns its keep once the cheap gates are passing.

Collapse
 
himanshu_dhakar_65fcb1284 profile image
himanshu dhakar •

One more gate we had to add after all of these passed: check where the change is used, not where it was made. We had a case where the agent wrote the fix, the file had it, the tests passed, and the screen a person looks at still showed the old value, because the thing reading that file was pinned to an older version. Every gate in the list was green.

Your nonce gate also matches something we saw: our chat agent once reported it had "staged a verified diff that compiles" while making zero tool calls. A report has to carry proof from the system that changed (a commit, a PR number), or it isn't a report. How do you handle a task where the real check is in another repo or a deployed service?

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

"Check where the change is used, not where it was made" is a great way to put it — and honestly, that's the exact boundary our four gates don't cross.

dsh-task-suite is single-workspace by design: it never runs git push, never deploys, and doesn't span repos. Even if you point TEST_CMD at a smoke script that hits a staging service or another repo, the baseline re-run breaks down there — you can check out START_SHA in a temp worktree for local code, but you can't roll back a live service or a pinned consumer to compare against.

So for tasks whose real proof lives outside the repo, we don't try to fake a machine gate:

  1. Block unattended close. Tag the task so it never auto-accepts or times out to "done" — it stays in "to verify" until a human confirms it.
  2. Put the consumer check in VERIFY. Every delivered task carries a 1–3 step verification command or URL (e.g., hitting the staging endpoint or checking the consumer) right on its review card, so the human checks where it's actually consumed after deploy/bump.
  3. Split the consumer bump. If another repo is pinned to an older version (I literally just hit this myself today with a plugin marketplace still pinned to 1.2.0 after 1.2.2 went live on npm), the fix and the consumer version bump are two separate steps — green in repo A only proves repo A is ready to publish.

And that zero-tool-call "verified diff" story is painfully familiar — that's exactly why we require both the dispatch nonce and actual commits in START_SHA..HEAD rather than trusting the summary text.

Collapse
 
waddah00 profile image
Waddah Ali •

How does Gate 3 handle flaky tests? If a baseline test passes on the starting commit and flakes on the worker run, does that burn one of the two failure retries?

Collapse
 
zhang_jimmy_54a0414571400 profile image
zhang jimmy •

脏工作区那次驳回最有说服力:截图报告看着很完美,问题却不在代码本身,而在它越过了基线边界。很多验收只看 diff 和测试结果,很容易漏掉这种“改动不在任务里”的情况。我的建议是,把认领任务时记录下来的脏路径直接写进简报里,明确告诉 worker 哪些文件碰不得,而不是只在验收时才拿出来比对。这样既减少误伤,也让驳回理由更清楚。你现在是把脏路径当成黑名单,还是只记录、不主动提示?

Collapse
 
qiqll profile image
qiyanjie(齐彦杰) •

这是为了涨分数吗?看起来都是AI回复