feat(dashboard): improve audit log interactions - #658
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe audit conversation API now returns retained usage summaries. The dashboard reconstructs provider-specific conversations, calculates prompt-cache coverage, preserves tool metadata, and renders configurable cache visualization and expandable tool details. ChangesAudit conversation usage and visualization
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant AdminClient
participant AuditConversation
participant ConversationDrawer
participant conversationHelpers
participant ChatMessage
AdminClient->>AuditConversation: request audit conversation
AuditConversation-->>AdminClient: return enriched entries and usage metadata
ConversationDrawer->>conversationHelpers: assemble conversation content
conversationHelpers-->>ConversationDrawer: return cache and tool metadata
ConversationDrawer->>ChatMessage: pass message and cache visibility
ChatMessage-->>ConversationDrawer: render conversation details
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@web/dashboard/src/pages/audit-logs/conversation-helpers.js`:
- Around line 98-104: Update measureToolCallPromptCache so it no longer calls
display-only formatFunctionArguments when calculating character counts. Add or
reuse a separate helper that measures original string arguments or compactly
serializes object arguments, while preserving the existing name and call-shape
accounting; keep formatFunctionArguments exclusively for display formatting.
🪄 Autofix
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: ASSERTIVE
Plan: Pro Plus
Run ID: 4dc18f7b-0462-4c78-a847-9d3e6af89b68
⛔ Files ignored due to path filters (4)
internal/admin/dashboard/static/dist/assets/index-BFUCi3g4.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/assets/index-BbSfRjie.cssis excluded by!**/dist/**internal/admin/dashboard/static/dist/assets/index-TuUpNQjY.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (9)
cmd/gomodel/docs/docs.godocs/openapi.jsoninternal/admin/handler.gointernal/admin/handler_audit.gointernal/admin/handler_test.goweb/dashboard/src/pages/audit-logs/ChatMessage.svelteweb/dashboard/src/pages/audit-logs/ConversationDrawer.svelteweb/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/tests/conversation-drawer.test.js
Confidence Score: 4/5The change should not merge until audit-log transcripts retain Anthropic-compatible tool invocations and results. A reproduced transcript correctness failure remains in the Responses input normalization path. Files Needing Attention: web/dashboard/src/pages/audit-logs/conversation-helpers.js
What T-Rex did
Comments Outside Diff (2)
Reviews (2): Last reviewed commit: "fix(dashboard): remove interactions butt..." | Re-trigger Greptile |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/dashboard/src/pages/audit-logs/conversation-helpers.js (1)
799-801: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDo not count attachment placeholders as prompt characters.
If a request contains only an image or file,
measurePromptCachereturnsnullbecauseextractTextSegmentsexcludes the attachment. This fallback then counts display-only text such as[Image].Distinguish an omitted measurement from an explicit zero-source measurement. Keep the fallback for response-history messages, but use
0whenpromptCache === null.Proposed fix
- const promptTextCharacters = promptCache && Number.isFinite(Number(promptCache.total)) - ? Math.max(0, Number(promptCache.total)) - : String(text || '').length; + const promptTextCharacters = promptCache && Number.isFinite(Number(promptCache.total)) + ? Math.max(0, Number(promptCache.total)) + : promptCache === null + ? 0 + : String(text || '').length;Add an image-only and file-only cache-fill regression test.
🤖 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 `@web/dashboard/src/pages/audit-logs/conversation-helpers.js` around lines 799 - 801, Update the prompt character calculation in the cache-fill helper using promptCache: preserve the numeric total when present, use 0 when promptCache is explicitly null (including image-only and file-only requests), and retain the text-length fallback only when the measurement is omitted. Add regression tests covering image-only and file-only cache fills.
🤖 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.
Outside diff comments:
In `@web/dashboard/src/pages/audit-logs/conversation-helpers.js`:
- Around line 799-801: Update the prompt character calculation in the cache-fill
helper using promptCache: preserve the numeric total when present, use 0 when
promptCache is explicitly null (including image-only and file-only requests),
and retain the text-length fallback only when the measurement is omitted. Add
regression tests covering image-only and file-only cache fills.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 59b1d12e-858a-4922-896f-fe2fd44f4b6f
⛔ Files ignored due to path filters (3)
internal/admin/dashboard/static/dist/assets/index-2f7HgGsV.cssis excluded by!**/dist/**internal/admin/dashboard/static/dist/assets/index-C-EPW_nz.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (3)
web/dashboard/src/pages/audit-logs/ConversationDrawer.svelteweb/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/tests/conversation-drawer.test.js
|
Reviewed the follow-up cache-placeholder finding and fixed it in e344a5a. Explicit zero-source measurements now remain zero, while omitted measurements still use the response-history fallback. Added image-only and file-only regression coverage (467 dashboard tests passing locally). |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/dashboard/src/pages/audit-logs/conversation-helpers.js (1)
831-840: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winCorrelate Responses function-call output IDs during collector registration.
function_call_outputis built withfunctionName: callIdMap[item.call_id] || item.name || '', functionCallID: item.call_id || '', so theidbranch inresponsesFunctionCallsoutput can break when a Responses input includes bothidandcall_id. Prefercall_idfor normalized tool-call IDs, and register both aliases when both are present. Apply the same alias mapping whereverresponsesFunctionCallsregistersfunction_call,tool_use, and responsefunction_call/tool_useitems. Also add a regression fixture containing both aliases and afunction_call_outputthat referencescall_id.🤖 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 `@web/dashboard/src/pages/audit-logs/conversation-helpers.js` around lines 831 - 840, Update responsesFunctionCalls to normalize tool-call IDs using call_id before id, so function_call_output references correlate correctly when both aliases exist. When registering function_call, tool_use, and response function_call/tool_use items, map both id and call_id to the same function name whenever both are present. Add a regression fixture containing both aliases and a function_call_output referencing call_id.
🤖 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.
Outside diff comments:
In `@web/dashboard/src/pages/audit-logs/conversation-helpers.js`:
- Around line 831-840: Update responsesFunctionCalls to normalize tool-call IDs
using call_id before id, so function_call_output references correlate correctly
when both aliases exist. When registering function_call, tool_use, and response
function_call/tool_use items, map both id and call_id to the same function name
whenever both are present. Add a regression fixture containing both aliases and
a function_call_output referencing call_id.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 692a3ea8-a03b-48af-8f91-7fcdb529a56f
⛔ Files ignored due to path filters (2)
internal/admin/dashboard/static/dist/assets/index-D0DHQAAm.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (2)
web/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/tests/conversation-drawer.test.js
|
Verified the Responses call-ID alias finding and fixed it in 1ff3e95. Tool-call display now prefers |
|
Verified Greptile’s mixed-provider transcript finding and fixed it in 4531bae. Responses input normalization now retains top-level Anthropic-compatible tool_use and tool_result items, preserves object arguments and call IDs, and resolves tool results back to the tool name through the existing call map. The regression fixture mixes OpenAI and Anthropic tool turns; all 469 dashboard tests, Svelte check, and production build pass. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/dashboard/src/pages/audit-logs/conversation-helpers.js (1)
1223-1223: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRetain
tool_useitems in Responses output.Line 1221 handles only
function_call. AresponseBody.outputitem withtype: "tool_use"has no renderable text, so the later generic branch drops it. This loses the tool turn and its call ID from the reconstructed transcript.Accept
tool_usein the function-call branch. Add a regression fixture with atool_useitem inresponse_body.output.Proposed fix
- if (item.type === 'function_call') { + if (item.type === 'function_call' || item.type === 'tool_use') {🤖 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 `@web/dashboard/src/pages/audit-logs/conversation-helpers.js` at line 1223, Update the response output handling near extractToolCallsList so items with type "tool_use" follow the existing function-call branch and remain in the reconstructed transcript with their call ID. Add a regression fixture containing a tool_use item in response_body.output and verify it is preserved.
🤖 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.
Outside diff comments:
In `@web/dashboard/src/pages/audit-logs/conversation-helpers.js`:
- Line 1223: Update the response output handling near extractToolCallsList so
items with type "tool_use" follow the existing function-call branch and remain
in the reconstructed transcript with their call ID. Add a regression fixture
containing a tool_use item in response_body.output and verify it is preserved.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1ea42bbc-b8d5-424c-816a-9fe7102158f8
⛔ Files ignored due to path filters (2)
internal/admin/dashboard/static/dist/assets/index-D0rI6Hz-.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (2)
web/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/tests/conversation-drawer.test.js
|
Verified this finding against the current code and fixed it in 8e03367. Responses API |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@web/dashboard/src/pages/audit-logs/AuditThreadGroup.svelte`:
- Line 53: Update the hidePath expression in AuditThreadGroup’s AuditEntryRow
usage to require a non-empty parent entry.path before comparing it with
child.path. Preserve path hiding only for real matching parent paths, allowing
AuditEntrySummary.svelte to render its "-" fallback when the parent path is
missing.
🪄 Autofix
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: ASSERTIVE
Plan: Pro Plus
Run ID: 3b32b4db-3ee7-4e1d-abe6-8a2bea1e4371
⛔ Files ignored due to path filters (2)
internal/admin/dashboard/static/dist/assets/index-DRe6rKUn.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (3)
web/dashboard/src/pages/audit-logs/AuditEntryRow.svelteweb/dashboard/src/pages/audit-logs/AuditEntrySummary.svelteweb/dashboard/src/pages/audit-logs/AuditThreadGroup.svelte
| {#each (children && children.entries) || [] as child (child.id)} | ||
| <div class="audit-thread-child"> | ||
| <AuditEntryRow entry={child} /> | ||
| <AuditEntryRow entry={child} hidePath={child.path === entry.path} /> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Preserve the missing-path fallback.
child.path === entry.path is also true when both paths are undefined or empty. AuditEntrySummary.svelte then omits the path element instead of rendering its "-" fallback. Require a real parent path before hiding duplicate paths.
Proposed fix
- <AuditEntryRow entry={child} hidePath={child.path === entry.path} />
+ <AuditEntryRow
+ entry={child}
+ hidePath={Boolean(entry.path) && child.path === entry.path}
+ />📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <AuditEntryRow entry={child} hidePath={child.path === entry.path} /> | |
| <AuditEntryRow | |
| entry={child} | |
| hidePath={Boolean(entry.path) && child.path === entry.path} | |
| /> |
🤖 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 `@web/dashboard/src/pages/audit-logs/AuditThreadGroup.svelte` at line 53,
Update the hidePath expression in AuditThreadGroup’s AuditEntryRow usage to
require a non-empty parent entry.path before comparing it with child.path.
Preserve path hiding only for real matching parent paths, allowing
AuditEntrySummary.svelte to render its "-" fallback when the parent path is
missing.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/dashboard/src/pages/audit-logs/conversation-helpers.js (1)
117-119: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMake prompt-cache highlights include tool-call text.
measureToolCallPromptCacheadds tool names and arguments to the request-cache character count, butauditPromptCacheHighlightpassesextractRequestPromptTextSegments(entry.data.request_body)intopromptCacheHighlight.segments. The raw-body renderer buildscharactersfrom those segments, so tool-call cache counts include text the renderer cannot highlight unless those segments are added to the extractor or another renderer source.🤖 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 `@web/dashboard/src/pages/audit-logs/conversation-helpers.js` around lines 117 - 119, Update the request prompt segment extraction used by auditPromptCacheHighlight so it includes tool-call names and arguments alongside the existing request text segments. Ensure the resulting promptCacheHighlight.segments contains the same tool-call text counted by measureToolCallPromptCache, allowing the raw-body renderer to highlight those characters.
🤖 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.
Outside diff comments:
In `@web/dashboard/src/pages/audit-logs/conversation-helpers.js`:
- Around line 117-119: Update the request prompt segment extraction used by
auditPromptCacheHighlight so it includes tool-call names and arguments alongside
the existing request text segments. Ensure the resulting
promptCacheHighlight.segments contains the same tool-call text counted by
measureToolCallPromptCache, allowing the raw-body renderer to highlight those
characters.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 185483b1-a426-46e0-9ccd-c3b1158ceda9
⛔ Files ignored due to path filters (2)
internal/admin/dashboard/static/dist/assets/index-CFTcngMK.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (2)
web/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/tests/conversation-drawer.test.js
|
Verified the prompt-cache raw-body highlight finding and fixed it in 6d535ae. The request segment extractor now includes tool names and arguments for chat-completions tool calls, Messages API |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/dashboard/src/pages/audit-logs/conversation-helpers.js (1)
1133-1138: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winPreserve nested tool blocks in role-based Responses input items.
If
item.contentcontainstool_useortool_resultblocks, this branch only extracts text. Tool-only content then produces no conversation message. The request highlighter already includes nestedtool_useblocks, so the transcript and cache accounting diverge.Process
extractContentToolCalls(item.content)andextractContentToolResults(item.content)here, as therequestBody.messagesbranch does. Add the tool prompt-cache measurement to the role message.Proposed fix
} else if (item.role) { const role = String(item.role).toLowerCase(); - const text = extractText(item.content); - if (text) messages.push(message(role, text, { + const toolCalls = extractContentToolCalls(item.content); + extractContentToolResults(item.content).forEach((result) => { + if (!result.text) return; + messages.push(message('function_result', result.text, { + functionName: callIdMap[result.id] || '', + functionCallID: result.id, + promptCache: cachedPrompt(result.text, [result.text]), + })); + }); + const text = extractMessageText(item); + if (text || toolCalls.length > 0) messages.push(message(role, text, { + toolCalls, promptCache: cachedPrompt(text, extractTextSegments(item.content)), + toolPromptCache: cachedToolCalls(toolCalls), })); }🤖 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 `@web/dashboard/src/pages/audit-logs/conversation-helpers.js` around lines 1133 - 1138, Update the role-based branch around item.role to process nested tool blocks using extractContentToolCalls and extractContentToolResults, matching the requestBody.messages branch. Preserve text handling, include tool-only content as a message, and add the corresponding tool prompt-cache measurement alongside cachedPrompt so transcript and cache accounting remain consistent.
🤖 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.
Outside diff comments:
In `@web/dashboard/src/pages/audit-logs/conversation-helpers.js`:
- Around line 1133-1138: Update the role-based branch around item.role to
process nested tool blocks using extractContentToolCalls and
extractContentToolResults, matching the requestBody.messages branch. Preserve
text handling, include tool-only content as a message, and add the corresponding
tool prompt-cache measurement alongside cachedPrompt so transcript and cache
accounting remain consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d3aef5fc-6502-4162-9ae5-b1ae57157338
⛔ Files ignored due to path filters (2)
internal/admin/dashboard/static/dist/assets/index-CQFKEwKa.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (2)
web/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/tests/conversation-drawer.test.js
|
Added the requested interaction controls in 323eadf: each message now exposes a bottom-right copy icon on hover (with copied feedback and full text/tool payload copying), and the drawer exposes sticky previous/next message arrows in its top-right on hover. Navigation is smooth and reduced-motion-aware; touch devices keep the controls visible. Added focused copy-formatting and navigation-boundary tests. Svelte check, all 472 dashboard tests, production build, commit hooks, and dist-sync validation pass. |
Summary
Validation
go test ./...make fix-checknpm run checknpm run buildSummary by CodeRabbit
New Features
Bug Fixes