An editor approves an AI-written post in Telegram. Before the publishing worker picks it up, someone clicks Rewrite and the draft changes. If the approval is stored as approved = True on the draft, which text does the worker send? Settle that before you wire the model to a publishing API. You can test it with Python 3.12 and a few strings. No packages, model credentials, Telegram bot, or live publishing account are needed.
What did the editor see?
In my Content Factory, an idea becomes a preview in Telegram. The editor can approve the post or ask for a rewrite. Versions for other platforms get their own approval buttons. The project took about 1 week to develop, including setup and testing. With that review step in place, it took me about 5 minutes to go from idea to publication. That time includes my review, so it doesn't tell you how long a model call takes.
Take one preview to the design discussion and name the fields the editor thinks they're approving. In a text-only pilot those might be the body and destination. If the editor can change the image, link, or scheduled time, work out whether that change also needs approval. Put the destination beside the text in the preview. If the button only says "Publish" and the destination lives in a separate settings menu, the editor may approve something different from what the worker is about to do.
One question changes the implementation: if a draft changes after approval, may the worker still send the old version? A scheduled post can reasonably keep the approved snapshot unless the editor cancels it. For this pilot, a new revision invalidates the old approval. That keeps an outdated announcement from going out while someone is correcting it. Both approaches need versioned drafts; they differ in what the worker checks at send time.
I use an interview skill to help pin down decisions like this before a build. In my notes on what to discuss before building an AI workflow, I describe the skill and give an example of what you can bring to that interview.
Check the handoff before making a network call
Use a synthetic maintenance notice as the model output. The preview has a draft ID, a revision number, a destination, and a body. The example turns that snapshot into a SHA-256 digest. Treat the digest as a label for the snapshot: the approval stores that label, and the worker compares it with the snapshot it's about to use. The result is a decision string. There is no function in this script that sends a post.
Copy the block to approval_demo.py and run python3 approval_demo.py. The first decision should allow the unchanged snapshot in a dry run. The second should reject a rewrite even if the job carries an approval for the previous revision. The third keeps the body and revision unchanged but swaps the destination. The last checks that the worker cannot proceed without an approval.
from hashlib import sha256
from json import dumps
def snapshot_id(snapshot):
data = dumps(snapshot, sort_keys=True, separators=(",", ":"))
return sha256(data.encode("utf-8")).hexdigest()
def dry_run(snapshot, approved_id):
if approved_id is None:
return "BLOCK: no approval"
if snapshot_id(snapshot) != approved_id:
return "BLOCK: preview changed"
return "ALLOW (dry run): " + snapshot["destination"]
preview = {
"draft_id": "maintenance-7",
"revision": 1,
"destination": "status-test",
"body": "Maintenance starts at 18:00 UTC.",
}
approved_id = snapshot_id(preview) # Simulated editor approval.
rewrite = dict(preview, revision=2, body="Maintenance starts at 19:00 UTC.")
rerouted = dict(preview, destination="public-feed")
for draft, approval, expected in (
(preview, approved_id, "ALLOW (dry run): status-test"),
(rewrite, approved_id, "BLOCK: preview changed"),
(rerouted, approved_id, "BLOCK: preview changed"),
(preview, None, "BLOCK: no approval"),
):
result = dry_run(draft, approval)
assert result == expected, (result, expected)
print(result)
Try changing the time without bumping the revision, or bumping the revision without changing the body. Both should block. That catches two different mistakes: editing a snapshot in place and reusing an approval after an editor intentionally reopened the draft. The digest doesn't authenticate the editor. In a real worker, read the approval from trusted storage after checking who can approve that destination. A digest sent by the browser or generated by the model isn't a receipt.
Try the failures an editor will have to handle
The script checks equality. It cannot catch the race where your worker checks one snapshot, then reads the body again from a mutable draft just before sending. To test that in your own app, use a fake publisher that records its arguments. Pause the worker before it claims the job, save a new revision, then resume it. Expect zero calls. Use a conditional claim against the current revision and pass the immutable snapshot to the publisher. Agree on what happens if an edit arrives after the worker has claimed the job: once a request is in flight, your app may no longer be able to cancel it.
Put timeouts on generation and publishing separately. If generation times out, the editor should see a failed generation attempt; a late result must not overwrite a newer preview. If publishing times out, the destination may already have accepted the post. Exercise that case with a fake publisher that records the post and then raises a timeout. The expected state is "delivery unknown", with no immediate second send. Check whether the real API supports an idempotency key or lets you reconcile a send before retrying. If there's no safe way to tell, route the job to an editor instead of treating it as unsent.
There's also a trade-off for multi-platform publishing. One shared approval saves clicks when the text really is identical. If a platform requires its own copy or media, the editor needs to see that version before approving it. Record distinct outcomes per destination so a failure on one platform doesn't cause the worker to resend a post that already went out elsewhere. An approved snapshot can still contain a wrong date or a broken link; content checks and review remain separate from the worker's approval check.
For a first pilot, measure how long it takes to produce a preview and how much time the editor spends correcting it. Keep those separate from the wait in the review queue: a preview can be ready in seconds and sit untouched until morning. When you replace the fixture with model output, keep the same integration test for edits between approval and job claim. The source of the text has changed; the worker should still make zero calls for that stale job.
This article was created with the help of AI.



Top comments (0)