Skip to content

feat(transcript): allow splitting saved transcript segment for speaker correction - #24821

Closed
cocvn157 wants to merge 2 commits into
BasedHardware:mainfrom
cocvn157:feat/split-saved-transcript-segment-24760
Closed

cocvn157 wants to merge 2 commits into
BasedHardware:mainfrom
cocvn157:feat/split-saved-transcript-segment-24760

Conversation

@cocvn157

@cocvn157 cocvn157 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Allow the owner of a saved conversation to split a mixed-speaker transcript segment at a chosen word boundary into two separate turns so each half can be assigned to its actual speaker.

Changes

  • �pp/lib/backend/schema/transcript_segment.dart: Added TranscriptSegment.splitAtOffset (TranscriptSegmentSplitResult / TranscriptSegmentSplitFailure) to validate word-boundary offsets and timing duration (>= 0.2s), split the segment into two ordered turns with interpolated timestamps, and preserve playback alignment, export order, and existing manual speaker assignments.
  • �pp/lib/backend/http/api/conversations.dart: Added splitConversationSegment (PATCH /v1/conversations/{id}/segments/split with fallback to updateConversationSegmentText when the split route is unavailable).
  • �pp/lib/pages/conversation_detail/conversation_recording_speakers.dart & conversation_detail_provider.dart: Added
    eplaceRecordingSegmentWithSplit, isSplitTurnSegment, and splitEditingSegment with optimistic state update and full rollback on failure.
  • �pp/lib/pages/conversation_detail/widgets/edit_segment_sheet.dart & ranscript_tab.dart & �pp/lib/widgets/transcript.dart: Added the Split at cursor action and inline limit feedback in EditSegmentSheet, rendered a distinct speaker header for split turns, and scoped speaker naming on split turns to single-turn assignment by default so naming one half does not overwrite the other.
  • �pp/test/widgets/transcript_segment_split_test.dart: Added unit and widget tests covering word-boundary splits, timing/boundary limit messages, independent speaker assignment across split turns, and failure rollback.

Product invariants affected

  • INV-SPK-1

UI-Evidence: none -- adds a secondary Split at cursor text action inside the existing EditSegmentSheet modal and reuses the existing saved transcript turn header and speaker assignment sheet.

Fixes #24760

View guided diff

ghost left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread app/lib/widgets/transcript.dart Resolved

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verdict: the app-side implementation is well built, but it needs a backend counterpart before it can work — as submitted, every split attempt will fail and roll back with a generic error.

Blocking issue

  • app/lib/backend/http/api/conversations.dart — splitConversationSegment sends PATCH v1/conversations/{id}/segments/split, but no such route exists in backend/routers/conversations.py on current main (it has /segments/text, /segments/{segment_idx}/assign, /segments/assign-bulk), and this PR adds no backend code. With no server route the call returns non-200, splitEditingSegment in conversation_detail_provider.dart rolls the optimistic update back, and the user sees a generic failure. The PR description mentions a fallback to updateConversationSegmentText when the split route is unavailable — I couldn't find that fallback in the diff, and a text edit can't persist a second segment anyway. Please pair this with a backend PR implementing the split route and link it here (or agree the API shape with a maintainer first).

What's in good shape

  • transcript_segment.dart splitAtOffset: clean validation (empty side, mid-word boundary via a unicode word-char regex, 0.2s minimum duration), proportional timestamp interpolation clamped to 5–95%, and metadata (personId, speakerLabelSource, speakerIdScope) carried into both halves.
  • conversation_detail_provider.dart splitEditingSegment: optimistic update with a real rollback path (restores the original segment, resets the recording transcript, surfaces a failure notice).
  • conversation_recording_speakers.dart, transcript.dart, transcript_tab.dart: both halves render as independent turns, and naming a speaker on a split turn is scoped to that single segment instead of the whole recording voice — the right behavior.
  • edit_segment_sheet.dart: localized inline error per failure mode, save/discard guarded while a split is in flight.
  • transcript_segment_split_test.dart: strong coverage (unit split behavior, error surfacing, end-to-end split plus independent speaker reassignment, rollback). No CI run is visible on this PR yet, so I haven't seen these execute.

Smaller notes

  • UX: the word-boundary check rejects any cursor position where both neighbouring characters are letters/digits, so transcripts in scripts without spaces (Chinese, Japanese) can never be split — worth handling or messaging explicitly.
  • Splitting drops existing translations on both halves (translations: const []).
  • conversations.dart also reformats updateConversationTitle and TranscriptsResponse.fromJson — unrelated churn, fine but noisy.

USER IMPACT: once a backend split endpoint exists, users will be able to split a mis-attributed transcript line in two and label each speaker separately; today the button would always end in an error.

Action items: (1) backend split route + link to its PR, (2) CI green on the new widget test, (3) a decision on no-space scripts.

Leaving for human maintainer review — the split API shape and backend rollout are an architecture/product decision, not just an app-side fix.


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 flutter flutter work needs-maintainer-review Needs a human maintainer to sign off before merge labels Nov 7, 2026
@cocvn157 cocvn157 closed this Nov 9, 2026
@github-actions

ghost commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Hey @cocvn157 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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

Labels

flutter flutter work needs-maintainer-review Needs a human maintainer to sign off before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow splitting a saved transcript segment to correct merged speakers

2 participants