Skip to content

feat: add Reprocess Transcription on conversation detail - #14299

Open
apoorvdarshan wants to merge 13 commits into
BasedHardware:mainfrom
apoorvdarshan:cursor/reprocess-transcription-908f
Open

apoorvdarshan wants to merge 13 commits into
BasedHardware:mainfrom
apoorvdarshan:cursor/reprocess-transcription-908f

Conversation

@apoorvdarshan

@apoorvdarshan apoorvdarshan commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Re-run speech-to-text from a conversation's stored audio, then pass the replacement transcript through the existing enrichment pipeline. The existing summary-only reprocess action remains separate.

  • POST /v1/conversations/{id}/reprocess-transcription stays owner-scoped, rejects soft-deleted conversations and shares the existing conversations:reprocess rate budget.
  • Audio timestamps prefer stored playback records; saved single-language STT preferences intentionally take precedence over the requested language.
  • Storage listing, merge and individual/batch download exceptions return HTTP 502 and leave the transcript unchanged. Retranscription opts into strict download errors; existing playback callers keep best-effort behavior. Confirmed missing/empty audio returns HTTP 400 (detail.code=no_audio); empty speech uses no_speech. The Flutter client classifies stable codes instead of matching human-readable text. Unknown/malformed responses remain generic failures.
  • The app gates the action on stored audio and prevents overlap with summary reprocessing and speaker saving.
  • Integrated pinned upstream 789de5136cd124991e9956f9ff72891b3ad4416d with a regular merge; API clients and localizations regenerated from their sources.

Validation

  • Flutter error-code/provider tests: 6 passed with --concurrency=2.
  • Analyzer ratchet passed.
  • API schema and Dart/TypeScript/Swift clients regenerated through repository generators.
  • Canonical backend environment preflight: 16 passed, 10 optional warnings, 0 failures. Reused the parent environment only after matching the pinned Python version and dependency locks.
  • Six selected backend unit files: 229 passed, 1 skipped. Hermetic transcription-route E2E: 3 passed (5 unrelated tests deselected). Storage failures preserve the previous transcript.
  • Localization freshness passed: 49 locales / 3837 keys.
  • Final shared PR preflight: 57 checks passed. Final bounded backend selection: 201 passed, 1 skipped; backend typecheck passed. These overlap the focused runs above.
  • Frozen web dependencies installed in this worktree; typecheck, 6 Bun smoke tests and 624 Vitest tests across 118 files passed. Vitest used --maxWorkers=2; package versions and the lockfile are unchanged.

Remaining validation and maintainer decisions

No live STT/storage request or physical-phone overflow-menu interaction has been exercised in this repair. Host tests do not establish production gateway timeouts. The endpoint remains synchronous; successful replay replaces the previous transcript without undo. Missing chunks and corrupt/undecodable formats retain the existing storage fallback semantics; strict retranscription rejects download exceptions, including partial-download outages. Speech-hour charging and recovery of a worse nonempty transcript remain outside this feature. Mobile installs are coordinated separately.

Product invariants affected

none

Failure-Class: none

Line-count exceptions

Line-Count-Exception: app/lib/backend/http/api/conversations.dart | 1472 -> 1520 | Client call and typed error mapping for POST /v1/conversations/{id}/reprocess-transcription.
Line-Count-Exception: app/lib/pages/conversation_detail/conversation_detail_provider.dart | 1444 -> 1512 | Keep transcription replay and mutual exclusion on the existing detail-state owner.

Merge formatter exception

The ordinary merge pre-commit hook ran. Unrelated imported-main formatter changes were then restored byte-for-byte to pinned 789de5136, and a user-authorized, one-command commit-hook override was used only for that restore-only amend. Git identity, conflict-marker checks and pinned formatting checks for authored paths passed manually. The full shared preflight remains enabled; the separate local desktop compile limitation is documented below.

Additional strict-download verification: test_reprocess_transcription.py passed all 18 tests, including four real-merger individual/batch and partial-outage regressions; the hermetic transcription-route E2E rerun passed all 3 selected cases. Existing audio-capture candidate and retry-order guards also passed in the preceding run.

UI evidence

Host-rendered snapshots of the actual Flutter widgets using isolated test fixtures, bundled fonts and iOS theme. These are not phone/simulator captures or hardware sign-off.

Actual conversation overflow menu shows Reprocess Transcription for a fixture conversation with stored audio; isolated host fixture. Rendered in headless Flutter tests using iOS theme and bundled fonts, not on a phone or simulator.

Local desktop compile limitation

Local desktop compile is unverified, blocked by dependency downloads. SwiftPM fetched source dependencies but failed downloading official Sentry 8.58.0 and Sparkle 2.9.4 binary artifacts with timeout/network-connection errors before compilation. One targeted official-artifact recovery also failed: Sparkle returned HTTP 200 but transferred only 6,946,816 of 11,568,656 bytes before its 180-second deadline. Existing caches and the partial download were preserved; no cold wipe or dependency-version change was made.

The repository's documented PRE_PUSH_SKIP_DESKTOP_SWIFT=1 is applied only to this push for that external blocker. All other pre-push gates, including all 57 shared preflight checks, backend typecheck/tests, generated-client compatibility/freshness checks and formatting, remain enabled. Desktop compilation still needs separate CI/build evidence; this repair does not claim it passed locally. All heavy work used the shared serialization lock, nice 10 and at most two build/test workers.

The normal push completed without force. All selected checks passed except the explicitly documented local desktop compile opt-out for repeated external artifact-download failures. Full CI/platform suites and physical hardware checks remain separate evidence.

CI schema-contract follow-up

The initial full backend CI run found one attributable schema-inventory failure: the new error classifier decoded raw JSON outside the generated wire contract. Added an explicit TranscriptionReprocessErrorResponse model for HTTP 400/502, registered both envelope/detail Dart DTOs, regenerated the canonical OpenAPI/Dart/TypeScript outputs, and switched the Flutter classifier to the generated decoder. Unknown reasons and malformed envelope fields remain generic failures; backend response codes and normal feature behavior are unchanged. The schema inventory implementation and its guard tests were not modified.

Canonical test.sh coverage on the final generated working tree passed the full schema inventory, reprocess and Dart-generator test files; the previously failing test_inventory_openapi_route_response_decode_migration_complete passed. The hermetic route E2E rerun passed 3 cases, the relevant Flutter rerun passed 6 tests with concurrency 2, and the analyzer ratchet passed. Full CI will rerun on the follow-up head. This app decoding change is handed to the central personal Release integration; no extra device build/install occurs here.

Final CI attribution

The generated-client schema fix is pushed at 0456b4776d749ae2947b9b17871b83f713e9ee2d. Backend shards 1, 2 and 4 passed, including the previously failing schema inventory. Shard 3 failed two unchanged cursor tests: test_cursor_pages_beyond_6000_historical_with_bounded_calls_no_cap and test_budgeted_legacy_hydration_keeps_rows_when_the_charge_exhausts, both with MemoryReadAdmissionDenied: 503.

CI checked synthetic merge 58b5d5ab6028214bd28916fcc62a6f26135413e1, combining this PR with newer upstream a36fe087215243c4595c11dc4666384ba4c6aa68. The failing backend/utils/memory/read_resilience.py was added upstream by #21227, source commit 2f0e9b2da638e386ff091a38d4ab590e71f9a859, and exists only in the newer base, not this pinned PR head; the cursor test file is byte-identical to the base. Main's backend job on that exact base independently fails the exact same two tests. PR job evidence.

This remaining cloud failure is an inherited upstream admission/test-contract regression. No unrelated production logic, test guard, admission budget or base integration was changed to conceal it. The branch remains mergeable; full cloud CI is not green. The coordinator reports the single personal Release phone build/install/launch succeeded with this final app head included; real Omi/OmiGlass, tap-feel and live provider validation remain separate.

Line-Count-Exception: backend/routers/conversations.py | 2487 -> 2551 | new POST /v1/conversations/{id}/reprocess-transcription endpoint and its error mapping
Line-Count-Exception: backend/utils/other/storage.py | 2807 -> 2815 | opt-in raise_on_download_error so stored-audio retranscription fails instead of transcribing partial audio

@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

Pushed CI fixes to cursor/reprocess-transcription-908f (ec9632718d):

  1. Formatting — scripts/backend-python-format --write (black 26.5.1) on the four files CI flagged.
  2. Generated Files — cd app && flutter pub get && flutter gen-l10n (Flutter 3.44.5); wrapped the new long getters so lib/l10n matches the generator.
  3. Hygiene / PR Metadata — added Line-Count-Exception: backend/routers/conversations.py | 2227 -> 2281 | adds POST reprocess-transcription on the existing conversations router. Current count is 2281 after black (CI had 2283 before format).
  4. Backend unit shards 1/4 and 3/4 — isolated router suites now stub utils.conversations.reprocess_transcription. The new import pulled utils.stt.pre_recorded → timeit from the faked utils.other.endpoints.

Local test.sh: test_conversations_date_range_validation.py 9 passed, test_client_processing_finalize.py 55 passed, plus reprocess (10) and JIT (29).

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @apoorvdarshan — this is a well-built PR. I reviewed the backend path, the Flutter integration, and the tests.

What's solid

  • backend/utils/conversations/reprocess_transcription.py cleanly isolates the audio-to-transcript step: collect_conversation_audio_timestamps() prefers audio_files[].chunk_timestamps (the same grouping playback uses) with a live-chunk fallback, and the three-way error taxonomy (StoredAudioUnavailableError / StoredAudioEmptyTranscriptError / StoredAudioTranscriptionFailedError) maps 1:1 onto the route's 400/400/502. Dropping the merged PCM buffer via finally: del pcm_bytes before word postprocessing is a nice touch for long conversations.
  • The route in backend/routers/conversations.py mirrors the existing reprocess handler (uid-scoped _get_valid_conversation_by_id, soft-delete 404) and reuses conversations:reprocess rate limiting, so ASR replay shares the 3/hour budget instead of opening a fresh one. route_policy_manifest.yaml and export_openapi.py register the route consistently with its sibling, first-party only.
  • Flutter side: reProcessTranscriptionServer() returns a typed TranscriptionReprocessResult, and transcriptionReprocessErrorCode() distinguishing "no stored audio"/"no speech" from generic failure gives the two distinct snackbars in page.dart. The mutual-exclusion guard between loadingReprocessConversation and loadingReprocessTranscription prevents double-firing either action, and the menu item is correctly gated on hasAudio().
  • Test coverage is genuinely good: backend/tests/unit/test_reprocess_transcription.py covers timestamp collection and every error branch, the e2e in test_conversation_processing.py verifies segments are replaced then enrichment runs, and the Dart provider test injects the client to cover success/no-audio/failure. The AutoMockModule additions in test_client_processing_finalize.py and test_conversations_date_range_validation.py are honest harness plumbing, with a comment explaining the utils.stt.pre_recorded import chain.

Two non-blocking notes

  1. In _resolve_stt_language(), when a user has single_language_mode set with a stored language preference, the language_code query param (and conversation.language) are silently ignored — prefs win. If that's intentional (respect user STT prefs), a docstring word saying so would help future readers.
  2. The PR notes fair-use speech-hour charging is out of scope, so a retranscription consumes provider STT cost without counting against the user's speech hours. The shared 3/hour rate limit bounds this, but the cost-vs-fair-use treatment deserves an explicit maintainer call before merge.

Positive signal from me. Two maintainer decisions before merge: sign-off on exposing this as a new first-party API surface, and the STT cost/fair-use treatment above. Leaving for human maintainer review on those points.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added backend Backend Task (python) positive-signal Automation verified a genuine fix/quality contribution needs-maintainer-review Needs a human maintainer to sign off before merge labels Sep 17, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (Reprocess Transcription), not a bug fix -- backend/app area default is approve-only for features regardless of size (diff is mostly generated l10n files).

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @apoorvdarshan — reviewed across the backend route, the STT helper, and the Flutter wiring, alongside @kodjima33's approval of this head. A few observations:

Backend

  • backend/utils/conversations/reprocess_transcription.py — the error taxonomy (StoredAudioUnavailableError → 400, StoredAudioEmptyTranscriptError → 400, StoredAudioTranscriptionFailedError → 502) maps cleanly in the route, sanitize() keeps STT failure detail out of logs, and the del pcm_bytes in finally is a good touch for long recordings.
  • The route reuses the soft-delete tombstone 404 contract from reprocess/sync/merge, so deleted conversations can't be resurrected through this path, and it stays uid-scoped via _get_valid_conversation_by_id.
  • Sharing the conversations:reprocess rate-limit budget rather than introducing a cheaper new one is the right call — this path is strictly more expensive than summary reprocess.
  • collect_conversation_audio_timestamps falling back to list_audio_chunks when audio_files was never stamped is good resilience, and it's covered by tests.

Flutter

  • transcriptionReprocessErrorCode in app/lib/backend/http/api/conversations.dart matches on the 400 detail substrings ('no stored audio' / 'no speech'). That works but is fragile if the server copy is ever reworded — the failure mode is a graceful degrade to the generic error snackbar, which is acceptable; just worth knowing.
  • reprocessTranscription in the provider skips the analytics event that reprocessConversation emits (PlatformManager.instance.analytics.reProcessConversation) — if you want parity for transcription replays, that's a small follow-up.
  • The double loading guard (!loadingReprocessConversation && !loadingReprocessTranscription) on both menu actions correctly prevents concurrent submits.

Copy

  • retranscribingConversation says "This may take a few seconds" — STT on a long conversation can take noticeably longer; consider softer copy. Minor.

None of these are blocking, and the test coverage (route-level 404/400/502 plus process-kwargs assertions, the e2e segment-replacement test, the Flutter provider and error-mapping tests) is genuinely thorough. Removing the needs-maintainer-review label since this head has maintainer sign-off.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level removed the needs-maintainer-review Needs a human maintainer to sign off before merge label Sep 18, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (Reprocess Transcription), not a bug fix -- per current policy, features in backend/mobile/web/community stay approve-only regardless of quality or prior approval. Well-tested, CI green, but not merged.

@cursor
cursor Bot force-pushed the cursor/reprocess-transcription-908f branch 2 times, most recently from 5002abe to a373e79 Compare September 23, 2026 07:00

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-verified: backend feature (Reprocess Transcription), all CI green, mergeStateStatus CLEAN. New commits since last approval (rebase onto main + trigger-enum follow-up). Issue #4601 is a feature request, not a bug report, so stays approve-only per confidence gate. apoorvdarshan cluster checked fresh against farming-pattern signals (self-filed bounty issue, templated body) — none found; issue predates PR by months, filed by a different user (hugoaap-code), body is a detailed, PR-specific technical writeup with real test verification. Genuine high-quality contributor.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (Reprocess Transcription for a single conversation) - approve only per policy.

@cursor
cursor Bot force-pushed the cursor/reprocess-transcription-908f branch 2 times, most recently from 155ee10 to 6280f10 Compare September 25, 2026 04:28

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (new reprocess-transcription capability), not a bug fix — approve only per confidence gate. Tests pass, well-scoped.

@apoorvdarshan
apoorvdarshan force-pushed the cursor/reprocess-transcription-908f branch from 1241c30 to a5bc29f Compare September 25, 2026 16:14

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (reprocess-transcription capability), not a bug fix — approve only per confidence gate. Re-affirmed at new sha.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-affirmed (backlog reapprove): feature (Reprocess Transcription), not a bug fix — backend/app area stays approve-only for features regardless of CI (all green) or diff size. No abuse signals.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (Reprocess Transcription), not a bug fix — approve-only per policy regardless of CI (backend unit shard currently failing, noted for maintainer).

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified this head end to end. The core path is solid — notes for the final sign-off:

Backend

  • backend/utils/conversations/reprocess_transcription.py: clean separation of the audio-to-transcript step. collect_conversation_audio_timestamps() prefers audio_files[].chunk_timestamps with a list_audio_chunks fallback for conversations that never got records stamped; the typed exceptions (StoredAudioUnavailableError / StoredAudioEmptyTranscriptError / StoredAudioTranscriptionFailedError) map 1:1 onto the route's 400/400/502, and logging goes through sanitize().
  • backend/routers/conversations.py: uid-scoped fetch via _get_valid_conversation_by_id, soft-deleted tombstones stay 404, and the route reuses process_conversation(..., trigger=USER_REPROCESS) instead of forking the enrichment pipeline. Sharing the conversations:reprocess budget (3/hour) is the right cost control for an STT replay.
  • backend/route_policy_manifest.yaml + backend/scripts/export_openapi.py: the new route is declared firebase-auth/first-party and excluded from the Developer API contract, mirroring the existing reprocess route. The regenerated clients (desktop Swift/TS, web TS x3) and docs/api-reference/app-client-openapi.json all match the new operationId.

Flutter

  • app/lib/backend/http/api/conversations.dart: the transcriptionReprocessErrorCode() mapping (no stored audio / no speech -> no_audio) is covered by app/test/unit/transcription_reprocess_error_code_test.dart.
  • conversation_detail_provider.dart: reprocessTranscription() takes an injectable client (exercised by the new provider test), and its loading flag is mutually exclusive with reprocessConversation and speaker saving; both menu paths in page.dart guard on both flags.
  • summary_tab.dart / transcript_tab.dart: loading overlays are gated on reprocessConversationId == conversation.id, so a stale overlay can't leak across conversations.

One design note (not blocking): the route runs merge + STT synchronously in the request handler. The UI copy already warns that long conversations take a while and the 3/hour budget caps abuse, but multi-hour audio may brush against HTTP timeouts — worth considering a move behind the async processing queue eventually.

The edits to the other backend test suites (test_conversations_batch_chunking.py, test_conversations_share_email_sanitization.py, test_client_processing_finalize.py, test_conversations_date_range_validation.py, test_conversation_jit_processing.py, test_rate_limiting.py) are mechanical: import-time stubs for the new utils.conversations.reprocess_transcription module plus reformatting; the JIT invariants test correctly extends the no-direct-mode-flag rule to the new call site. The .github/agent-docs/msd-ui-b2-remaining-surfaces.md change is an accurate historical annotation (bottom tab row removed by #19730).

Prior approvals were on earlier heads; the 2026-09-30 push needs a fresh maintainer look before merge. Everything verified on this head is consistent and well tested.

Feedback generated by the Omi maintainer automation on David's behalf.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 09:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-affirming: PR body states this is a feature request, not a fix of a shipped contract. Well-tested, approve-only.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @apoorvdarshan — reviewed on top of the approval already on this head. This is a well-executed, cohesive feature; a few non-blocking notes from the automated pass:

What checks out

  • backend/utils/conversations/reprocess_transcription.py: clean split of concerns — collect_conversation_audio_timestamps prefers audio_files[].chunk_timestamps with a live GCS-listing fallback, and the three typed errors map to 400/400/502 in the route. Reusing the sync pipeline's prerecorded STT helpers is the right call.
  • backend/routers/conversations.py: the new route keeps soft-deleted tombstones at 404, reuses the USER_REPROCESS trigger, and shares the conversations:reprocess rate-limit budget — consistent with the existing reprocess endpoint. The route_policy_manifest.yaml entry and the export_openapi.py Developer-API exclusion are both correct.
  • Flutter side: the injectable client seam in reprocessTranscription, mutual exclusion between the two reprocess actions and speaker-save, the hasAudio() menu gating, and distinct no-audio vs generic-failure snackbars are all done properly. Test coverage on both sides (backend unit + e2e + jit trigger-table + rate-limit count; Dart provider + error-mapping tests) is thorough.
  • The large file count is dominated by generated l10n files and regenerated API clients — the actual hand-written surface is narrow and focused. ARCHITECTURE.md note matches the implementation.

Non-blocking observations

  1. transcriptionReprocessErrorCode in app/lib/backend/http/api/conversations.dart classifies errors by substring-matching 400 bodies ('no stored audio' / 'no speech'). That couples the app to exact backend error wording; a stable error code in the 400 payload would be sturdier.
  2. The route runs audio merge + full prerecorded STT + enrichment synchronously in the HTTP request. That matches the existing reprocess route, but long conversations mean long-held requests — worth watching for gateway timeouts in production.
  3. New segments destructively replace transcript_segments. The empty-STT 400 guard protects against total loss, but a worse non-empty re-transcription isn't recoverable. Fine for a user-initiated action; just noting the behavior.

No changes requested. Leaving the merge/product call with the maintainers, as the approval already reflects.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

…ctions

Rebase onto current main. Preserve grouped menus, connectivity gating and conversation-scoped retry feedback; regenerate API clients from the merged schema. 47 focused reprocessing/provider/screenshot tests passed. Failure-Class: none.
@apoorvdarshan
apoorvdarshan force-pushed the cursor/reprocess-transcription-908f branch from 24e3fa2 to c224bec Compare October 4, 2026 08:36
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the current head — this is a well-built, cohesive feature (the audio→transcript replay step that POST /v1/conversations/{id}/reprocess never covered), with unusually thorough test coverage. File-specific notes:

Backend

  • backend/utils/conversations/reprocess_transcription.py — clean typed error taxonomy; timestamp collection prefers audio_files[].chunk_timestamps with a live GCS listing fallback; STT params mirror the sync pipeline; exceptions are sanitize()d in logs and pcm_bytes is explicitly freed. Two observations: (1) any audio-merge exception (including a storage outage) maps to 400 "No stored audio", which can surface an infra failure as a user error — the exception_type is logged server-side, but maintainers may want a 502-class distinction later; (2) _resolve_stt_language intentionally ignores the route's language_code when a saved single-language preference exists — the docstring documents this, just flagging it as a deliberate product choice.
  • backend/routers/conversations.py — good reuse of process_conversation(trigger=USER_REPROCESS, ...) instead of a parallel pipeline; soft-deleted tombstones stay 404; 400/400/502 mapping is clean and each branch is unit- and e2e-tested.
  • backend/route_policy_manifest.yaml / backend/scripts/export_openapi.py — correctly scoped first-party, reuses the conversations:reprocess fail-closed budget, and keeps the route out of the public developer API contract.

Flutter

  • app/lib/backend/http/api/conversations.dart — minor: transcriptionReprocessErrorCode classifies 400s by substring-matching the backend detail strings ("no stored audio" / "no speech"), a client/server coupling. Acceptable since the backend tests assert the exact strings, but a stable error code in the response body would be more robust if this API grows.
  • conversation_detail_provider.dart / page.dart / summary_tab.dart / transcript_tab.dart — solid mutual exclusion between the two reprocess actions and speaker save, injectable client seam, OmiLoadingState overlays, distinct no-audio vs generic-failure feedback, and summary editing correctly disabled during replay. Reusing the reProcessConversation analytics event is reasonable given the commented rationale.

Tests — the new unit suite (10 tests), 2 hermetic e2e route tests, JIT trigger-table assertions, rate-limit count update (6→7), and the Flutter provider/error-mapping tests are exactly the coverage this surface needs. The test_conversations_batch_chunking.py / test_conversations_share_email_sanitization.py changes are formatting-only churn.

Two non-blocking asks for the maintainer pass: a quick device sanity check of the new overflow-menu action (CI skips the mobile suites and the PR honestly notes it wasn't device-verified), and a gut-check on the merge-failure→400 mapping above. Otherwise this is ready for maintainer re-approval of the new head.

— AI-generated maintainer feedback on behalf of the Omi maintainers


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (Reprocess Transcription action) — approve-only per confidence gate; title/body frame this as new capability, not a bug fix.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (Reprocess Transcription), not a bug fix — approve-only per confidence gate; also DIRTY (needs manual rebase, left untouched).

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (reprocess transcription action); approve-only per policy.

Integrates upstream 789de51 without rewriting PR history. Verification evidence: repair-evidence/20261011-14299-*.log (local coordinator handoff); PR body records commands and remaining hardware limitations.

Failure-Class: none
Opt transcription replay into shared-merger download error propagation after queued jobs settle. Preserve best-effort playback defaults. Regression coverage exercises actual individual/batch futures for complete and partial outages; replay must fail before STT and retain the previous transcript.

Failure-Class: none
Capture the actual Flutter widgets using their existing isolated test fixtures, the iOS theme and bundled fonts. This documents the rendered UI only; radio behavior, on-device interactions and firmware timing remain pending central hardware validation.
apoorvdarshan added a commit to apoorvdarshan/omi that referenced this pull request Oct 11, 2026
Declare the existing 400/502 error envelope in OpenAPI and register its nested Dart DTOs. Consume generated decoding while preserving stable no-audio and generic-failure behavior. Cover malformed response shapes and verify the unchanged schema-inventory guard through canonical test.sh.

Failure-Class: none
apoorvdarshan added a commit to apoorvdarshan/omi that referenced this pull request Oct 11, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feat: Reprocess Transcription on conversation detail -- feature, approve-only (CI failing informational only, doesn't matter since not merging)

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feat: Reprocess Transcription on conversation detail -- feature, approve-only (CI failing informational only, doesn't matter since not merging)

@apoorvdarshan apoorvdarshan added the ci:full Maintainer-granted: run full CI on this fork PR label Oct 13, 2026
apoorvdarshan and others added 2 commits October 13, 2026 23:24
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-confirmed: feature (Reprocess Transcription), approve-only ceiling; mergeStateStatus DIRTY so not mergeable regardless.

@undivisible

Copy link
Copy Markdown
Collaborator

@apoorvdarshan this conflicts with main now. Please rebase and push; it still looks valid.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature (Reprocess Transcription action) — approve only per area rule; mergeStateStatus is DIRTY so no merge regardless.

apoorvdarshan and others added 2 commits October 18, 2026 18:21
- Detail provider: main replaced the summary reprocess loading helpers;
  reprocessTranscription now sets reprocessConversationId directly, before
  notifying, and keeps its own loading state.
- Listed storage chunks now carry their path: the merger test fixture
  gives its individual chunk one, as list_audio_chunks does.
- The reprocessed conversation is parsed off the UI isolate above the
  list threshold (INV-PERF-1); the small error envelope is annotated.
- API clients regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L6nc4Dq4LXiSGCnJBvD7ix
- No HTTP retry and the long reprocess timeout: the endpoint is not
  idempotent.
- Success clears a stale summary failure, bumps the refresh generation and
  ends any speaker-labeling pass, as summary reprocess does.
- Failure resets loading before reporting the crash; analytics and error
  toasts use the reprocessed conversation, toasts only when it is open.
- Summary actions treat either reprocess in flight as busy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L6nc4Dq4LXiSGCnJBvD7ix
@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: no blocking issues found - the backend route, the app integration, and the generated-client updates all check out; leaving the merge decision on this head to the maintainers already engaged on this thread.

What I verified:

  • backend/routers/conversations.py - the new POST /v1/conversations/{id}/reprocess-transcription is owner-scoped via _get_valid_conversation_by_id, returns 404 for soft-deleted conversations, and reuses the conversations:reprocess rate budget (fail-closed).
  • backend/utils/conversations/reprocess_transcription.py - clean split between "no stored audio" (400 no_audio/no_speech) and infrastructure/STT failures (502 failed); exceptions are logged sanitized; test_real_chunk_merger_outage_preserves_failure in backend/tests/unit/test_reprocess_transcription.py proves a partial storage outage cannot publish a partial transcript.
  • backend/utils/other/storage.py - the new raise_on_download_error flag defaults to false, so playback callers keep best-effort merging; only the retranscribe path opts into strict failure propagation.
  • app/lib/backend/http/api/conversations.dart - retries: 0 on the STT replay POST (a retry would double STT spend on a non-idempotent operation), and transcriptionReprocessErrorCode only trusts detail.code on a 400; malformed, proxy, or 502 bodies stay generic failures so a storage outage can never surface as "no stored audio". Covered by app/test/unit/transcription_reprocess_error_code_test.dart.
  • app/lib/pages/conversation_detail/conversation_detail_provider.dart - reprocessTranscription shares the summary-rewrite lifecycle (_beginSummaryRewrite/_landReprocess) and anyReprocessInFlight blocks every summary entry point concurrently; stale-read, wrong-conversation, and crash-reporter races are all covered in app/test/providers/conversation_detail_reprocess_transcription_test.dart.
  • backend/route_policy_manifest.yaml and backend/scripts/export_openapi.py - the route is registered first-party/Firebase-auth and explicitly excluded from the Developer API key contract.

Cost: each tap re-runs STT over the conversation's full stored audio plus the enrichment pipeline - real provider spend, mitigated by the shared reprocess rate limit. UX: the previous transcript is replaced with no undo (documented in backend/docs/listen_pusher_pipeline.mdx); a worse re-transcription cannot be reverted. Security: owner-scoped route, no new dependencies, no CI/workflow changes - nothing concerning.

USER IMPACT: users get a "Reprocess Transcription" item on conversations with stored audio; tapping it re-runs speech-to-text from the recording and regenerates the summary, with distinct messages for missing audio vs provider failure.

Two things I'd still want:

  1. A test for the seam where transcription succeeds but process_conversation fails afterward - the e2e failure tests stop at transcription failures, so whether a mid-pipeline failure can persist replaced segments without enrichment is unverified.
  2. The client timeout is 180s (reprocessRequestTimeout) while the route is synchronous over potentially long audio - for very long conversations the app could time out and show an error while the server later completes and replaces the transcript anyway. Worth confirming worst-case duration or planning an async pattern.

No urgent concerns; the final call on this head stays with the maintainer review already in progress.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@mintlify

mintlify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit abf3f87.

Approve preview

apoorvdarshan and others added 2 commits November 2, 2026 11:39
Update ConversationReprocessCall fakes for main's forceOmi parameter, use
Env.overrideApiBaseUrl in the retry test, and fake the reprocess-transcription
helper in the new merge duplicate-guard suite, whose endpoints stub has no timeit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@apoorvdarshan

Copy link
Copy Markdown
Collaborator Author

@Git-on-my-level heads-up: the required UI author approval check (guard) can't pass on this PR because of a limit in main's script, not this diff.

.github/scripts/ui-author-approval.cjs (lines 65-67 on main) reads each changed desktop/macos/**/*.swift file through repos.getContent and throws Incomplete Swift source evidence when data.size > 1000000 or the content is empty. The contents API also returns no content for files over 1 MB. desktop/macos/Desktop/Sources/Generated/OmiApi.generated.swift is already 1,128,831 bytes on main, so any PR that regenerates the API clients (this one adds the reprocess-transcription endpoint) fails guard. The check runs main's copy via pull_request_target, so this branch can't fix it, and dropping the Swift file would break the generated-client freshness check.

A possible fix: read files over the limit through the Git blobs API (git.getBlob with the file's blob SHA, up to 100 MB), or exempt Sources/Generated/**, since it is generated rather than hand-written UI code. Everything else on this head is up to date with main.

@Git-on-my-level

Copy link
Copy Markdown
Member

The implementation is solid and well-tested end to end; I found no blocking issues. The remaining merge blockers are process/product ones, not code correctness.

What I verified

  • backend/utils/conversations/reprocess_transcription.py — the error taxonomy is exactly right: FileNotFoundError/empty merge → no_audio (400), any other merge exception → 502 failed, STT exception → 502 failed (detail sanitized via utils.log_sanitizer.sanitize). The previous transcript is only replaced after a nonempty transcript is produced.
  • backend/utils/other/storage.py — raise_on_download_error=True records the first download exception and raises only after all submitted jobs settle, so retranscription can never publish a partial merge, playback callers keep the best-effort default, and no futures are orphaned. Covered by real-merger outage tests in test_reprocess_transcription.py.
  • backend/routers/conversations.py — owner-scoped through _get_valid_conversation_by_id, soft-deleted conversations rejected with 404, shares the conversations:reprocess fail-closed rate budget (route_policy_manifest.yaml), and enrichment reuses process_conversation(..., trigger=USER_REPROCESS).
  • app/lib/backend/http/api/conversations.dart — retries: 0 (correct for a non-idempotent replay), 180s timeout, and error classification keyed on the stable detail.code wire contract rather than human-readable text; malformed/unknown bodies stay generic failures (transcription_reprocess_error_code_test.dart, plus the no-retry-after-502 test in http_pool_manager_retry_test.dart).
  • conversation_detail_provider.dart — the shared _beginSummaryRewrite/_landReprocess refactor is behavior-preserving for the summary flow, anyReprocessInFlight gives correct mutual exclusion across summary reprocess, transcription reprocess, and speaker saving, stale reads are dropped on landing, and a failure is not announced if the page has moved to another conversation. Good edge-case test coverage in conversation_detail_reprocess_transcription_test.dart.
  • page.dart / transcript_tab.dart / summary_tab.dart — menu entry gated on stored audio, dedicated loading states, and both failure paths surface localized strings across all 49 locales.

Two minor nits (non-blocking)

  • transcriptionReprocessErrorCode collapses no_speech into the no_audio bucket, so a user whose audio exists but contained no speech sees "No stored audio available for this conversation." A distinct message would be kinder once copy allows it.
  • The app gates the menu on conversation.hasAudio(), while the server falls back to listing live GCS chunks when audio_files is empty — so a small set of retranscribable conversations will not show the menu. Conservative direction, fine for now.

Material dimensions

  • Cost/performance: each invocation is a full-conversation STT run (the most expensive per-call operation this surface has); the shared reprocess rate budget is the main cap. The endpoint is synchronous and can run minutes — the PR notes host tests don't establish production gateway timeouts, and I agree that's the biggest operational unknown.
  • UX: a successful replay replaces the transcript and regenerates the summary with no undo; a worse transcript cannot be recovered (documented in the PR).
  • Blast radius: confined to the new endpoint, its helper, and the app menu; existing playback/merge behavior and the summary-only reprocess are unchanged apart from the verified refactor.

USER IMPACT: none until a user picks "Reprocess Transcription" in a conversation's overflow menu — then the transcript and summary are regenerated from the stored audio, replacing the previous transcript permanently.

What I'd still want

  • Evidence of production gateway behavior for multi-minute synchronous STT replays (or a decision that this is acceptable, as for the existing reprocess route).
  • An explicit maintainer call on no-undo transcript replacement.
  • Resolution of the failing UI author approval check before merge.

Leaving the synchronous-endpoint and no-undo product decisions to the human maintainers — those are direction calls, not correctness ones.

This review was generated by AI on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

This branch has not been deployed

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

Labels

backend Backend Task (python) ci:full Maintainer-granted: run full CI on this fork PR positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants