feat: improve realtime log detail UI with voice, transport, and audio tokens - #3336
Conversation
|
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughLogDetailView detects realtime turn logs via ChangesRealtime Log Detail View
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Confidence Score: 5/5UI-only change reading existing metadata fields for display; no data mutations, no new API calls, safe to merge. All changes are purely presentational. The helper functions handle unknown values gracefully with fallbacks, the isRealtimeTurn guard is a simple string equality check, and the audio token arithmetic is straightforward. The duplicated exclusion-key list is a future-maintenance concern but not a current defect. No files require special attention. Important Files Changed
Reviews (8): Last reviewed commit: "feat: improve realtime log detail UI wit..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ui/app/workspace/logs/sheets/logDetailView.tsx (1)
2847-2849:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate unsupported-type toast copy to include realtime in supported list.
copyRequestBodynow supports realtime turns, but the message still lists the old set of supported types.Suggested fix
- "Copy request body is only available for chat, responses, speech, text completion, and embedding requests", + "Copy request body is only available for chat, responses, realtime, speech, text completion, and embedding requests",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ui/app/workspace/logs/sheets/logDetailView.tsx` around lines 2847 - 2849, Update the unsupported-type toast message used when invoking copyRequestBody by adding "realtime" to the supported list; locate the toast.error call (the string currently: "Copy request body is only available for chat, responses, speech, text completion, and embedding requests") and modify the text to include "realtime" among the supported types (e.g., "...chat, responses, realtime, speech, text completion, and embedding requests").
🧹 Nitpick comments (1)
ui/app/workspace/logs/sheets/logDetailView.tsx (1)
1744-1756: ⚡ Quick winDeduplicate realtime metadata filtering to avoid drift.
The same exclusion list is duplicated in two filters. A single helper keeps behavior synchronized and reduces future regressions.
Suggested refactor
+ const hiddenRealtimeMetadataKeys = new Set([ + "realtime_session_id", + "provider_session_id", + "realtime_source", + "realtime_event_type", + "realtime_transport", + "realtime_voice", + "realtime", + ]); + const shouldShowMetadataKey = (key: string) => + key !== "isAsyncRequest" && + !(isRealtimeTurn && hiddenRealtimeMetadataKeys.has(key)); -Object.keys(log.metadata).filter((k) => { - if (k === "isAsyncRequest") return false; - if (isRealtimeTurn && [...].includes(k)) return false; - return true; -}).length > 0 +Object.keys(log.metadata).filter(shouldShowMetadataKey).length > 0 - .filter(([key]) => { - if (key === "isAsyncRequest") return false; - if (isRealtimeTurn && [...].includes(key)) return false; - return true; - }) + .filter(([key]) => shouldShowMetadataKey(key))Also applies to: 1763-1775
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ui/app/workspace/logs/sheets/logDetailView.tsx` around lines 1744 - 1756, The metadata filtering duplicates the same realtime exclusion list in two places; create a single helper (e.g., shouldShowMetadataKey(key: string, isRealtimeTurn: boolean) or filterMetadataKeys(metadata: Record<string, any>, isRealtimeTurn: boolean)) that encapsulates the logic (skip "isAsyncRequest" always; skip the realtime keys when isRealtimeTurn is true) and use that helper in place of both inline filters around log.metadata so behavior stays synchronized and easier to maintain (update the two occurrences that currently test isRealtimeTurn and the same array of realtime keys).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ui/app/workspace/logs/sheets/logDetailView.tsx`:
- Around line 825-836: The current rendering logic in the isRealtimeTurn Badge
(and similar mappings) treats any non-'websocket' realtime_transport as 'WebRTC'
and any non-'ei' source as 'Language Model', which can silently mislabel
unexpected values; update the logic in the Badge rendering that reads
log.metadata.realtime_transport and the source-to-label mapping to explicitly
handle known values (e.g., 'websocket' and 'webrtc' or 'ei') and otherwise
render the raw log.metadata value or a clear "Unknown" label; adjust the
conditional in the isRealtimeTurn Badge and the equivalent source-label code
paths to use explicit comparisons or a small switch/map so unknown values fall
through to the raw/Unknown display instead of being coerced to the other known
type.
- Around line 1299-1314: The two new copy controls inside LogEntryDetailsView
for realtime_session_id and provider_session_id need data-testid attributes so
E2E tests can target them; update the CopyInlineButton instances (and/or their
wrapping <span>) used where log.metadata.realtime_session_id and
log.metadata.provider_session_id are rendered to include distinct data-testid
values (e.g., data-testid="copy-realtime-session-id" and
data-testid="copy-provider-session-id") while keeping the components and label
props unchanged; ensure the change is applied in the JSX that renders
LogEntryDetailsView so tests can reliably select the interactive buttons.
- Around line 1453-1471: The derived token counts for the LogEntryDetailsView
entries "Input Text Tokens" and "Output Text Tokens" can become negative when
provider details are missing or partial; update the value calculations in the
LogEntryDetailsView instances (the ones computing from
log.token_usage?.prompt_tokens, prompt_tokens_details?.audio_tokens,
completion_tokens, completion_tokens_details?.audio_tokens, and
completion_tokens_details?.reasoning_tokens) to clamp results to a minimum of
zero (e.g., replace the raw subtraction with a non-negative expression such as
Math.max(0, ...)) so the UI never renders negative token values.
---
Outside diff comments:
In `@ui/app/workspace/logs/sheets/logDetailView.tsx`:
- Around line 2847-2849: Update the unsupported-type toast message used when
invoking copyRequestBody by adding "realtime" to the supported list; locate the
toast.error call (the string currently: "Copy request body is only available for
chat, responses, speech, text completion, and embedding requests") and modify
the text to include "realtime" among the supported types (e.g., "...chat,
responses, realtime, speech, text completion, and embedding requests").
---
Nitpick comments:
In `@ui/app/workspace/logs/sheets/logDetailView.tsx`:
- Around line 1744-1756: The metadata filtering duplicates the same realtime
exclusion list in two places; create a single helper (e.g.,
shouldShowMetadataKey(key: string, isRealtimeTurn: boolean) or
filterMetadataKeys(metadata: Record<string, any>, isRealtimeTurn: boolean)) that
encapsulates the logic (skip "isAsyncRequest" always; skip the realtime keys
when isRealtimeTurn is true) and use that helper in place of both inline filters
around log.metadata so behavior stays synchronized and easier to maintain
(update the two occurrences that currently test isRealtimeTurn and the same
array of realtime keys).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f1dd8e87-19a5-46bd-8bbb-c65dc3f25936
📒 Files selected for processing (1)
ui/app/workspace/logs/sheets/logDetailView.tsx
df8eea6 to
e7fe056
Compare
a1f9e56 to
3a8abed
Compare
357cbf4 to
15d4b2d
Compare
3a8abed to
7fe16ef
Compare
15d4b2d to
e6d5cd1
Compare
545fa8f to
c220792
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai resolve |
✅ Actions performedComments resolved and changes approved. |
e6d5cd1 to
6e910cd
Compare
c220792 to
9732a3b
Compare
6e910cd to
5e00d3f
Compare
9732a3b to
00bd645
Compare
Merge activity
|
The base branch was changed.
… tokens (#3336) ## Summary Improves the realtime log detail sheet view with voice, transport, session metadata, and audio token breakdown for realtime turns. ## Changes - **Realtime header badges**: Shows `WebSocket` or `WebRTC` transport badge and voice name badge (e.g. "marin", "alloy") when viewing realtime turn logs - **Voice hero stat**: The 5th hero stat card shows the configured voice and transport source for realtime turns instead of "Tools available" - **Realtime session details**: New section in Request Details shows Bifrost session ID, provider session ID (both with copy buttons), transport source, and trigger event type in mono font - **Audio token breakdown**: For realtime turns, the Tokens section always shows Input Text / Input Audio / Output Text / Output Audio token split with defaults of 0, plus reasoning tokens when > 0 - **Turn source labels**: Raw `"ei"` / `"lm"` metadata values now display as "Event Initiated" / "Language Model" - **Metadata deduplication**: Realtime-specific keys are excluded from the generic Metadata section to avoid showing them twice ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [ ] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test 1. Open the Bifrost UI and go to Logs 2. Open a realtime turn log entry 3. Verify: transport badge (WebSocket/WebRTC) and voice badge appear in the header 4. Verify: hero stat shows voice name with transport as sub-label 5. Verify: "Realtime Session" section shows session IDs, source, and trigger event 6. Verify: Tokens section shows audio/text token split 7. Verify: "More Details" metadata section doesn't duplicate realtime keys ## Screenshots/Recordings N/A ## Breaking changes - [ ] Yes - [x] No ## Related issues N/A ## Security considerations No security implications. UI-only changes reading existing metadata fields. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable
… tokens (#3336) ## Summary Improves the realtime log detail sheet view with voice, transport, session metadata, and audio token breakdown for realtime turns. ## Changes - **Realtime header badges**: Shows `WebSocket` or `WebRTC` transport badge and voice name badge (e.g. "marin", "alloy") when viewing realtime turn logs - **Voice hero stat**: The 5th hero stat card shows the configured voice and transport source for realtime turns instead of "Tools available" - **Realtime session details**: New section in Request Details shows Bifrost session ID, provider session ID (both with copy buttons), transport source, and trigger event type in mono font - **Audio token breakdown**: For realtime turns, the Tokens section always shows Input Text / Input Audio / Output Text / Output Audio token split with defaults of 0, plus reasoning tokens when > 0 - **Turn source labels**: Raw `"ei"` / `"lm"` metadata values now display as "Event Initiated" / "Language Model" - **Metadata deduplication**: Realtime-specific keys are excluded from the generic Metadata section to avoid showing them twice ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [ ] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test 1. Open the Bifrost UI and go to Logs 2. Open a realtime turn log entry 3. Verify: transport badge (WebSocket/WebRTC) and voice badge appear in the header 4. Verify: hero stat shows voice name with transport as sub-label 5. Verify: "Realtime Session" section shows session IDs, source, and trigger event 6. Verify: Tokens section shows audio/text token split 7. Verify: "More Details" metadata section doesn't duplicate realtime keys ## Screenshots/Recordings N/A ## Breaking changes - [ ] Yes - [x] No ## Related issues N/A ## Security considerations No security implications. UI-only changes reading existing metadata fields. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable
… tokens (#3336) ## Summary Improves the realtime log detail sheet view with voice, transport, session metadata, and audio token breakdown for realtime turns. ## Changes - **Realtime header badges**: Shows `WebSocket` or `WebRTC` transport badge and voice name badge (e.g. "marin", "alloy") when viewing realtime turn logs - **Voice hero stat**: The 5th hero stat card shows the configured voice and transport source for realtime turns instead of "Tools available" - **Realtime session details**: New section in Request Details shows Bifrost session ID, provider session ID (both with copy buttons), transport source, and trigger event type in mono font - **Audio token breakdown**: For realtime turns, the Tokens section always shows Input Text / Input Audio / Output Text / Output Audio token split with defaults of 0, plus reasoning tokens when > 0 - **Turn source labels**: Raw `"ei"` / `"lm"` metadata values now display as "Event Initiated" / "Language Model" - **Metadata deduplication**: Realtime-specific keys are excluded from the generic Metadata section to avoid showing them twice ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [ ] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test 1. Open the Bifrost UI and go to Logs 2. Open a realtime turn log entry 3. Verify: transport badge (WebSocket/WebRTC) and voice badge appear in the header 4. Verify: hero stat shows voice name with transport as sub-label 5. Verify: "Realtime Session" section shows session IDs, source, and trigger event 6. Verify: Tokens section shows audio/text token split 7. Verify: "More Details" metadata section doesn't duplicate realtime keys ## Screenshots/Recordings N/A ## Breaking changes - [ ] Yes - [x] No ## Related issues N/A ## Security considerations No security implications. UI-only changes reading existing metadata fields. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable

Summary
Improves the realtime log detail sheet view with voice, transport, session
metadata, and audio token breakdown for realtime turns.
Changes
WebSocketorWebRTCtransport badge andvoice name badge (e.g. "marin", "alloy") when viewing realtime turn logs
transport source for realtime turns instead of "Tools available"
session ID, provider session ID (both with copy buttons), transport source,
and trigger event type in mono font
Input Text / Input Audio / Output Text / Output Audio token split with
defaults of 0, plus reasoning tokens when > 0
"ei"/"lm"metadata values now display as"Event Initiated" / "Language Model"
generic Metadata section to avoid showing them twice
Type of change
Affected areas
How to test
header
event
Screenshots/Recordings
N/A
Breaking changes
Related issues
N/A
Security considerations
No security implications. UI-only changes reading existing metadata fields.
Checklist
docs/contributing/README.mdand followed the guidelines