Skip to content

Address codex review: drop transcript sample, raise tri-gram floor#3

Merged
Newarr merged 1 commit into
mainfrom
fix/codex-review-followup
May 11, 2026
Merged

Address codex review: drop transcript sample, raise tri-gram floor#3
Newarr merged 1 commit into
mainfrom
fix/codex-review-followup

Conversation

@Newarr

@Newarr Newarr commented May 11, 2026

Copy link
Copy Markdown
Owner

Summary

Codex (gpt-5.1-codex) reviewed PR #1 post-merge and flagged two [P2] issues in DegenerateOutputDetector / CohereMLXBackendError. Both are real; this PR addresses them.

Findings and fixes

1. Privacy leak via sample

[P2] When this path is hit, the thrown CohereMLXBackendError carries sample, and TranscriptionWorker persists String(describing: error) into the failed transcript.md and metadata.json.

Verified: TranscriptionWorker.swift:226 does let reason = String(describing: error) then writes it via writeFailed. The 120-char snippet (which by definition is the first few sentences of a meeting transcript) was landing in the failure artifact.

Fix: Drop the sample associated value entirely. Surface it instead via Log.engine.error(... sample: \(text, privacy: .private)) so the unified log can show it for live debugging without leaking to disk.

2. Tri-gram threshold too sensitive at the 30-word floor

[P2] For transcripts just over the 30-word floor, this condition fires on only three occurrences of a tri-gram (3/28 > 0.08), so legitimate short recordings with repeated phrases such as repeated greetings or confirmations can be marked terminally failed.

Verified: at 30 words there are 28 tri-grams, so 3 repeats clears the 8% gate. A short recording with "thank you very" appearing three times would fail terminally.

Fix: Require n >= 5 in addition to the fraction gate. The observed real-world loop has 12+ repeats so it stays caught; ordinary short transcripts no longer false-positive.

Tests

  • Existing testBackendThrowsDegenerateOutputErrorOnLoopedAdapterOutput updated for the new error shape and now asserts String(describing: error) does NOT contain transcript content.
  • New testDetectorDoesNotFireOnShortTranscriptWithFewRepeats — 30-word transcript with 3 occurrences of "thank you very" must return nil.
  • Full suite: 366 tests pass, 1 integration test skipped (gated by SCRIBE_RUN_MLX_INTEGRATION=1).

Test plan

  • swift test is clean
  • Trigger a real degenerate transcript (e.g. revert the fork dependency briefly) and confirm metadata.json shows the reason but not the looped text

Two follow-ups to PR #1 raised by an independent codex review:

1. Privacy: drop `sample` from `CohereMLXBackendError.degenerateOutput`.
   `TranscriptionWorker` persists `String(describing: error)` into the
   failed `transcript.md` and `metadata.json` artifacts, so the 120-char
   transcript snippet that used to ride along on the error was landing in
   on-disk failure metadata. The sample now stays in the unified log at
   `.private` privacy level for live debugging only.

2. False-positive floor: require the dominant tri-gram to repeat at least
   5 times before firing, in addition to the >8% fraction check. At the
   30-word minimum, 3 occurrences of an ordinary tri-gram (e.g. "thank
   you very") cleared the fraction gate at 3/28 ≈ 11% and terminally
   failed otherwise-usable short transcripts. The observed real-world
   loop fires 12+ times so the new floor is still well within range.

New regression test guards the short-transcript-with-three-repeats case;
the existing throw test now also asserts that `String(describing:)` on
the error does NOT contain transcript content.
@Newarr Newarr force-pushed the fix/codex-review-followup branch from 3e58a2c to 09257e9 Compare May 11, 2026 17:51
@Newarr Newarr merged commit be66939 into main May 11, 2026
1 check failed
@Newarr Newarr deleted the fix/codex-review-followup branch May 11, 2026 17:52
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.

1 participant