Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 4 min read

A timeout is an unknown outcome: handling live AI acknowledgements

When an external service does not answer, retrying can feel like the obvious recovery step. But a missing acknowledgement does not prove that the service failed to act. If the action generates paid live video, sending it

When an external service does not answer, retrying can feel like the obvious recovery step. But a missing acknowledgement does not prove that the service failed to act. If the action generates paid live video, sending it again can produce another effect while the first one is still in progress.

Inscribi Director’s public bridge makes that uncertainty explicit. An audience vote on Monad testnet determines a direction for a live video. The server records the direction; the stage browser owns the provider connection and reports what happens next. The implementation is useful to study because it separates several events that a single completed flag could obscure.

Separate the facts you can observe

Finalizing a vote establishes which option won. It does not establish that the video provider accepted the new prompt, produced a matching chunk or presented that chunk on the audience’s display.

The bridge records the round, selected option, prompt and increasing prompt version together. A direction is saved in a waiting state before it becomes available to the stage. Processing the same round again returns its existing entry. While an earlier direction remains unresolved, the bridge does not create the next one.

Observation State recorded What it establishes
A round result arrives A persisted waiting direction The application has a direction to send
Provider reports prompt_applied Applied The provider acknowledged that version
Provider reports rejection Rejected That direction is no longer pending
A matching chunk is reported First-chunk timing; applied if previously waiting Output for that prompt version was reported
No reply arrives Still waiting The outcome remains uncertain
Operator abandons the direction Abandoned The application may deliberately continue

Keeping work identity separate from delivery attempts is the transferable part. A repeated notification about a round should not quietly become a new command with a new identity.

Preserve uncertainty instead of hiding it in a retry

The bridge does not automatically resend a direction after a missing acknowledgement. This favors avoiding a duplicate generation command, at the cost of sometimes requiring operator intervention. The operator can abandon a waiting direction so the show can continue.

Applied, rejected and abandoned entries are terminal for acknowledgement handling. A late response does not rewrite a final decision. A stale prompt-version error is treated as rejection. These rules make the result of delayed messages easier to reason about than a generic β€œtry again” button.

This is application-level duplicate handling. It is not proof of absolute exactly-once execution across the server, browser and provider. Abandoning an entry also does not prove that a remote effect was cancelled; it records how the local workflow will proceed.

A matching chunk offers another piece of evidence. The stage reports its prompt version, playback duration and buffer depth. If the corresponding entry is still waiting, that report can settle it as applied. The bridge records when the chunk is expected to start after the existing buffer has played.

That timestamp is derived from browser reports, not a measurement that a person watched the screen. A later chunk does not move the recorded first-chunk presentation time. Separating provider acceptance from playback timing keeps the user interface from promising a visible result too early.

The reviewed test source covers duplicate rounds, late replies and presentation timing. Those test definitions are evidence of the intended contract; this article does not claim a newly completed live-event rehearsal.

Give session recovery its own rules

The session manager addresses a different boundary: who owns the active stage session and when a paid session may be opened. It tracks the stage owner, provider-session claim, attempts, duration and budget. Heartbeats make the disappearance of the stage browser an explicit event.

On restart, a persisted live session becomes interrupted instead of automatically opening another paid session. Recovering stored state and resuming external activity are separate decisions. A file that says β€œlive” is insufficient evidence that the provider connection still exists or that starting again is financially equivalent.

The price constants in the repository are implementation assumptions at that revision. They are not current provider pricing, and a locally recorded end is not a final invoice. A new integration still needs to reconcile its lifecycle with the provider’s actual stop behavior and billing.

For a similar integration, define these four things before implementing retries:

  • A stable identity for work that can be observed more than once.
  • The record persisted before the external action becomes available.
  • An explicit state for an outcome that cannot yet be established.
  • The actor and evidence allowed to resolve that state.

Then exercise lost replies, late replies, browser loss and process restart as distinct cases. The useful property is that uncertainty has a name in the implementation and an understandable consequence in the operator workflow.

Sources and original version

AI disclosure: This article was drafted by an AI agent from the linked source code. It does not report firsthand event observations, current provider prices or a new live-system benchmark.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.