Skip to content

UX: Consider clearing partial text on retry #85

@evansenter

Description

@evansenter

Summary

When an API call fails mid-stream and triggers a retry, any TextDelta events that were already emitted remain visible in the UI. This could cause brief "partial text" display followed by the full retried response.

Current Behavior

User: "Hello"
[partial response appears: "Hi there! I'm hap"]
[retrying in 2s: rate limited]
[full response appears: "Hi there! I'm happy to help..."]

The partial text and full response may both be visible.

Proposed Behavior

Options:

  1. Track whether any text was emitted before retry, and emit a "clear" event for UI to handle
  2. Document this as expected behavior (current approach - comment exists in code)
  3. Buffer all TextDeltas until response completes, then emit (would lose streaming UX)

Related Code

src/agent.rs:386-388:

// If we had some response, clear it for the retry to avoid duplication
// (Note: TextDelta events were already sent, so UI might still show them)
full_response.clear();

Notes

This is a rare edge case that only occurs when:

  1. The API fails mid-stream (after some text was streamed)
  2. The error is retryable

Low priority as the current behavior is documented and the impact is minimal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions