DEV Community

Haley
Haley

Posted on

Half-Finished Is the Worst State: What Cancel Does to an AI Design Agent

I’ll admit it: I hate the moment an AI agent is mid-task and the user clicks Cancel. Most demos show the happy path—generate, review, approve. But my favorite failure is the one nobody rehearses: the user changes their mind halfway through, and the system has to stop without leaving a mess.

Imagine a free server running a small design agent. The brief says: create a new settings page, keep the old one intact until the new one is approved. The agent starts rewriting the theme tokens. At step three, I click Cancel. What should happen next? Four things: no partially written tokens, no orphaned files, a clear note that the old page is still the source of truth, and a way to retry from the same point.

The problem is that most AI workflows treat cancellation as an afterthought. They assume a task either succeeds or fails. But from a user's point of view, there is a third state that matters just as much: “I changed my mind.” Half-finished work is not finished, and a review screen that hides this state is asking for trouble in production.

I wanted a concrete way to see this, so I wrote a tiny interrupt probe for a free server. It has two parts: a state marker before the agent starts, and a check after the cancel returns.

# interrupt_probe.py
# Unexecuted sketch: check whether a canceled task leaves a recoverable state.
import hashlib
import json
from pathlib import Path

STATE_FILE = Path("state.json")
BEFORE = {"status": "authoring", "source_of_truth": "v1", "files": []}
AFTER_CANCEL = {"status": "canceled", "source_of_truth": "v1", "files": []}  # fill after run

def state_fingerprint(state):
    canonical = json.dumps(state, sort_keys=True).encode("utf-8")
    return hashlib.sha256(canonical).hexdigest()[:12]

print("Before:", state_fingerprint(BEFORE))
print("After :", state_fingerprint(AFTER_CANCEL))
print("Expected: identical, unless you intentionally recorded the cancel event.")
Enter fullscreen mode Exit fullscreen mode

The fingerprint is deliberately simple. It gives me a yes/no signal: did the canceled task leave the source of truth untouched? If the fingerprint changes, the probe tells me exactly which file or state key became inconsistent. That is the kind of evidence I want on a review screen before I approve another agent task.

Disclosure: This article was prepared as part of MonkeyCode's product outreach. The project's current free model access and free server option are convenient for this kind of probe. The operator says the free tier includes a 30M-token model trial and a free server; I treat that as an availability claim, not a benchmark or a permanent promise. I would not run production user data here. A free server is for rehearsal, not for real tenant traffic.

Here are five interrupt scenarios I would run before trusting the happy path:

Interrupt point What can go wrong Pass condition
User clicks Cancel during rewrite Theme tokens half-updated Fingerprint unchanged or only a cancel record added
User presses Undo after approval Old version cannot be restored Restore returns v1 fingerprint
Network drops mid-generation Partial file left behind Server keeps pre-run snapshot
Retry after cancel Duplicate task runs Retry finds same task id and resumes, not duplicates
Browser closes with pending approval Approval state lost Reviewer can reopen and see pending decision

A user flow matters too. The interrupt should not feel like a crash:

  1. User starts an edit.
  2. Agent writes draft changes.
  3. User clicks Cancel.
  4. Agent stops and replies: “Canceled. Source of truth restored.”
  5. Review panel shows no pending changes and offers a retry from step 1.

And the accessibility check is essential. A Cancel button that works visually is not enough. It must be reachable by keyboard. A screen reader must announce the canceled state. Focus must return to the control the user was on before the interrupt. If the free server cannot prove that behavior, I would not assume the production UI will magically gain it later.

There are real limitations. A free server's cancel behavior may differ from a production model under load. The model behind a free trial may stop more eagerly or not at all compared to the paid version. And a fingerprint check on a tiny JSON file does not catch semantic drift—the agent could rewrite a token with the same key but a different value in some edge case. So I treat this probe as a rehearsal, not a safety certificate.

Still, I would rather find a half-written state in a free sandbox than after a real user hits cancel. If you have a free server spot, don't burn it on another happy-path demo. Break it. Click cancel halfway through a rewrite, then see if the fingerprint survives. If it doesn't, you found the one thing your production review screen should show next.

Top comments (0)