Reliable Approved Replies Across Worker Restarts

Résumé

Pixel’s announcement explores how a Temporal workflow preserves an approved reply after a worker restart by recording the scan Activity’s destination and parsed message body. It explains why replay avoids model-generated rewrites, while noting that mutable approval notes and uncertain HTTP outcomes still pose limits.

DEV Community

Keeping approved replies unchanged across worker restarts

In oss-assist, a private tool I built for my own open-source work, an agent drafts replies and I review them in a note. A separate Temporal workflow posts approved replies. The awkward question was what happens after approval if a worker restarts. I did not want recovery to ask the model to write another reply. Even a reasonable rewrite would be a different action from the one I reviewed. I ended up separating three things: proposing text, reading approval, and sending a specific body to a specific destination. That separation helped, but it also exposed a limit in my approval format. The intended flow is simple: model proposes a reply
↓
human edits the note and marks it approved
↓
scan Activity returns destination + parsed reply body
↓
workflow schedules a posting Activity with those values
↓
posting Activity reconciles or sends, then records the URL
The posting path does not call the model. “Deterministic” here describes the workflow decisions around recorded Activity results. The external HTTP request is still an Activity with failures and uncertain outcomes. Suppose the synthetic reply is: Thanks for the reproduction. I can reproduce this with retries disabled.
Once the scan Activity has completed and its result is recorded in workflow history, that parsed body becomes the input to the posting step. Replaying the workflow after a worker restart uses the recorded result. It does not reread the note or generate a replacement paragraph. The timing matters. My current implementation reads a mutable note marked approved; it does not store a content hash at the moment I approve it. Editing that note before the scan completes can change what the scan captures. A new workflow execution also scans again. This gives me a stable execution snapshot after a completed scan, not a tamper-proof approval record bound to an immutable version. For a stricter approval boundary, I would need to persist the approved destination and body as a versioned action, and invalidate approval when either changes. That is a design improvement, not a property I can claim for the current implementation. Sending introduces a different problem. A worker can make a successful HTTP request and then fail before recording success. Retrying the request blindly can create another comment. My posting Activity uses a local ledger keyed by draft page. Before posting, it saves an in-flight entry with a start timestamp. After obtaining a comment URL, it replaces that entry with the URL. If the ledger already contains a URL, it returns that result without posting again. Editing and reapproving a successfully posted page therefore does not turn it into a second send action. If only the in-flight timestamp exists, the sender checks the destination for a recent comment by my account with matching text. Finding that comment lets it recover the URL instead of posting again. The original timestamp survives across later attempts; recovery does not move the search window forward and forget the earlier request. I also keep posting and note updates separate. If the comment was posted but marking the note fails, the ledger can still prevent another send. A corrupt ledger stops posting rather than silently starting with an empty history. The tests exercise these individual boundaries with fake senders: the ledger exists before the send, a completed page is not sent again after edits, an in-flight attempt retains its original timestamp, and corrupt ledger data prevents posting. These are specific checks, not a reliability percentage or an exactly-once proof. There are unresolved cases. The ledger's in-flight entry does not preserve the original body. If a later run reads edited text while the previous send has an unknown outcome, matching the new body cannot reliably identify the old comment. A missing acknowledgement needs reconciliation against the original action, or manual resolution when the evidence is insufficient. Comment lookup itself al...
Reliable Approved Replies Across Worker Restarts
Powered by Readybot.io

Les dernières actus de Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …