Skip to content

fix(macos): cap OpenAI upload duration and isolate slice caches - #32

Merged
ekho merged 2 commits into
masterfrom
codex/6-openai-duration-cap
Oct 21, 2026
Merged

ekho merged 2 commits into
masterfrom
codex/6-openai-duration-cap

Conversation

@ekho

@ekho ekho commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

When a recording was below the upload byte limit, OpenAI received the whole file even when it exceeded the diarization model's observed duration ceiling. This fix cuts by the tighter size or duration estimate, checks the encoded files before upload, and keys cached responses by actual source ranges. Short valid audio remains one request; retries retain source audio and reuse completed pieces, with timestamps and speaker labels kept separate per request.

Closes #6

Limits and provenance

  • 1390 seconds is a defensive cut length, with 10 seconds of AAC allowance below the 1400-second rejection reported upstream. It is not represented as a documented or independently verified current API maximum.
  • Checked 2026-10-22: OpenAI file transcription documents 25 MB; API reference requires chunking_strategy above 30 seconds. Neither those pages nor the model page specifies 1400 seconds. Existing byte-threshold interpretation and size margin are retained.
  • Adapted from Dmitry Tsoy / gsamat/amanu#18, source 31b8ec434224ad6ead27c37dec8db51694a1b757, reviewed head 101b41816fe7cd359a453d3d4653a19df028e20b. Author credit is preserved in the commit; copyright and license files are unchanged. The unrelated MicRecorder patch is excluded.
  • Base: f08bf3458731ffb570b2de52b28df67e388c9e87. Current head: 46b5ce646374a1f6874f4679189baebfe4c4fc0e. Runtime code and Swift tests were validated at 78a64a9578f652ee57104a4e2370b0e3dde9cb08; the follow-up only relocates upstream links to provenance documentation and changes a source comment.

Validation

Local Apple Silicon, Swift 6.4 / Xcode 27.1:

  • swift test --no-parallel --filter 'OpenAIEngineTests|FormEngineHTTPTests|TranscriptionScratchTests': 22 tests / 3 suites passed.
  • swift test --no-parallel: final success report, 1031 tests / 145 suites, 132.521 s; 23 skipped native model/corpus, LocalVQE, private-audio, calendar and window cases.
  • swift build and git diff --check: passed.
  • python3 -m unittest discover -s Tests/scripts -p 'test_*.py': 114 tests passed after moving upstream references into docs/history, matching the product-independence guard convention.
  • python3 Tests/scripts/test_independent_product.py --all: passed.
  • Long under-limit and unreadable-audio regressions were observed failing before the production change. Synthetic 1401-second AAC and smaller byte-budget cases exercise actual AAC writing and container duration/size checks. Tests also cover both ceiling orders, short/invalid inputs, second-piece failure and retry across a new engine, timestamps, speaker labels, legacy caches and changed boundaries with the same piece count.
  • Independent read-only review found no actionable issues.

Acceptance limits

No real OpenAI requests, personal recordings, or API keys were used. Stub success does not establish live API acceptance or recognition quality. Packaged-app behavior and Windows were not tested; Windows is outside this issue.

Old cached responses without source boundaries are intentionally not reused, so an interrupted legacy run may upload again once. Unexpected encoded-limit overruns fail locally while retaining source audio. The documentation also marks the existing model deprecated for shutdown on February 26, 2027; migration is separate work.

Details: docs/testing/openai-duration-cap.md.

Apply the tighter size or defensive 1390-second duration ceiling, validate
encoded uploads, and key cached responses by actual source boundaries.
Retain source audio and completed responses when a later request fails.

Adapt the tighter-ceiling approach from gsamat/amanu#18, source commit
31b8ec434224ad6ead27c37dec8db51694a1b757 (head 101b41816fe7cd359a453d3d4653a19df028e20b).
The duration ceiling is protective, based on a reported 1400-second API
rejection, not a documented current service limit.

Closes #6

Co-Authored-By: Dmitry Tsoy <hd.deman@gmail.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
@ekho
ekho marked this pull request as ready for review October 21, 2026 21:35
Preserve upstream attribution in docs/history, following the independent product guard convention. Runtime behavior is unchanged.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@ekho
ekho merged commit c65eed5 into master Oct 21, 2026
3 checks passed
@ekho
ekho deleted the codex/6-openai-duration-cap branch November 20, 2026 13:54
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.

macOS: ограничить длительность частей аудио для OpenAI (Amanu PR #18)

1 participant