fix: timestamp say transcripts at speech start - #2421
Merged
Conversation
🦋 Changeset detectedLatest commit: 383a872 The changes in this PR will be included in the next version bump. This PR includes changesets to release 38 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
chenghao-mou
approved these changes
Sep 4, 2026
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.
Ports livekit/agents#7110.
Interrupted
session.say()transcripts now use the speech-start timestamp instead of commit time, preserving chronological chat context when a user interrupts an assistant turn that has already started.Source diff coverage
livekit-agents/livekit/agents/voice/agent_activity.py->agents/src/voice/agent_activity.ts. Set thesay()assistant messagecreatedAtfrom the recorded speech-start time, withDate.now()as the fallback. Adapted Python seconds to the target timestamp convention of milliseconds.tests/test_agent_session.py->agents/src/voice/agent_activity_interrupted_commit.test.ts. Ported the source regression scenario and assertions for an interrupted on-entersay(), chronologicalsystem/assistant/user/assistantordering, and equality between message creation and speech-start timestamps. agents-js lacks Python'sFakeActionstimeline harness, so the test uses a localAudioOutputfixture and direct synthesized frames; the timestamp assertion converts metrics seconds to message milliseconds.A patch changeset is included for
@livekit/agents.Validation:
pnpm test agents: 142 files passed, 2328 tests passed, 5 skippedpnpm --filter @livekit/agents buildpnpm --filter @livekit/agents lintpnpm exec prettier --check "agents/src/**/*.{ts,tsx,md,json}"pnpm build: 39 packages builtcue-clivoice validation attempted, but the configured LiveKit endpoint rejected the supplied API key with401 Unauthorized; the session was ended cleanly.Ported from livekit/agents#7110
Original PR description
Interrupted
session.say()transcripts used commit time, which let a user turn sort ahead of an assistant turn that had already started.Use speech-start time for the assistant message. This matches the native realtime path and preserves chronological chat context.
Fixes #7108.
Addresses AGT-3437
Initial prompt and agent context
Model: GPT-5.6