Skip to content

AsyncTranscriptionClient.isTransient retries URLError.cancelled (Library/Record cancel burns pollAttempts) #336

Open

Description

@webski101

What happened?

Body

Summary

Sibling of #324 (awaitUpload painting cancel as .failed), but on the async recording/Library client.

AsyncTranscriptionClient.isTransient correctly excludes CancellationError, then treats every URLError as transient — including .cancelled. A cancelled mid-poll fetch can retry up to pollAttempts (4) with sleeps before surfacing.

Separately, upload (and submit) are single-shot while fetch is retried — so a blip on POST /v2/upload costs the whole recording even though the file is still local. The comments justify retries so one blip shouldn't cost an hour-long recording its upload, but only the status poll is covered.

Evidence

// AsyncTranscriptionClient.swift
static func isTransient(_ error: any Error) -> Bool {
  if error is CancellationError { return false }
  if case AsyncTranscriptionError.http(let status, _) = error {
    return status == 0 || status == 429 || status >= 500
  }
  return error is URLError  // includes .cancelled
}
func upload(...) async throws -> URL {
  // single-shot send — no fetchRetrying wrapper
  let data = try await send(request)
  ...
}

Related

Suggested fix

  1. Treat (error as? URLError)?.code == .cancelled as non-transient (mirror URLError(.cancelled) is not recognized as cancellation in awaitUpload(), repainting cancelled dictations as .failed #324 / Treat URLError.cancelled as cancellation in awaitUpload #326).
  2. Optionally narrow transient URLError codes to timedOut / networkConnectionLost / etc.
  3. Wrap upload (and likely submit) with the same transient retry policy as fetchRetrying, still excluding cancel.

macOS and Blurt versions

macOS 15.6 · Blurt 0.1.71

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions