fix(dashboard): keep interactions on the selected branch - #642
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 change adds trusted interaction-session propagation through ChangesInteraction session continuation and dashboard follow-up
Estimated code review effort: 5 (Critical) | ~120 minutes 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 |
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Confidence Score: 4/5
|
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 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 `@internal/auditlog/conversation_helpers_test.go`:
- Around line 144-191: Expand
TestBuildSessionConversationFollowsLatestAndKeepsAnchor into table-driven
coverage for session-page boundary outcomes, adding cases for a nil anchor, root
user path, lookup error, nil page, and empty page. Assert each case’s expected
result or error while preserving the existing successful lookup assertions and
callback parameter validation.
In `@internal/auditlog/conversation_helpers.go`:
- Around line 31-76: Update internal/auditlog/conversation_helpers.go lines
31-76 in the conversation traversal using a fixed snapshot cutoff or (timestamp,
ID) keyset cursor across all page fetches, with deterministic ordering and
defensive ID deduplication; retain the existing anchor and truncation behavior.
Update internal/auditlog/conversation_helpers_test.go lines 193-212 to insert a
same-session entry between page fetches and assert the result contains every
expected ID exactly once.
In `@internal/auditlog/enrich_test.go`:
- Around line 19-40: Expand TestEnrichEntryWithSessionIDPublishesChangedSession
into an independent table-driven test covering trimmed-and-published, empty-ID,
missing-entry, nil-context, and unchanged-ID outcomes. Initialize each case with
its own context, entry, and publisher as needed, then assert the resulting
session ID and published events without relying on state shared between cases.
In `@internal/auditlog/reader_mongodb.go`:
- Around line 318-320: Update GetConversation in
internal/auditlog/reader_mongodb.go and the corresponding GetConversation flow
in internal/auditlog/reader_sql.go so SQL fallback reads preserve OmitAttempts:
true when invoking buildConversation or its hydrated lookup callbacks. Ensure
GetLogByID, findByResponseID, and findByPreviousResponseID do not populate
attempts in the serialized ConversationResult. Update
internal/admin/handler_audit.go at lines 420-424 only as needed to preserve the
documented omission at that call site.
In `@internal/server/session_test.go`:
- Around line 191-236: Add table-driven cases to
TestSessionCaptureRejectsUntrustedOrCrossPathParent for malformed parent IDs,
parent lookup errors, missing parent entries, and parents with blank SessionID;
configure each case through the existing sessionParentLookup test helper, assert
the expected lookup count, and verify the handler receives the detector fallback
session ID rather than an invalid parent-derived value.
In `@internal/server/session.go`:
- Around line 93-94: Update the parent lookup in the session continuation flow
around GetLogByID to use a minimal query that selects only user_path and
session_id, while preserving the existing nil/error handling and downstream use
of UserPath and SessionID. Add or reuse a lookup method dedicated to these
fields rather than loading the complete LogEntry and attempts.
In `@web/dashboard/src/pages/audit-logs/conversation-helpers.js`:
- Around line 234-245: Prevent unchainable /v1/responses follow-ups from being
sent without prior context: update the responses handling in the relevant
conversation helper and ensure followUpKind/canSendFollowUp in
conversationDrawer.svelte.js also rejects entries lacking both a response ID and
a conversation. Preserve normal chaining through previous_response_id or
conversation, and keep the composer disabled when neither chaining nor prior
input preservation is available.
In `@web/dashboard/src/pages/audit-logs/conversationDrawer.svelte.js`:
- Around line 313-348: Add a module-level FOLLOW_UP_TIMEOUT_MS and an
AbortController field for sendFollowUp. Create and pass its signal through the
apiFetch options, ensure the deadline aborts both the fetch and drainResponse,
and clear the controller/timer during cleanup; update closeConversation to abort
any in-flight follow-up before resetting state.
In `@web/dashboard/tests/conversation-drawer.test.js`:
- Around line 482-541: Update the fixtures in the session-scoping test around
buildFollowUpHeaders to place the scoped and auto session IDs in
data.request_headers, then assert the filtered X-Session-Id result expected from
the helper rather than relying on absent input. Remove inert session_id and
user_path fields from these fixtures, and adjust the related assertions so they
verify the intended scoping behavior through request_headers.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: e5f50aa7-faa5-4af5-91b7-cf937a1646f7
⛔ Files ignored due to path filters (4)
internal/admin/dashboard/static/dist/assets/index-B-Rv4AUL.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/assets/index-Bn0frWFQ.cssis excluded by!**/dist/**internal/admin/dashboard/static/dist/assets/index-zLFdhCH8.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (29)
cmd/gomodel/docs/docs.godocs/openapi.jsoninternal/admin/audit_projection.gointernal/admin/audit_projection_test.gointernal/admin/handler_audit.gointernal/app/app.gointernal/auditlog/conversation_helpers.gointernal/auditlog/conversation_helpers_test.gointernal/auditlog/enrich.gointernal/auditlog/enrich_test.gointernal/auditlog/reader.gointernal/auditlog/reader_mongodb.gointernal/auditlog/reader_mongodb_test.gointernal/auditlog/reader_sessions_mongodb_test.gointernal/auditlog/reader_sql.gointernal/auditlog/session_id_test.gointernal/auditlog/user_path_filter.gointernal/auditlog/user_path_filter_test.gointernal/server/auth.gointernal/server/auth_test.gointernal/server/http.gointernal/server/session.gointernal/server/session_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/src/pages/audit-logs/conversationDrawer.svelte.jsweb/dashboard/tests/conversation-drawer.test.jsweb/dashboard/tests/live-logs.test.js
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 806-807: Update the message-rendering logic in
fullSnapshotLineage() to also render the top-level requestBody.system prompt,
supporting both string and content-block values while preserving the existing
instructions handling. Add coverage for string and content-block system prompts
and ensure both appear in the transcript.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: 5a39030b-dfa2-4430-ab30-446503d6a01f
⛔ Files ignored due to path filters (2)
internal/admin/dashboard/static/dist/assets/index-Yi1z1tSL.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (8)
internal/admin/handler_audit.gointernal/auditlog/conversation_helpers.gointernal/auditlog/conversation_helpers_test.gointernal/server/http.gointernal/server/session.gointernal/server/session_test.goweb/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/tests/conversation-drawer.test.js
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/conversationDrawer.svelte.js`:
- Around line 199-203: Update the sendFollowUp and drainResponse flow to retain
a child-specific audit ID or client correlation ID for the submitted follow-up,
rather than relying only on followUpParentID. Use that child-specific identity
when selecting conversationAnchorID after persistence, including when live
streaming is disabled, and prevent unrelated children sharing the same parent
from matching the follow-up condition.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: 1b9dc21f-e946-4d42-a483-2196a07a7be4
⛔ Files ignored due to path filters (3)
internal/admin/dashboard/static/dist/assets/index-CDxZDTJg.cssis excluded by!**/dist/**internal/admin/dashboard/static/dist/assets/index-DrBA65CZ.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/conversationDrawer.svelte.jsweb/dashboard/tests/conversation-drawer.test.js
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@internal/auditlog/reader_sql.go`:
- Around line 243-255: Update GetInteractionParent to handle NULL user_path and
session_id values from legacy rows by coalescing them in the query or scanning
through nullable intermediates before assigning the InteractionParent fields.
Preserve the existing no-row and error behavior, and add a SQL regression case
covering a matching row with user_path = NULL.
In `@internal/auditlog/reader.go`:
- Around line 29-30: Document the reader contract at OmitAttempts and
ExactUserPath, including each option’s default value and filtering behavior;
specify that exact root-path matching also includes legacy empty and null stored
paths. Document GetInteractionParent’s (nil, nil) no-record result and note that
SQL and Mongo readers provide it, with session capture treating it as no parent.
In `@internal/auditlog/session_id_test.go`:
- Around line 87-116: Update the pagination test around
SQLReader.GetConversation to use table-driven cases with at least 101 entries
sharing the same timestamp, forcing pagination across the 100-row boundary and
exercising the timestamp-equal/id cursor branch in SQLReader.logFilters. Assert
each case returns ordered, unique IDs with the expected truncation behavior for
both SQLite and PostgreSQL.
In `@web/dashboard/src/pages/audit-logs/conversationDrawer.svelte.js`:
- Around line 202-212: Clear followUpRequestID after the submitted child is
selected and has a durable audit ID in both handling paths around the live-entry
logic and the corresponding 407-416 path; retain it while waiting for that
child. Ensure subsequent descendants are evaluated through linkedParent instead
of being rejected by the unknown-entry guard, and add coverage for receiving the
submitted child followed by a descendant linked to it.
🪄 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: dcfccffb-200b-4f53-9ab0-b5759aa1e432
⛔ Files ignored due to path filters (2)
internal/admin/dashboard/static/dist/assets/index-DxN5NlVe.jsis excluded by!**/dist/**internal/admin/dashboard/static/dist/index.htmlis excluded by!**/dist/**
📒 Files selected for processing (14)
internal/admin/handler_test.gointernal/auditlog/conversation_helpers.gointernal/auditlog/conversation_helpers_test.gointernal/auditlog/enrich_test.gointernal/auditlog/reader.gointernal/auditlog/reader_mongodb.gointernal/auditlog/reader_sql.gointernal/auditlog/roundtrip_sql_test.gointernal/auditlog/session_id_test.gointernal/server/session.gointernal/server/session_test.goweb/dashboard/src/pages/audit-logs/conversation-helpers.jsweb/dashboard/src/pages/audit-logs/conversationDrawer.svelte.jsweb/dashboard/tests/conversation-drawer.test.js
Description
Testing
AI Generated (optional)
Implemented and reviewed with Codex. The divergent-history behavior was also checked against the reported local audit record shape.
Summary by CodeRabbit
New Features
Improvements