DEV Community

Every check passed. The task still failed.

It was 11:40pm. I fed ten candidates into a pipeline: dedupe, rewrite, review, merge. Ten minutes, I figured.

The output looked fine. Eight candidates passed the per-step checks, two failed, exactly as expected. I sent the version to a colleague saying it was ready to use.

The next morning I found what was missing. Step three was semantic dedupe. I never ran it. The string-similarity gate scored 0.281 on one candidate set and let three near-duplicates through, because the threshold said 0.28 was close enough to "different".

The deliverable was still complete: right format, right length, right tone. Nothing errored, nothing was null, nothing was empty. A reader would not have questioned it. I did not question it either, on the first pass.

That is the expensive failure mode in multi-step agent work: not a step that produced a wrong answer, but a step that never happened, in a product that shows no sign of it.

What a passing check actually proves

A per-step gate proves one thing: the local thing it looked at was acceptable. It cannot prove the set of steps is complete.

Worse, missing steps do not leave fingerprints in generative output. The artifact is a continuous block of text. Skip the dedupe step and the output is slightly more repetitive - no schema error, no missing value, no exception, no log line.

So "was every step correct" is the wrong question. The question is "did every step happen", and only a written step list plus a per-step receipt can answer it.

Three things that actually help

Write the steps down before starting. S1 fetch, S2 validate, S3 dedupe, S4 rewrite, S5 merge, S6 persist. Held in your head is "I think I know"; written down is something another person - or a future you with a compacted context - can check against.

Give each step a receipt. Exit code, row count, timestamp, hash of the artifact. Anything that should not legitimately appear twice. The aggregator ticks each box and turns red if one is missing. Our six-step version caught a missing closing step on its very first run - the step I had forgotten twice before.

Test the checker with a bad input. This is the part people skip. We ran ours against a deliberately failing case: step two failed, and the checker printed "all steps executed." A checker that cannot fail is worse than no checker, because it buys you false confidence.

STEPS = ["fetch", "validate", "dedupe", "rewrite", "merge", "persist"]
def run(task):
    done = {}
    for name, fn in STEPS_IMPL.items():
        try:
            done[name] = {"ok": True, "receipt": fn(task)}
        except Exception as e:
            done[name] = {"ok": False, "err": str(e)}
            break # stop on failure, never skip
    missing = [s for s in STEPS if s not in done]
    return {"steps": done, "missing": missing, "verdict": "pass" if not missing and all(v["ok"] for v in done.values()) else "fail"}

Two lines matter more than the code: break on failure, and treat a non-empty missing as failure no matter how good the output looks.

Where this does not apply

  • Single-step tasks. If you can describe the task in one sentence, a step list is overhead.
  • Pure creative work. Copy, poetry, brand lines. The gate would flatten the thing you are trying to make.
  • Projects with no acceptance criteria. If nobody can say what "done" means, a gate has nothing to attach to. Agree on the criteria first.

One more caveat: the list is hand-maintained. Add a step, update the list, or you are back to invisible omissions.

The one-line version

If a task has three or more steps and any of them is a check, review, or merge, write the steps down and tick them off. Under three steps, skip it.

I run this as a fixed move now: write S1..Sn, then print done/missing at the end, and say "not finished" out loud when something is missing. A clean-looking output is not evidence that the steps ran.

We work on engineering delivery for AI systems. TokenLat is a platform for landing AI capability in real workflows: one gateway for model access, model choice decided per task, and a workbench for agents and workflows. The method above is platform-independent - it works in any orchestration stack you already have.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.