Repository navigation
Conversation
…asedHardware#18520 In app/lib/backend/schema/conversation.dart, _getDurationInSecondsByTranscripts() took the largest segment end timestamp without subtracting the first segment start timestamp. When speech occurred late in a continuous streaming session (e.g. 38 minutes in), the transcript segments carry session-offset timestamps, causing the conversation header to report 40+ minutes for a 2-minute recording. Compute the conversation duration from the speech span (lastEndTime - firstStartTime) with non-negative clamping, preserving zero-offset segment behavior while accurately reporting conversation length for session-offset speech. Failure-Class: FC-capture-session-window-read-as-content-duration
kodjima33
approved these changes
Sep 24, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Bug fix: duration calc used only transcript end-time, over-counting when speech starts late in a long streaming session (fixes #18520). Root cause stated, scoped diff (34 lines), test added, CI green, confirmed still broken on main. 5/5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #18520: Conversation duration shown inflated in app when speech occurs late in a continuous streaming session.
Problem & Root Cause
In
app/lib/backend/schema/conversation.dart:693-705,_getDurationInSecondsByTranscripts()calculated duration solely aslastEndTime = segment.end.When speech occurs 38 minutes into a 40-minute continuous streaming session, the STT segments have timestamps reflecting stream offsets (e.g.
start: 2299.0, end: 2431.0)._getDurationInSecondsByTranscripts()tooklastEndTime(2431s = 40m 31s), causing the conversation header to display 40+ minutes even though the audio recording was only 2:12 (132s = 2431 - 2299).PR #7528 intended to compute phone-app duration from the transcript instead of the session timestamp delta, but all of its tests initialized segments with
start: 0.0, missing streaming session offsets entirely.Fix
Compute the transcript speech span as
lastEndTime - firstStartTime(with non-negative clamping) across the conversation's transcript segments. When speech starts at 0, existing behavior is preserved (lastEndTime - 0 = lastEndTime). When speech starts at an offset into the stream, the duration accurately reflects the speech duration (lastEndTime - firstStartTime), matching the audio player.Failure Class
Failure-Class: FC-capture-session-window-read-as-content-duration
Verification
app/test/unit/conversation_duration_test.dartreproducing the reported defect with offset segments (start: 2299.0, end: 2431.0).flutter test test/unit/conversation_duration_test.dart).flutter test test/parity/parity_contracts_test.dart test/widgets/conversation_detail_ux_test.dart).flutter analyze.PayPal: [email protected]