Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
transcript delay (#2972)
Will Hutchinson13d18b88e02f
diff --git a/agents/transcription/transcriber.py b/agents/transcription/transcriber.pyindex 2b1865c1f4..1e5e56ec63 100644--- a/agents/transcription/transcriber.py+++ b/agents/transcription/transcriber.py@@ -3,7 +3,7 @@ import loggingimport osimport uuidfrom collections import Counter-from datetime import datetime, timezone+from datetime import datetime, timedelta, timezoneimport httpxfrom dotenv import load_dotenv@@ -70,6 +70,12 @@ class Transcriber(Agent):# Word counts per Deepgram speaker int, accumulated across final# transcripts inside a single user turn and cleared on turn completion.self._pending_speakers: Counter[int] = Counter()+ # Earliest speech-start and latest speech-end wall clocks observed+ # across FINAL transcripts within the current turn. Derived from+ # Deepgram word-level timing so segments line up with the audio+ # rather than the end-of-turn callback.+ self._pending_started_at: datetime | None = None+ self._pending_ended_at: datetime | None = None# Deepgram's speaker ints are only unique within one streaming session.# Namespace them with a nonce regenerated per Transcriber so a reconnect# doesn't silently merge two different humans under the same UUID.@@ -94,12 +100,33 @@ class Transcriber(Agent):event.type == stt_pkg.SpeechEventType.FINAL_TRANSCRIPT):alt = event.alternatives[0] if event.alternatives else None- for word in getattr(alt, "words", None) or ():- speaker = getattr(word, "speaker", None)- if speaker is None:- speaker = getattr(word, "speaker_id", None)- if speaker is not None:- self._pending_speakers[int(speaker)] += 1+ words = list(getattr(alt, "words", None) or ())+ if words:+ # Deepgram word.start/end are seconds relative to the STT+ # stream start; we don't expose that anchor here. Pin+ # speech_end to "now" (FINAL arrives ~immediately after+ # speech ends + endpointing) and back-calculate the start+ # from the word-span duration.+ speech_end = datetime.now(timezone.utc)+ span = max(words[-1].end - words[0].start, 0.0)+ speech_start = speech_end - timedelta(seconds=span)+ if (+ self._pending_started_at is None+ or speech_start < self._pending_started_at+ ):+ self._pending_started_at = speech_start+ if (+ self._pending_ended_at is None+ or speech_end > self._pending_ended_at+ ):+ self._pending_ended_at = speech_end++ for word in words:+ speaker = getattr(word, "speaker", None)+ if speaker is None:+ speaker = getattr(word, "speaker_id", None)+ if speaker is not None:+ self._pending_speakers[int(speaker)] += 1yield eventasync def on_user_turn_completed(@@ -107,12 +134,11 @@ class Transcriber(Agent):):content = new_message.text_contentif content:- message_time = datetime.now(timezone.utc)- if new_message.created_at is not None:- message_time = datetime.fromtimestamp(- new_message.created_at, tz=timezone.utc- )- timestamp = message_time.isoformat()+ now = datetime.now(timezone.utc)+ started_at = self._pending_started_at or now+ ended_at = self._pending_ended_at or now+ self._pending_started_at = None+ self._pending_ended_at = Noneextra = new_message.extra if isinstance(new_message.extra, dict) else {}source_id = (@@ -121,7 +147,8 @@ class Transcriber(Agent):or new_message.id)segment_seed = (- f"{self.channel_id}:{self.participant_identity}:{source_id}:{timestamp}"+ f"{self.channel_id}:{self.participant_identity}:{source_id}:"+ f"{started_at.isoformat()}")segment_id = str(uuid.uuid5(uuid.NAMESPACE_URL, segment_seed))@@ -136,8 +163,8 @@ class Transcriber(Agent):"speakerId": self.participant_identity,"diarizedSpeakerId": diarized_speaker_id,"content": content,- "startedAt": timestamp,- "endedAt": timestamp,+ "startedAt": started_at.isoformat(),+ "endedAt": ended_at.isoformat(),"isFinal": True,}max_attempts = 3diff --git a/js/app/packages/block-call/component/CallRecording/CallRecordingBody.tsx b/js/app/packages/block-call/component/CallRecording/CallRecordingBody.tsxindex c69170e2f6..59de6463b6 100644--- a/js/app/packages/block-call/component/CallRecording/CallRecordingBody.tsx+++ b/js/app/packages/block-call/component/CallRecording/CallRecordingBody.tsx@@ -43,8 +43,15 @@ export function CallRecordingBody(props: {sortTranscriptSegments(record().transcript));+ // Anchor transcript-to-audio sync to the recording's actual start when+ // available. `startedAt` is call-creation time; the room composite egress+ // starts a few seconds later, so using `startedAt` makes the audio+ // appear to lag the transcript on every segment. `recordingStartedAt`+ // (captured from the LiveKit `egress_started` webhook) is the encoder's+ // true t=0. Falls back to `startedAt` for older records.const timelineStartMs = createMemo(() => {- const ms = new Date(record().startedAt).getTime();+ const anchor = record().recordingStartedAt ?? record().startedAt;+ const ms = new Date(anchor).getTime();return Number.isFinite(ms) ? ms : null;});diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.tsindex 2d8a9a28d8..c4f7b7402f 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts@@ -10,6 +10,7 @@ import type { CallRecordDurationMs } from './callRecordDurationMs';import type { CallRecordEgressId } from './callRecordEgressId';import type { CallRecordEndedAt } from './callRecordEndedAt';import type { CallRecordParticipant } from './callRecordParticipant';+import type { CallRecordRecordingStartedAt } from './callRecordRecordingStartedAt';import type { CallRecordRecordingUrl } from './callRecordRecordingUrl';import type { CallRecordSummary } from './callRecordSummary';import type { CallRecordTranscriptSegment } from './callRecordTranscriptSegment';@@ -40,6 +41,11 @@ archived `call_records`; active calls always return `None`. */isActive: boolean;/** Participants (both active and historic). */participants: CallRecordParticipant[];+ /** When the egress recording actually began. `None` until the+`egress_started` webhook arrives (typically a few seconds after+`started_at`). Frontend should anchor transcript-to-audio sync to+this value when present, falling back to `started_at` otherwise. */+ recordingStartedAt?: CallRecordRecordingStartedAt;/** Presigned URL for the call recording, if available. */recordingUrl?: CallRecordRecordingUrl;/** The RTC room name. */diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecordRecordingStartedAt.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordRecordingStartedAt.tsnew file mode 100644index 0000000000..756381b213--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordRecordingStartedAt.ts@@ -0,0 +1,14 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * When the egress recording actually began. `None` until the+`egress_started` webhook arrives (typically a few seconds after+`started_at`). Frontend should anchor transcript-to-audio sync to+this value when present, falling back to `started_at` otherwise.+ */+export type CallRecordRecordingStartedAt = string | null;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.tsindex faea8406aa..f0892c6320 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts@@ -99,6 +99,7 @@ export * from './callRecordPreviewOneOfAllOfType';export * from './callRecordPreviewOneOfFour';export * from './callRecordPreviewOneOfFourAllOf';export * from './callRecordPreviewOneOfFourAllOfType';+export * from './callRecordRecordingStartedAt';export * from './callRecordRecordingUrl';export * from './callRecordSummary';export * from './callRecordTranscriptSegment';diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 41517af322..d77587917a 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -939,6 +939,12 @@ export const getCallRecordResponse = zod)).describe('Participants (both active and historic).'),+ recordingStartedAt: zod.iso+ .datetime({})+ .nullish()+ .describe(+ 'When the egress recording actually began. `None` until the\n`egress_started` webhook arrives (typically a few seconds after\n`started_at`). Frontend should anchor transcript-to-audio sync to\nthis value when present, falling back to `started_at` otherwise.'+ ),recordingUrl: zod.string().nullish()@@ -10068,14 +10074,14 @@ export const createViewHandlerResponse = zod.object({userId: zod.string(),});-export const deleteViewHandlerParams = zod.object({- saved_view_id: zod.string().describe('The id of the saved view to delete'),-});-export const excludeDefaultViewHandlerBody = zod.object({defaultViewId: zod.string(),});+export const deleteViewHandlerParams = zod.object({+ saved_view_id: zod.string().describe('The id of the saved view to delete'),+});+export const patchViewHandlerParams = zod.object({saved_view_id: zod.string().describe('The id of the saved view to patch'),});diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex 47e26060a7..84b805cd2a 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -5137,21 +5137,22 @@}}}- },- "delete": {+ }+ },+ "/saved_views/exclude_default": {+ "post": {"tags": ["saved_views"],- "operationId": "delete_view_handler",- "parameters": [- {- "name": "saved_view_id",- "in": "path",- "description": "The id of the saved view to delete",- "required": true,- "schema": {- "type": "string"+ "operationId": "exclude_default_view_handler",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ExcludeDefaultViewRequest"+ }}- }- ],+ },+ "required": true+ },"responses": {"200": {"description": ""@@ -5179,20 +5180,21 @@}}},- "/saved_views/exclude_default": {- "post": {+ "/saved_views/{saved_view_id}": {+ "delete": {"tags": ["saved_views"],- "operationId": "exclude_default_view_handler",- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/ExcludeDefaultViewRequest"- }+ "operationId": "delete_view_handler",+ "parameters": [+ {+ "name": "saved_view_id",+ "in": "path",+ "description": "The id of the saved view to delete",+ "required": true,+ "schema": {+ "type": "string"}- },- "required": true- },+ }+ ],"responses": {"200": {"description": ""@@ -5218,9 +5220,7 @@}}}- }- },- "/saved_views/{saved_view_id}": {+ },"patch": {"tags": ["saved_views"],"operationId": "patch_view_handler",@@ -6473,6 +6473,11 @@},"description": "Participants (both active and historic)."},+ "recordingStartedAt": {+ "type": ["string", "null"],+ "format": "date-time",+ "description": "When the egress recording actually began. `None` until the\n`egress_started` webhook arrives (typically a few seconds after\n`started_at`). Frontend should anchor transcript-to-audio sync to\nthis value when present, falling back to `started_at` otherwise."+ },"recordingUrl": {"type": ["string", "null"],"description": "Presigned URL for the call recording, if available."diff --git a/rust/cloud-storage/.sqlx/query-099d5a355490ebd8fe221bc0526af0a38305c090cdb791212b5968c24ae5d5f4.json b/rust/cloud-storage/.sqlx/query-099d5a355490ebd8fe221bc0526af0a38305c090cdb791212b5968c24ae5d5f4.jsonnew file mode 100644index 0000000000..6f547edaa0--- /dev/null+++ b/rust/cloud-storage/.sqlx/query-099d5a355490ebd8fe221bc0526af0a38305c090cdb791212b5968c24ae5d5f4.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE calls\n SET recording_started_at = $2\n WHERE egress_id = $1\n AND recording_started_at IS NULL\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Timestamptz"+ ]+ },+ "nullable": []+ },+ "hash": "099d5a355490ebd8fe221bc0526af0a38305c090cdb791212b5968c24ae5d5f4"+}diff --git a/rust/cloud-storage/.sqlx/query-b514f8481c5d7b865fd3265fd927a9bb5855eb01eb33f90137e7685573b3be8e.json b/rust/cloud-storage/.sqlx/query-3ed1f15b83384be34f4adf83a0f701620481dc4ad81853451add8d1bb7dfe7da.jsonsimilarity index 75%rename from rust/cloud-storage/.sqlx/query-b514f8481c5d7b865fd3265fd927a9bb5855eb01eb33f90137e7685573b3be8e.jsonrename to rust/cloud-storage/.sqlx/query-3ed1f15b83384be34f4adf83a0f701620481dc4ad81853451add8d1bb7dfe7da.jsonindex b847a27cd8..492643cce7 100644--- a/rust/cloud-storage/.sqlx/query-b514f8481c5d7b865fd3265fd927a9bb5855eb01eb33f90137e7685573b3be8e.json+++ b/rust/cloud-storage/.sqlx/query-3ed1f15b83384be34f4adf83a0f701620481dc4ad81853451add8d1bb7dfe7da.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, share_permission_id, share_with_team\n FROM calls\n WHERE id = $1\n FOR UPDATE\n ",+ "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, recording_started_at, share_permission_id, share_with_team\n FROM calls\n WHERE id = $1\n FOR UPDATE\n ","describe": {"columns": [{@@ -40,11 +40,16 @@},{"ordinal": 7,+ "name": "recording_started_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,"name": "share_permission_id","type_info": "Text"},{- "ordinal": 8,+ "ordinal": 9,"name": "share_with_team","type_info": "Bool"}@@ -62,9 +67,10 @@false,true,true,+ true,false,false]},- "hash": "b514f8481c5d7b865fd3265fd927a9bb5855eb01eb33f90137e7685573b3be8e"+ "hash": "3ed1f15b83384be34f4adf83a0f701620481dc4ad81853451add8d1bb7dfe7da"}diff --git a/rust/cloud-storage/.sqlx/query-573a66f6ce27f28db10933bb330aa7edfb6bc776504942fd6f5ab4302a49a857.json b/rust/cloud-storage/.sqlx/query-573a66f6ce27f28db10933bb330aa7edfb6bc776504942fd6f5ab4302a49a857.jsonnew file mode 100644index 0000000000..3d3519dd4d--- /dev/null+++ b/rust/cloud-storage/.sqlx/query-573a66f6ce27f28db10933bb330aa7edfb6bc776504942fd6f5ab4302a49a857.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE call_records\n SET recording_started_at = $2\n WHERE egress_id = $1\n AND recording_started_at IS NULL\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Timestamptz"+ ]+ },+ "nullable": []+ },+ "hash": "573a66f6ce27f28db10933bb330aa7edfb6bc776504942fd6f5ab4302a49a857"+}diff --git a/rust/cloud-storage/.sqlx/query-49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4.json b/rust/cloud-storage/.sqlx/query-5c2fdb7637f08974099f179223cfd6c084c78e83cbfc53c24d973a12dc50fd17.jsonsimilarity index 63%rename from rust/cloud-storage/.sqlx/query-49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4.jsonrename to rust/cloud-storage/.sqlx/query-5c2fdb7637f08974099f179223cfd6c084c78e83cbfc53c24d973a12dc50fd17.jsonindex d4bb853016..97f5839323 100644--- a/rust/cloud-storage/.sqlx/query-49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4.json+++ b/rust/cloud-storage/.sqlx/query-5c2fdb7637f08974099f179223cfd6c084c78e83cbfc53c24d973a12dc50fd17.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, share_permission_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\n ",+ "query": "\n INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, recording_started_at, share_permission_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)\n ","describe": {"columns": [],"parameters": {@@ -14,10 +14,11 @@"Int8","Text","Text",+ "Timestamptz","Text"]},"nullable": []},- "hash": "49400f2746959327b8cc5acbb374d0073864a1b684752aa2c442ca873fa969d4"+ "hash": "5c2fdb7637f08974099f179223cfd6c084c78e83cbfc53c24d973a12dc50fd17"}diff --git a/rust/cloud-storage/.sqlx/query-4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558.json b/rust/cloud-storage/.sqlx/query-626f582f62f31f4e1ad7fe155af220675ece4abffb0e2f3d0435199827900624.jsonsimilarity index 82%rename from rust/cloud-storage/.sqlx/query-4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558.jsonrename to rust/cloud-storage/.sqlx/query-626f582f62f31f4e1ad7fe155af220675ece4abffb0e2f3d0435199827900624.jsonindex c19d97b116..3eba84ad53 100644--- a/rust/cloud-storage/.sqlx/query-4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558.json+++ b/rust/cloud-storage/.sqlx/query-626f582f62f31f4e1ad7fe155af220675ece4abffb0e2f3d0435199827900624.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, custom_name, summary\n FROM call_records\n WHERE id = $1\n ",+ "query": "\n SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, recording_started_at, custom_name, summary\n FROM call_records\n WHERE id = $1\n ","describe": {"columns": [{@@ -50,11 +50,16 @@},{"ordinal": 9,+ "name": "recording_started_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,"name": "custom_name","type_info": "Text"},{- "ordinal": 10,+ "ordinal": 11,"name": "summary","type_info": "Text"}@@ -75,8 +80,9 @@true,true,true,+ true,true]},- "hash": "4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558"+ "hash": "626f582f62f31f4e1ad7fe155af220675ece4abffb0e2f3d0435199827900624"}diff --git a/rust/cloud-storage/.sqlx/query-886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5.json b/rust/cloud-storage/.sqlx/query-6d1cee49d39040d520161e32305111731ff89b4c279c24101875afaaa6cceeee.jsonsimilarity index 74%rename from rust/cloud-storage/.sqlx/query-886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5.jsonrename to rust/cloud-storage/.sqlx/query-6d1cee49d39040d520161e32305111731ff89b4c279c24101875afaaa6cceeee.jsonindex 714cf48238..e5f41785cf 100644--- a/rust/cloud-storage/.sqlx/query-886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5.json+++ b/rust/cloud-storage/.sqlx/query-6d1cee49d39040d520161e32305111731ff89b4c279c24101875afaaa6cceeee.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key\n FROM calls\n WHERE id = $1\n ",+ "query": "\n SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, recording_started_at\n FROM calls\n WHERE id = $1\n ","describe": {"columns": [{@@ -37,6 +37,11 @@"ordinal": 6,"name": "recording_key","type_info": "Text"+ },+ {+ "ordinal": 7,+ "name": "recording_started_at",+ "type_info": "Timestamptz"}],"parameters": {@@ -51,8 +56,9 @@false,false,true,+ true,true]},- "hash": "886275b4d23bf6206967bdcf78fb244dfa038f9cef7190a9893ae3ba3207f7a5"+ "hash": "6d1cee49d39040d520161e32305111731ff89b4c279c24101875afaaa6cceeee"}diff --git a/rust/cloud-storage/.sqlx/query-01807869314da98fb35b92299c5bc1316bc32d77d88903d294f90c0593ff6f83.json b/rust/cloud-storage/.sqlx/query-83c08cb37967db1ed7bdeea17cc5d764bd5f1e87d6cce7734b5758c5a82dd84a.jsonsimilarity index 53%rename from rust/cloud-storage/.sqlx/query-01807869314da98fb35b92299c5bc1316bc32d77d88903d294f90c0593ff6f83.jsonrename to rust/cloud-storage/.sqlx/query-83c08cb37967db1ed7bdeea17cc5d764bd5f1e87d6cce7734b5758c5a82dd84a.jsonindex 1715935331..eaf871b3b1 100644--- a/rust/cloud-storage/.sqlx/query-01807869314da98fb35b92299c5bc1316bc32d77d88903d294f90c0593ff6f83.json+++ b/rust/cloud-storage/.sqlx/query-83c08cb37967db1ed7bdeea17cc5d764bd5f1e87d6cce7734b5758c5a82dd84a.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n WITH user_source_ids AS (\n SELECT cp.channel_id::text AS source_id\n FROM comms_channel_participants cp\n WHERE cp.user_id = $1 AND cp.left_at IS NULL\n UNION ALL\n SELECT t.team_id::text AS source_id\n FROM team_user t\n WHERE t.user_id = $1\n UNION ALL\n SELECT $1 AS source_id\n )\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\",\n NULL::bigint as \"duration_ms\",\n egress_id,\n recording_key,\n NULL::text as \"custom_name\",\n NULL::text as \"summary\",\n true as \"is_active!\"\n FROM calls c\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = c.id\n AND ea.entity_type = 'call'\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_participants cp\n WHERE cp.call_id = c.id AND cp.user_id = $1\n ) = $5)\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\",\n duration_ms as \"duration_ms\",\n egress_id,\n recording_key,\n custom_name,\n summary,\n false as \"is_active!\"\n FROM call_records cr\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = cr.id\n AND ea.entity_type = 'call'\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_record_participants crp\n WHERE crp.call_record_id = cr.id AND crp.user_id = $1\n ) = $5)\n ORDER BY \"started_at!\" DESC\n LIMIT $2\n ",+ "query": "\n WITH user_source_ids AS (\n SELECT cp.channel_id::text AS source_id\n FROM comms_channel_participants cp\n WHERE cp.user_id = $1 AND cp.left_at IS NULL\n UNION ALL\n SELECT t.team_id::text AS source_id\n FROM team_user t\n WHERE t.user_id = $1\n UNION ALL\n SELECT $1 AS source_id\n )\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\",\n NULL::bigint as \"duration_ms\",\n egress_id,\n recording_key,\n recording_started_at,\n NULL::text as \"custom_name\",\n NULL::text as \"summary\",\n true as \"is_active!\"\n FROM calls c\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = c.id\n AND ea.entity_type = 'call'\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_participants cp\n WHERE cp.call_id = c.id AND cp.user_id = $1\n ) = $5)\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\",\n duration_ms as \"duration_ms\",\n egress_id,\n recording_key,\n recording_started_at,\n custom_name,\n summary,\n false as \"is_active!\"\n FROM call_records cr\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = cr.id\n AND ea.entity_type = 'call'\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_record_participants crp\n WHERE crp.call_record_id = cr.id AND crp.user_id = $1\n ) = $5)\n ORDER BY \"started_at!\" DESC\n LIMIT $2\n ","describe": {"columns": [{@@ -50,16 +50,21 @@},{"ordinal": 9,+ "name": "recording_started_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,"name": "custom_name","type_info": "Text"},{- "ordinal": 10,+ "ordinal": 11,"name": "summary","type_info": "Text"},{- "ordinal": 11,+ "ordinal": 12,"name": "is_active!","type_info": "Bool"}@@ -85,8 +90,9 @@null,null,null,+ null,null]},- "hash": "01807869314da98fb35b92299c5bc1316bc32d77d88903d294f90c0593ff6f83"+ "hash": "83c08cb37967db1ed7bdeea17cc5d764bd5f1e87d6cce7734b5758c5a82dd84a"}diff --git a/rust/cloud-storage/.sqlx/query-857e3e97e49256afa01fd4e85422b8da87b62a601b26889c719cd8b2ec7de5c6.json b/rust/cloud-storage/.sqlx/query-857e3e97e49256afa01fd4e85422b8da87b62a601b26889c719cd8b2ec7de5c6.jsondeleted file mode 100644index bbcf3ebde3..0000000000--- a/rust/cloud-storage/.sqlx/query-857e3e97e49256afa01fd4e85422b8da87b62a601b26889c719cd8b2ec7de5c6.json+++ /dev/null@@ -1,69 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n m.id,\n m.channel_id,\n m.sender_id,\n m.content,\n m.created_at,\n m.updated_at,\n m.edited_at::timestamptz AS \"edited_at?\",\n m.deleted_at::timestamptz AS \"deleted_at?\"\n FROM comms_messages m\n WHERE m.channel_id = $1\n AND m.thread_id IS NULL\n AND (m.deleted_at IS NULL OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id AND r.deleted_at IS NULL\n ))\n AND ($2::timestamptz IS NOT NULL AND (m.created_at, m.id) > ($2, $3))\n AND ($5::uuid[] IS NULL OR m.id = ANY($5))\n AND ($6::timestamptz IS NULL OR (\n m.created_at > $6\n OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id\n AND r.deleted_at IS NULL\n AND r.created_at > $6\n )\n ))\n ORDER BY m.created_at ASC, m.id ASC\n LIMIT $4\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "edited_at?",- "type_info": "Timestamptz"- },- {- "ordinal": 7,- "name": "deleted_at?",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid",- "Timestamptz",- "Uuid",- "Int8",- "UuidArray",- "Timestamptz"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- null,- null- ]- },- "hash": "857e3e97e49256afa01fd4e85422b8da87b62a601b26889c719cd8b2ec7de5c6"-}diff --git a/rust/cloud-storage/.sqlx/query-ead66ab8a55df78540bbffc0a015014c2d067de3deb1f9b155cc87376277798f.json b/rust/cloud-storage/.sqlx/query-ead66ab8a55df78540bbffc0a015014c2d067de3deb1f9b155cc87376277798f.jsondeleted file mode 100644index 75eabe0696..0000000000--- a/rust/cloud-storage/.sqlx/query-ead66ab8a55df78540bbffc0a015014c2d067de3deb1f9b155cc87376277798f.json+++ /dev/null@@ -1,69 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n m.id,\n m.channel_id,\n m.sender_id,\n m.content,\n m.created_at,\n m.updated_at,\n m.edited_at::timestamptz AS \"edited_at?\",\n m.deleted_at::timestamptz AS \"deleted_at?\"\n FROM comms_messages m\n WHERE m.channel_id = $1\n AND m.thread_id IS NULL\n AND (m.deleted_at IS NULL OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id AND r.deleted_at IS NULL\n ))\n AND ($2::timestamptz IS NULL OR (m.created_at, m.id) < ($2, $3))\n AND ($5::uuid[] IS NULL OR m.id = ANY($5))\n AND ($6::timestamptz IS NULL OR (\n m.created_at > $6\n OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id\n AND r.deleted_at IS NULL\n AND r.created_at > $6\n )\n ))\n ORDER BY m.created_at DESC, m.id DESC\n LIMIT $4\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "edited_at?",- "type_info": "Timestamptz"- },- {- "ordinal": 7,- "name": "deleted_at?",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid",- "Timestamptz",- "Uuid",- "Int8",- "UuidArray",- "Timestamptz"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- null,- null- ]- },- "hash": "ead66ab8a55df78540bbffc0a015014c2d067de3deb1f9b155cc87376277798f"-}diff --git a/rust/cloud-storage/.sqlx/query-ec5e416378f73f769e797d9affa95f4dcc98ea607f84993efd70313e3b8b7d4f.json b/rust/cloud-storage/.sqlx/query-ec5e416378f73f769e797d9affa95f4dcc98ea607f84993efd70313e3b8b7d4f.jsondeleted file mode 100644index b17ca020dc..0000000000--- a/rust/cloud-storage/.sqlx/query-ec5e416378f73f769e797d9affa95f4dcc98ea607f84993efd70313e3b8b7d4f.json+++ /dev/null@@ -1,72 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n WITH done_top_level AS (\n SELECT DISTINCT COALESCE(msg.thread_id, msg.id) AS top_level_id\n FROM notification n\n JOIN user_notification un ON un.notification_id = n.id\n JOIN comms_messages msg ON msg.id = (n.metadata->>'messageId')::uuid\n WHERE $8::bool IS NOT NULL\n AND un.user_id = $7::text\n AND un.deleted_at IS NULL\n AND un.done = $8\n AND n.event_item_type = 'channel'\n AND n.event_item_id = $1::uuid::text\n AND n.metadata->>'messageId' IS NOT NULL\n AND msg.channel_id = $1\n AND msg.deleted_at IS NULL\n ),\n seen_top_level AS (\n SELECT DISTINCT COALESCE(msg.thread_id, msg.id) AS top_level_id\n FROM notification n\n JOIN user_notification un ON un.notification_id = n.id\n JOIN comms_messages msg ON msg.id = (n.metadata->>'messageId')::uuid\n WHERE $9::bool IS NOT NULL\n AND un.user_id = $7::text\n AND un.deleted_at IS NULL\n AND (un.seen_at IS NOT NULL) = $9\n AND n.event_item_type = 'channel'\n AND n.event_item_id = $1::uuid::text\n AND n.metadata->>'messageId' IS NOT NULL\n AND msg.channel_id = $1\n AND msg.deleted_at IS NULL\n )\n SELECT\n m.id,\n m.channel_id,\n m.sender_id,\n m.content,\n m.created_at,\n m.updated_at,\n m.edited_at::timestamptz AS \"edited_at?\",\n m.deleted_at::timestamptz AS \"deleted_at?\"\n FROM comms_messages m\n WHERE m.channel_id = $1\n AND m.thread_id IS NULL\n AND (m.deleted_at IS NULL OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id AND r.deleted_at IS NULL\n ))\n AND ($2::timestamptz IS NOT NULL AND (m.created_at, m.id) > ($2, $3))\n AND ($5::uuid[] IS NULL OR m.id = ANY($5))\n AND ($6::timestamptz IS NULL OR (\n m.created_at > $6\n OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id\n AND r.deleted_at IS NULL\n AND r.created_at > $6\n )\n ))\n AND ($8::bool IS NULL OR EXISTS (\n SELECT 1 FROM done_top_level dt\n WHERE dt.top_level_id = m.id\n ))\n AND ($9::bool IS NULL OR EXISTS (\n SELECT 1 FROM seen_top_level st\n WHERE st.top_level_id = m.id\n ))\n ORDER BY m.created_at ASC, m.id ASC\n LIMIT $4\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "edited_at?",- "type_info": "Timestamptz"- },- {- "ordinal": 7,- "name": "deleted_at?",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid",- "Timestamptz",- "Uuid",- "Int8",- "UuidArray",- "Timestamptz",- "Text",- "Bool",- "Bool"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- null,- null- ]- },- "hash": "ec5e416378f73f769e797d9affa95f4dcc98ea607f84993efd70313e3b8b7d4f"-}diff --git a/rust/cloud-storage/.sqlx/query-fb06661528090b1781ae1f2bad6be9dd410315f4f4f376429d9f9e2e3c822383.json b/rust/cloud-storage/.sqlx/query-fb06661528090b1781ae1f2bad6be9dd410315f4f4f376429d9f9e2e3c822383.jsondeleted file mode 100644index 8bd9568af3..0000000000--- a/rust/cloud-storage/.sqlx/query-fb06661528090b1781ae1f2bad6be9dd410315f4f4f376429d9f9e2e3c822383.json+++ /dev/null@@ -1,72 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n WITH done_top_level AS (\n SELECT DISTINCT COALESCE(msg.thread_id, msg.id) AS top_level_id\n FROM notification n\n JOIN user_notification un ON un.notification_id = n.id\n JOIN comms_messages msg ON msg.id = (n.metadata->>'messageId')::uuid\n WHERE $8::bool IS NOT NULL\n AND un.user_id = $7::text\n AND un.deleted_at IS NULL\n AND un.done = $8\n AND n.event_item_type = 'channel'\n AND n.event_item_id = $1::uuid::text\n AND n.metadata->>'messageId' IS NOT NULL\n AND msg.channel_id = $1\n AND msg.deleted_at IS NULL\n ),\n seen_top_level AS (\n SELECT DISTINCT COALESCE(msg.thread_id, msg.id) AS top_level_id\n FROM notification n\n JOIN user_notification un ON un.notification_id = n.id\n JOIN comms_messages msg ON msg.id = (n.metadata->>'messageId')::uuid\n WHERE $9::bool IS NOT NULL\n AND un.user_id = $7::text\n AND un.deleted_at IS NULL\n AND (un.seen_at IS NOT NULL) = $9\n AND n.event_item_type = 'channel'\n AND n.event_item_id = $1::uuid::text\n AND n.metadata->>'messageId' IS NOT NULL\n AND msg.channel_id = $1\n AND msg.deleted_at IS NULL\n )\n SELECT\n m.id,\n m.channel_id,\n m.sender_id,\n m.content,\n m.created_at,\n m.updated_at,\n m.edited_at::timestamptz AS \"edited_at?\",\n m.deleted_at::timestamptz AS \"deleted_at?\"\n FROM comms_messages m\n WHERE m.channel_id = $1\n AND m.thread_id IS NULL\n AND (m.deleted_at IS NULL OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id AND r.deleted_at IS NULL\n ))\n AND ($2::timestamptz IS NULL OR (m.created_at, m.id) < ($2, $3))\n AND ($5::uuid[] IS NULL OR m.id = ANY($5))\n AND ($6::timestamptz IS NULL OR (\n m.created_at > $6\n OR EXISTS (\n SELECT 1 FROM comms_messages r\n WHERE r.thread_id = m.id\n AND r.deleted_at IS NULL\n AND r.created_at > $6\n )\n ))\n AND ($8::bool IS NULL OR EXISTS (\n SELECT 1 FROM done_top_level dt\n WHERE dt.top_level_id = m.id\n ))\n AND ($9::bool IS NULL OR EXISTS (\n SELECT 1 FROM seen_top_level st\n WHERE st.top_level_id = m.id\n ))\n ORDER BY m.created_at DESC, m.id DESC\n LIMIT $4\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "sender_id",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "content",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "created_at",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "edited_at?",- "type_info": "Timestamptz"- },- {- "ordinal": 7,- "name": "deleted_at?",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "Uuid",- "Timestamptz",- "Uuid",- "Int8",- "UuidArray",- "Timestamptz",- "Text",- "Bool",- "Bool"- ]- },- "nullable": [- false,- false,- false,- false,- false,- false,- null,- null- ]- },- "hash": "fb06661528090b1781ae1f2bad6be9dd410315f4f4f376429d9f9e2e3c822383"-}diff --git a/rust/cloud-storage/call/src/domain/models.rs b/rust/cloud-storage/call/src/domain/models.rsindex 8196164195..4ecfc0d246 100644--- a/rust/cloud-storage/call/src/domain/models.rs+++ b/rust/cloud-storage/call/src/domain/models.rs@@ -256,6 +256,11 @@ pub struct CallRecord {pub duration_ms: Option<i64>,/// Recording egress ID, if any.pub egress_id: Option<String>,+ /// When the egress recording actually began. `None` until the+ /// `egress_started` webhook arrives (typically a few seconds after+ /// `started_at`). Frontend should anchor transcript-to-audio sync to+ /// this value when present, falling back to `started_at` otherwise.+ pub recording_started_at: Option<DateTime<Utc>>,/// S3 object key for the call recording (internal, not serialized).#[serde(skip_serializing)]pub recording_key: Option<String>,diff --git a/rust/cloud-storage/call/src/domain/ports.rs b/rust/cloud-storage/call/src/domain/ports.rsindex 5ba3175d31..3fed141a02 100644--- a/rust/cloud-storage/call/src/domain/ports.rs+++ b/rust/cloud-storage/call/src/domain/ports.rs@@ -147,6 +147,17 @@ pub trait CallRepository: Send + Sync + 'static {recording_key: &str,) -> impl Future<Output = Result<bool, Self::Err>> + Send;+ /// Set `recording_started_at` on whichever row currently owns the egress —+ /// active `calls` first, then archived `call_records` — driven by the+ /// `egress_started` webhook. Idempotent: only sets the column when it is+ /// still `NULL` so a duplicate or retried webhook can't overwrite a+ /// previously captured start time.+ fn set_recording_started_at_by_egress_id(+ &self,+ egress_id: &str,+ started_at: chrono::DateTime<chrono::Utc>,+ ) -> impl Future<Output = Result<bool, Self::Err>> + Send;+/// Insert a transcript segment for an active call.fn create_transcript_segment(&self,diff --git a/rust/cloud-storage/call/src/domain/service.rs b/rust/cloud-storage/call/src/domain/service.rsindex a535f17ed3..ca49d22084 100644--- a/rust/cloud-storage/call/src/domain/service.rs+++ b/rust/cloud-storage/call/src/domain/service.rs@@ -718,6 +718,31 @@ impl<room_name = ?event.room_name,"egress event");+ // `egress_started` carries the wall-clock instant the encoder+ // actually began capturing. Persist it so the frontend can+ // anchor transcript-to-audio sync to the recording's true+ // origin instead of the call-creation timestamp (which lags+ // the recording start by the egress bootstrap window).+ if event.event == "egress_started" {+ if let Some(egress_id) = &event.egress_id {+ let started_at =+ chrono::DateTime::<chrono::Utc>::from_timestamp(event.created_at, 0);+ if let Some(started_at) = started_at {+ self.repo+ .set_recording_started_at_by_egress_id(egress_id, started_at)+ .await+ .map_err(|e| CallError::Internal(e.into()))?;+ } else {+ tracing::warn!(+ egress_id,+ created_at = event.created_at,+ "egress_started webhook had unparseable created_at",+ );+ }+ } else {+ tracing::warn!("egress_started webhook missing egress_id");+ }+ }}"egress_ended" => {let (Some(egress_id), Some(file_url)) = (&event.egress_id, &event.file_url) else {diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo.rsindex 41e99caef3..d5a90f39ea 100644--- a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs@@ -463,7 +463,7 @@ impl CallRepository for PgCallRepo {// Fetch and lock the active call so concurrent archive_call callers serialize.let call = sqlx::query!(r#"- SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, share_permission_id, share_with_team+ SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, recording_started_at, share_permission_id, share_with_teamFROM callsWHERE id = $1FOR UPDATE@@ -511,8 +511,8 @@ impl CallRepository for PgCallRepo {// The record keeps the same id as the original call.sqlx::query!(r#"- INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, share_permission_id)- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)+ INSERT INTO call_records (id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, recording_started_at, share_permission_id)+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)"#,call_id,call.channel_id,@@ -523,6 +523,7 @@ impl CallRepository for PgCallRepo {duration_ms,call.egress_id,call.recording_key,+ call.recording_started_at,&call.share_permission_id,).execute(tx.as_mut())@@ -621,6 +622,45 @@ impl CallRepository for PgCallRepo {Ok(result.rows_affected() > 0)}+ #[tracing::instrument(err, skip(self))]+ async fn set_recording_started_at_by_egress_id(+ &self,+ egress_id: &str,+ started_at: chrono::DateTime<chrono::Utc>,+ ) -> Result<bool, Self::Err> {+ let active = sqlx::query!(+ r#"+ UPDATE calls+ SET recording_started_at = $2+ WHERE egress_id = $1+ AND recording_started_at IS NULL+ "#,+ egress_id,+ started_at,+ )+ .execute(&self.pool)+ .await?;+ if active.rows_affected() > 0 {+ return Ok(true);+ }++ // Fall through: if the call already archived (rare race), persist on+ // the archived row instead.+ let archived = sqlx::query!(+ r#"+ UPDATE call_records+ SET recording_started_at = $2+ WHERE egress_id = $1+ AND recording_started_at IS NULL+ "#,+ egress_id,+ started_at,+ )+ .execute(&self.pool)+ .await?;+ Ok(archived.rows_affected() > 0)+ }+#[tracing::instrument(err, skip(self, segment))]async fn create_transcript_segment(&self,@@ -669,7 +709,7 @@ impl CallRepository for PgCallRepo {// Try active `calls` first.if let Some(active) = sqlx::query!(r#"- SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key+ SELECT id, channel_id, room_name, created_by, created_at, egress_id, recording_key, recording_started_atFROM callsWHERE id = $1"#,@@ -731,6 +771,7 @@ impl CallRepository for PgCallRepo {ended_at: None,duration_ms: None,egress_id: active.egress_id,+ recording_started_at: active.recording_started_at,recording_key: active.recording_key,recording_url: None,channel_name: None,@@ -745,7 +786,7 @@ impl CallRepository for PgCallRepo {// Fall back to archived `call_records`.let Some(archived) = sqlx::query!(r#"- SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, custom_name, summary+ SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, recording_started_at, custom_name, summaryFROM call_recordsWHERE id = $1"#,@@ -811,6 +852,7 @@ impl CallRepository for PgCallRepo {ended_at: Some(archived.ended_at),duration_ms: Some(archived.duration_ms),egress_id: archived.egress_id,+ recording_started_at: archived.recording_started_at,recording_key: archived.recording_key,recording_url: None,channel_name: None,@@ -953,6 +995,7 @@ impl CallRepository for PgCallRepo {NULL::bigint as "duration_ms",egress_id,recording_key,+ recording_started_at,NULL::text as "custom_name",NULL::text as "summary",true as "is_active!"@@ -979,6 +1022,7 @@ impl CallRepository for PgCallRepo {duration_ms as "duration_ms",egress_id,recording_key,+ recording_started_at,custom_name,summary,false as "is_active!"@@ -1058,6 +1102,7 @@ impl CallRepository for PgCallRepo {ended_at: row.ended_at,duration_ms: row.duration_ms,egress_id: row.egress_id,+ recording_started_at: row.recording_started_at,recording_key: row.recording_key,recording_url: None,channel_name: None,diff --git a/rust/cloud-storage/document_storage_service/src/api/saved_views.rs b/rust/cloud-storage/document_storage_service/src/api/saved_views.rsindex 08b70d769b..881bbafffa 100644--- a/rust/cloud-storage/document_storage_service/src/api/saved_views.rs+++ b/rust/cloud-storage/document_storage_service/src/api/saved_views.rs@@ -225,7 +225,7 @@ struct SavedViewParams {#[utoipa::path(tag = "saved_views",delete,- path = "/saved_views",+ path = "/saved_views/{saved_view_id}",params(("saved_view_id" = String, Path, description = "The id of the saved view to delete")),diff --git a/rust/cloud-storage/macro_db_client/migrations/20260430120000_call_recording_started_at.sql b/rust/cloud-storage/macro_db_client/migrations/20260430120000_call_recording_started_at.sqlnew file mode 100644index 0000000000..20827026c1--- /dev/null+++ b/rust/cloud-storage/macro_db_client/migrations/20260430120000_call_recording_started_at.sql@@ -0,0 +1,7 @@+-- Capture when the egress recording actually began so the frontend can+-- anchor transcript-to-audio sync against the real recording start (which+-- lags call creation by the LiveKit egress bootstrap window) rather than+-- against `started_at` (call creation time).++ALTER TABLE calls ADD COLUMN recording_started_at TIMESTAMPTZ;+ALTER TABLE call_records ADD COLUMN recording_started_at TIMESTAMPTZ;diff --git a/rust/cloud-storage/models_soup/src/call_record/test.rs b/rust/cloud-storage/models_soup/src/call_record/test.rsindex 6a03945052..9fd799e074 100644--- a/rust/cloud-storage/models_soup/src/call_record/test.rs+++ b/rust/cloud-storage/models_soup/src/call_record/test.rs@@ -14,6 +14,7 @@ fn record_with_participants(user_ids: &[&str]) -> CallRecord {ended_at: None,duration_ms: None,egress_id: None,+ recording_started_at: None,recording_key: None,recording_url: None,channel_name: None,