Skip to content

Slice OpenAI uploads that are under 25 MB but longer than the model allows - #18

Closed
hd-deman wants to merge 3 commits into
gsamat:masterfrom
hd-deman:fix/openai-duration-cap
Closed

hd-deman wants to merge 3 commits into
gsamat:masterfrom
hd-deman:fix/openai-duration-cap

Conversation

@hd-deman

Copy link
Copy Markdown

Summary

  • gpt-4o-transcribe-diarize refuses audio longer than 1400 seconds even when the file is under 25 MB. A 42-minute mix at 64 kbit/s is about 20 MB, so the size check sent it whole and the API answered HTTP 400 (2530 seconds, 21 September).
  • Piece length is now the tighter of the two ceilings: 25 MB, or 1390 seconds (1400 minus a little slack, because AAC measures a fraction longer than the PCM it was cut from). A size-only cut of a longer meeting still lands around 45 minutes, which this model also refuses.
  • The default-input listener did not compile on Swift 6.2: the @Sendable block captured the recorder in a main-actor closure. The same next-turn checkRoute now goes through a method.

Test plan

  • swift test --filter OpenAIEngineTests
  • swift test --filter MicRestartTests
  • Re-transcribe 2026.09.21-1449 PSF Deep Archive Flow Introduction (zoom.us). The archive is still there; transcription_failed has to be cleared first (Re-transcribe does that).
  • Confirm a meeting between about 23 and 55 minutes is sliced before upload, and a short one still goes in one request.

…llows.

gpt-4o-transcribe-diarize refuses audio past 1400 seconds, and a 42-minute
mix at 64 kbit/s is only about 20 MB, so the size check sent it whole.
… 6.2.

The property-listener block is @sendable, and capturing the recorder in a
main-actor closure is rejected. The hop is the same next-turn checkRoute.
ekho added a commit to ekho/verbemo that referenced this pull request Oct 21, 2026
Cut OpenAI audio by the tighter byte or defensive 1390-second duration ceiling, validate encoded parts, and key cached responses by actual source ranges. Preserve source audio and successful responses across retries.

Adapted from Dmitry Tsoy's gsamat/amanu#18, source 31b8ec434224ad6ead27c37dec8db51694a1b757, reviewed at 101b41816fe7cd359a453d3d4653a19df028e20b. Keep upstream links in provenance records.

Validation: CI run 39682864995 completed successfully on 46b5ce6, including macOS, Windows, release-script tests, independence guard, and shared preview validation.

Closes #6

Co-Authored-By: Dmitry Tsoy <hd.deman@gmail.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
@gsamat

gsamat commented Dec 6, 2026

Copy link
Copy Markdown
Owner

Thank you very much for diagnosing the 1400-second OpenAI limit and putting this fix together, and sorry it took us so long to review it! This has now been superseded by the newer streaming & pause-aligned slicing implementation (#60, with additional fixes integrated for 0.6.6), so we're closing this PR. Really appreciate the contribution!

@gsamat gsamat closed this Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants