Skip to content

A recording whose async transcription fails disappears from the app: no Library entry, no retry, file left orphaned #331

Open

Description

@Pulkit7070

Summary

When a Record session ends with nothing heard live (the realtime session never got going, or the socket failed before any turn arrived), saveRecording hands the audio file to transcribe(url, kind: .recording). If that async pass fails (offline, a 5xx, a timeout), the .failure branch only sets state = .failed(fileName:message:). The comment there says the recording "stays in its folder rather than costing the user the audio over a network blip", and the file is kept on disk, but nothing in the app points at it:

  • no SavedTranscript is added, so it is not in the Library under All or Recordings;
  • the failed page shows only the error text (for example "Could not connect to the server.") and has no Try Again;
  • the path is not shown, and no code ever scans TranscriptStore.recordingsDirectory again, so the file is never offered back to the user and never cleaned up.

Once the user dismisses the error, the recording cannot be reached from Blurt. The scenario that triggers this is a network outage, which is the same condition that makes the live session fail first. Someone who records a meeting while offline loses it from the app.

Code:

Repro

The harness below runs the app's real TranscriptsModel sources against AsyncTranscriptionClient pointed at a local server. transcribe(url, kind: .recording) is exactly the call saveRecording makes.

  1. Next to a clone of blurt, create recloss/Package.swift:

    // swift-tools-version:6.2
    import PackageDescription
    let package = Package(
      name: "recloss", platforms: [.macOS(.v15)],
      dependencies: [.package(path: "../blurt")],
      targets: [.executableTarget(
        name: "RecLoss",
        dependencies: [.product(name: "BlurtEngine", package: "blurt"), .product(name: "AssemblyAI", package: "blurt")],
        swiftSettings: [.defaultIsolation(MainActor.self)])])
  2. Copy TranscriptsModel.swift, TranscriptsModel+Recording.swift, +Files.swift, +Playback.swift, +Meetings.swift, TranscriptFacet.swift and ClipPlayer.swift from App/Blurt/Blurt/Wizard/ into recloss/Sources/RecLoss/, and add main.swift:

    import AssemblyAI
    import BlurtEngine
    import Foundation
    
    let base = URL(string: CommandLine.arguments[1])!
    let work = URL(filePath: CommandLine.arguments[2])
    try FileManager.default.createDirectory(at: work, withIntermediateDirectories: true)
    let recording = work.appending(path: "Recording 2026-11-20 at 09.00.00.m4a")
    try Data(repeating: 7, count: 64_000).write(to: recording)
    let store = TranscriptStore(url: work.appending(path: "transcripts.json"))
    let model = TranscriptsModel(
      apiKey: { "test-key" },
      transcriber: FileTranscriber(
        client: AsyncTranscriptionClient(baseURL: base, transport: URLSession.shared, pollInterval: .milliseconds(10)),
        apiKeyProvider: { "test-key" }),
      store: store)
    try await Task.sleep(for: .milliseconds(300))
    model.transcribe(recording, kind: .recording)
    for _ in 0..<100 {
      try await Task.sleep(for: .milliseconds(100))
      if case .failed = model.state { break }
    }
    try await Task.sleep(for: .milliseconds(600))
    print("state:", model.state)
    print("history entries:", model.history.count)
    print("recording still on disk:", FileManager.default.fileExists(atPath: recording.path))
    print("saved store entries:", store.load().count)
  3. Run it against a server that answers POST /v2/upload with 503 {"error":"Service Unavailable"}, and against a closed port to stand in for being offline:

    swift build
    .build/debug/RecLoss http://127.0.0.1:18731 /tmp/recloss-503
    .build/debug/RecLoss http://127.0.0.1:18799 /tmp/recloss-offline
    

Expected

The recording stays reachable in Blurt: a Library entry for it (marked as not transcribed yet) or a Try Again on the failure page, so the user can transcribe it once the network is back.

Actual

state: failed(fileName: "Recording 2026-11-20 at 09.00.00.m4a", message: "AssemblyAI error 503: Service Unavailable")
history entries: 0
recording still on disk: true
saved store entries: 0
---
state: failed(fileName: "Recording 2026-11-20 at 09.00.00.m4a", message: "Could not connect to the server.")
history entries: 0
recording still on disk: true
saved store entries: 0

The mock logged one POST /v2/upload with the 64,000-byte file. Nothing else references the file afterwards.

Suggested fix

On .failure for kind == .recording, save an entry that owns the file and carries no text (or a "Not transcribed" state), and give it a Transcribe action that calls transcribe(url, kind: .recording) again. As a lighter option, keep the URL in State.failed and offer Try Again plus Show in Finder on the failure page. The same retry also covers the case where diarize fails after a partial live transcript.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions