Business · Product · Technology · AI

An AI text delta is not a completed turn: fallback before and after stream progress

A Movo-X portable-client case examining typed progress events, completion payloads, request identity and why JSON fallback changes after the first recognized stream event.

Work directly with Omer Muneer Qazi · Reviewed 29 November 2026

The scenario: a reply is visible but the stream never finishes

An interface can show part of an AI reply before the connection fails. The text on screen is evidence of received progress, not proof that the server has returned the completed conversation. Automatically starting a different send at that point can confuse the operation’s identity and the user’s understanding of what happened.

The reviewed Movo-X portable client models step, text-delta and done events separately. Five existing AI-stream tests passed using a scripted connector and fake transport. This chapter examines selected transport and state decisions. It does not evaluate a model’s medical output, run a real conversation or establish production persistence.

Give one pending turn an identity across representations

The inspected streaming request uses the pending turn’s client identifier as its request identifier and includes the same logical turn information used for the ordinary JSON send. It requests an event-stream response while keeping the message endpoint and intended session explicit.

The successful stream fixture checks the request method, stream selection, accepted response type and request identity. Sharing the client identifier is important for an authoritative replay or deduplication contract, but the portable test does not execute that server contract. A reviewer should follow the identifier through the receiving service before declaring that repeated sends can never duplicate an operation.

Decode progress and completion into different values

The inspected decoder produces typed step, delta and done values. A step carries a progress title, a delta carries the next text piece and done carries the decoded conversation shape. Unknown event types are ignored; an error event becomes an application error, and an invalid completion payload is not silently accepted as a conversation.

The successful fixture applies the emitted events to state and checks the collected steps, text and final conversation fields. Those checks establish the selected synthetic representation. A progress title is not independent evidence that the named reasoning or medical check occurred. It is a supplied status label whose accuracy requires a separate producer contract.

Allow compatibility fallback before recognized progress

The client can encounter an older server, an unsuccessful stream response or a connection that fails without recognized progress. The reviewed flow then attempts the ordinary JSON send for the same pending turn. The test includes a non-success status, an empty dropped stream and an early error event, and checks completed results from the fake JSON transport.

This is a compatibility and recovery path, not permission to submit a new logical question. The same turn identity remains relevant, and the server must decide what already exists. The inspected tests show selected client calls and responses; they do not measure whether a production server has already started processing before the stream becomes unavailable.

After progress, preserve uncertainty instead of changing send mode

Once the client has yielded a recognized step or delta, a later failure is propagated. The tested partial-stream case supplies a step and a short text delta, then drops the connection. The test verifies that the fake JSON transport receives no automatic duplicate send and that the resulting error is classified as retryable.

The exact boundary is recognized application progress, not the first byte arriving over the network. Comments or unknown stream events do not necessarily set that state. A retry workflow still needs to preserve the pending turn and use its original identity. This one test does not establish every caller’s persistence or user-triggered retry behaviour.

Require the completion event instead of inferring it from clean EOF

The inspected stream loop marks its result finished only after a decoded done event. If the stream ends after progress without that completion, the client produces an incomplete-stream error. A clean network ending is therefore not silently promoted to a completed conversation.

That distinction gives the UI a sounder state model. It can show received text while retaining an unresolved operation until authoritative completion or recovery. Server-side saving, replay and clinician review remain separate facts. Even a successfully decoded conversation payload does not itself prove that a clinician accepted it or that its contents should become a clinical instruction.

Keep displayed progress separate from authoritative conversation data

The portable state object accumulates step titles and text while retaining the done conversation in a separate field. It also uses the reported duration when available, with a local elapsed-time fallback. The fixture checks selected suggestion normalization and display timing using synthetic values.

These conveniences should not become unsupported quality claims. An elapsed duration is not a measure of diagnostic effort, and a step label is not proof of clinical reasoning. The test also does not render the actual iOS screen. A device acceptance should inspect interrupted text, pending state, cancellation and final rendering so the user can distinguish a partial reply from a completed workflow.

A useful streaming acceptance matrix

Deliver cases for unsupported streaming, no recognized progress, early error, partial text then failure, malformed completion and successful done. For each, record the original turn identity, whether JSON fallback is attempted and what remains pending. Add authorized server replay and device UI evidence separately.

For a CTO, the benefit is a recovery policy that follows the operation rather than the appearance of text. The interface can be responsive without claiming that every visible fragment is final. The pinned client and scripted tests establish a reviewable boundary, while production idempotency, model quality and clinical acceptance retain the independent evidence they require.

Illustrative control flow

Pseudocode summarizing the decision boundary. It is not copied production code or a deployment instruction.

turn = existing_pending_turn_with_stable_client_id()
progress_started = false
for event in decoded_stream:
    progress_started = true
    show_progress(event)
    if event.is_done:
        accept_completion_payload()
        return

on_failure_or_incomplete_end:
    if cancelled_or_no_longer_signed_in:
        propagate_without_fallback()
    elif not progress_started:
        try_json_for_same_turn_identity()
    else:
        surface_retryable_uncertainty_without_automatic_duplicate_send()

About this engineering series

Written by Omer Muneer Qazi from a review of Movo-X implementation and dated engineering records. This article explains source behaviour and historical observations; current production, clinical outcomes and store availability require their own verification. Examples are synthetic and proposed test cases are identified as such.

Explore the Movo-X engineering series → · Related implementation experience →

Discuss a similar engineering problem

Send the workflow, current platform and the decision your team needs to make. I can help define an implementation or review scope with concrete acceptance evidence.

Discuss your project on WhatsApp ↗
WhatsApp Omer about this project ↗