Conversation
|
|
ef51bbc to
f26655a
Compare
729fa28 to
bf18504
Compare
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 4 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
📝 WalkthroughWalkthroughAdds persisted selected-prompt fields to logs (DB migration + model), threads selected-prompt metadata from logging plugin through writer into persisted logs, surfaces those fields in frontend types and detail views, adjusts prompt-repo routing, and tweaks UI and session handlers. Changes
Sequence DiagramsequenceDiagram
participant Plugin as Plugin (Logging)
participant Writer as Writer
participant DB as Database
participant UI as Log Detail View
Plugin->>Plugin: read selectedPromptID/Name/Version from context
Plugin->>Writer: call applyOutputFieldsToEntry(..., selectedPromptID, selectedPromptName, selectedPromptVersion)
Writer->>Writer: set entry.SelectedPromptID/Name/Version when non-empty
Writer->>DB: persist Log (includes new selected_prompt_* columns)
UI->>DB: fetch log details (may call prompt service)
DB->>UI: return log with selected_prompt_* fields
UI->>UI: render "Selected Prompt" when present (name · v{version})
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
b1f1308 to
f86aa39
Compare
bf18504 to
36cfa1c
Compare
f86aa39 to
f3b4175
Compare
36cfa1c to
32633c8
Compare
Confidence Score: 5/5Safe to merge; all findings are P2 style suggestions that don't block correctness or data integrity. Both remaining findings are non-blocking: a missing index (easy to add later if filtering by prompt becomes a use case) and a tab/space inconsistency in a TypeScript type file. No logic errors, no security issues, and the migration is idempotent with proper rollback support.
Important Files Changed
Reviews (18): Last reviewed commit: "feat: wires prompt deployment selections..." | Re-trigger Greptile |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugins/logging/writer.go (1)
349-381:⚠️ Potential issue | 🟡 MinorClamp prompt metadata to column limits before assignment.
These values are written into
varchar(255)/varchar(64)columns. Unbounded values here can fail inserts and end up dropping logs in fallback paths.Suggested defensive fix
import ( "sync" "time" + "unicode/utf8" "github.com/maximhq/bifrost/framework/logstore" ) + +func truncateRunes(s string, max int) string { + if utf8.RuneCountInString(s) <= max { + return s + } + r := []rune(s) + return string(r[:max]) +} @@ if selectedPromptName != "" { - entry.SelectedPromptName = selectedPromptName + entry.SelectedPromptName = truncateRunes(selectedPromptName, 255) } if selectedPromptVersion != "" { - entry.SelectedPromptVersion = selectedPromptVersion + entry.SelectedPromptVersion = truncateRunes(selectedPromptVersion, 64) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@plugins/logging/writer.go` around lines 349 - 381, The selected prompt fields can exceed DB column limits and cause insert failures; in applyOutputFieldsToEntry truncate selectedPromptName to at most 255 characters and selectedPromptVersion to at most 64 characters before assigning (e.g. if len(selectedPromptName) > 255 { selectedPromptName = selectedPromptName[:255] } and similarly for selectedPromptVersion), then assign the truncated values to entry.SelectedPromptName and entry.SelectedPromptVersion; consider extracting a small helper truncateString(s string, max int) string and use it here to keep the code concise.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@framework/logstore/tables.go`:
- Around line 122-123: The new struct fields SelectedPromptName and
SelectedPromptVersion are nullable in the model; update their GORM tags to
enforce NOT NULL with a default empty string (e.g., add gorm:"NOT
NULL;default:''") and add a migration/backfill step that updates existing rows
to '' for these columns (run an UPDATE setting them to empty string before
altering the schema or include the backfill in the same migration function), so
reads never rely on NULL-to-empty behavior; modify the migration code that
creates/updates the logstore table to include this backfill and the NOT
NULL/default change for SelectedPromptName and SelectedPromptVersion.
---
Outside diff comments:
In `@plugins/logging/writer.go`:
- Around line 349-381: The selected prompt fields can exceed DB column limits
and cause insert failures; in applyOutputFieldsToEntry truncate
selectedPromptName to at most 255 characters and selectedPromptVersion to at
most 64 characters before assigning (e.g. if len(selectedPromptName) > 255 {
selectedPromptName = selectedPromptName[:255] } and similarly for
selectedPromptVersion), then assign the truncated values to
entry.SelectedPromptName and entry.SelectedPromptVersion; consider extracting a
small helper truncateString(s string, max int) string and use it here to keep
the code concise.
🪄 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: 186209f3-f42c-4e0f-bcda-5a723de5b439
📒 Files selected for processing (7)
framework/logstore/migrations.goframework/logstore/tables.goplugins/logging/main.goplugins/logging/writer.goui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsxui/app/workspace/logs/sheets/logDetailView.tsxui/lib/types/logs.ts
32633c8 to
7dca2fa
Compare
f3b4175 to
4328bda
Compare
7dca2fa to
77b89ed
Compare
4328bda to
427ec08
Compare
77b89ed to
e335344
Compare
588c64e to
58d68d4
Compare
e335344 to
43002ba
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
ui/components/ui/custom/celBuilder/valueEditor.tsx (1)
23-30: Prefer overridingcontextviaOmitinstead of intersection to preserve type narrowing.
ValueEditorProps & { context?: CELValueEditorContext }loses type narrowing becauseValueEditorProps.contextisanyin react-querybuilder. UseOmit<ValueEditorProps, "context">to guarantee strong typing for thecontextproperty.♻️ Proposed typing fix
+type CELValueEditorProps = Omit<ValueEditorProps, "context"> & { + context?: CELValueEditorContext; +}; + export function ValueEditor({ value, handleOnChange, operator, fieldData, type, context, -}: ValueEditorProps & { context?: CELValueEditorContext }) { +}: CELValueEditorProps) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/components/ui/custom/celBuilder/valueEditor.tsx` around lines 23 - 30, The component signature for ValueEditor uses an intersection that overrides the existing ValueEditorProps.context (which is any) and loses type narrowing; change the props type to Omit<ValueEditorProps, "context"> & { context?: CELValueEditorContext } so the explicit context prop has strong typing, update the function parameter destructuring to match the new props type, and ensure any downstream uses of ValueEditor or references to ValueEditorProps/context respect the Omit-based signature (search for ValueEditor, ValueEditorProps, and CELValueEditorContext to apply the change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@framework/logstore/tables.go`:
- Line 124: SelectedPromptID is declared with `gorm:"type:varchar(32)"` causing
UUID prompt IDs to be truncated; update the struct field `SelectedPromptID` in
tables.go to use `gorm:"type:varchar(36)"` so it matches the canonical
TablePrompt UUID width and preserves full prompt IDs for lookups and storage.
In `@ui/app/workspace/prompt-repo/prompts/page.tsx`:
- Around line 8-10: The useEffect block calling navigate uses the wrong
property: change the navigate call in the useEffect (the one referencing
navigate and searchStr) to pass the route via the to property instead of
href—i.e., navigate({ to: `/workspace/prompt-repo${searchStr}`, replace: true
})—so it uses TanStack Router's internal-route key while keeping replace: true
and the existing dependencies (navigate, searchStr).
---
Nitpick comments:
In `@ui/components/ui/custom/celBuilder/valueEditor.tsx`:
- Around line 23-30: The component signature for ValueEditor uses an
intersection that overrides the existing ValueEditorProps.context (which is any)
and loses type narrowing; change the props type to Omit<ValueEditorProps,
"context"> & { context?: CELValueEditorContext } so the explicit context prop
has strong typing, update the function parameter destructuring to match the new
props type, and ensure any downstream uses of ValueEditor or references to
ValueEditorProps/context respect the Omit-based signature (search for
ValueEditor, ValueEditorProps, and CELValueEditorContext to apply the change).
🪄 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: 59f824c9-65c5-410c-9063-780340f74939
📒 Files selected for processing (11)
framework/logstore/migrations.goframework/logstore/tables.goplugins/logging/main.goplugins/logging/writer.goui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsxui/app/workspace/logs/sheets/logDetailView.tsxui/app/workspace/prompt-repo/deployments/layout.tsxui/app/workspace/prompt-repo/prompts/page.tsxui/app/workspace/routing-rules/views/routingRuleSheet.tsxui/components/ui/custom/celBuilder/valueEditor.tsxui/lib/types/logs.ts
💤 Files with no reviewable changes (1)
- ui/app/workspace/prompt-repo/deployments/layout.tsx
✅ Files skipped from review due to trivial changes (3)
- ui/app/workspace/routing-rules/views/routingRuleSheet.tsx
- ui/lib/types/logs.ts
- ui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- framework/logstore/migrations.go
- plugins/logging/writer.go
58be647 to
6b59828
Compare
71b2e2e to
1850fe2
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
framework/logstore/tables.go (1)
124-124:⚠️ Potential issue | 🔴 CriticalPrevent
selected_prompt_idtruncation at the schema layer.Line 124 defines
SelectedPromptIDasvarchar(32), which can truncate UUID-width prompt IDs and break downstream lookups/joins.💡 Proposed fix
- SelectedPromptID *string `gorm:"type:varchar(32)" json:"selected_prompt_id"` + SelectedPromptID *string `gorm:"type:varchar(36)" json:"selected_prompt_id"`Also ensure the corresponding migration column type matches this width.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@framework/logstore/tables.go` at line 124, The SelectedPromptID field in tables.go is declared as SelectedPromptID `gorm:"type:varchar(32)"` (selected_prompt_id) which can truncate standard UUIDs; change the GORM column type to a width that supports full UUIDs (e.g., varchar(36) or CHAR(36)) in the SelectedPromptID tag and update the corresponding migration that creates/alter the selected_prompt_id column so the DB column type matches the new width to avoid truncation in lookups/joins.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@framework/logstore/tables.go`:
- Line 124: The SelectedPromptID field in tables.go is declared as
SelectedPromptID `gorm:"type:varchar(32)"` (selected_prompt_id) which can
truncate standard UUIDs; change the GORM column type to a width that supports
full UUIDs (e.g., varchar(36) or CHAR(36)) in the SelectedPromptID tag and
update the corresponding migration that creates/alter the selected_prompt_id
column so the DB column type matches the new width to avoid truncation in
lookups/joins.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e08cc5d6-aa5c-4245-9d01-5f2861ac4c7c
📒 Files selected for processing (11)
framework/logstore/migrations.goframework/logstore/tables.goplugins/logging/main.goplugins/logging/writer.goui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsxui/app/workspace/logs/sheets/logDetailView.tsxui/app/workspace/prompt-repo/deployments/layout.tsxui/app/workspace/prompt-repo/prompts/page.tsxui/app/workspace/routing-rules/views/routingRuleSheet.tsxui/components/ui/custom/celBuilder/valueEditor.tsxui/lib/types/logs.ts
💤 Files with no reviewable changes (1)
- ui/app/workspace/prompt-repo/deployments/layout.tsx
✅ Files skipped from review due to trivial changes (4)
- ui/app/workspace/routing-rules/views/routingRuleSheet.tsx
- ui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsx
- ui/app/workspace/prompt-repo/prompts/page.tsx
- framework/logstore/migrations.go
🚧 Files skipped from review as they are similar to previous changes (3)
- ui/lib/types/logs.ts
- plugins/logging/main.go
- ui/components/ui/custom/celBuilder/valueEditor.tsx
6b59828 to
f13c53d
Compare
1850fe2 to
a6c42d2
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ui/app/workspace/logs/sheets/logDetailsSheet.tsx`:
- Line 65: resolvedSelectedPromptName currently prefers
selectedPromptData?.prompt?.name over the persisted
displayLog.selected_prompt_name, which causes historical logs to show renamed
prompt names; change the order so displayLog.selected_prompt_name is used first
(falling back to selectedPromptData?.prompt?.name and then ""), i.e. use
displayLog.selected_prompt_name ?? selectedPromptData?.prompt?.name ?? "" when
computing resolvedSelectedPromptName to ensure stored log names are preserved.
- Around line 54-61: The useGetPromptQuery hook is conditionally called after an
early return when log is falsy, causing hooks order mismatch; move the call to
useGetPromptQuery above the early return so hooks are always invoked in the same
order, compute selectedPromptId safely (derive it from
log/fullLog/isFullDataReady/open but do not return early before the hook), and
keep the skip option set to true when open is false or selectedPromptId is falsy
(e.g., skip: !open || !selectedPromptId) so the hook runs consistently but does
nothing when there is no prompt.
🪄 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: a7ff0b68-f609-45ae-b3a3-dc7105cf8f16
📒 Files selected for processing (13)
framework/logstore/migrations.goframework/logstore/tables.goplugins/logging/main.goplugins/logging/writer.goui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsxui/app/workspace/logs/sheets/logDetailView.tsxui/app/workspace/logs/sheets/logDetailsSheet.tsxui/app/workspace/prompt-repo/deployments/layout.tsxui/app/workspace/prompt-repo/layout.tsxui/app/workspace/prompt-repo/prompts/page.tsxui/app/workspace/routing-rules/views/routingRuleSheet.tsxui/components/ui/custom/celBuilder/valueEditor.tsxui/lib/types/logs.ts
💤 Files with no reviewable changes (1)
- ui/app/workspace/prompt-repo/deployments/layout.tsx
✅ Files skipped from review due to trivial changes (3)
- ui/app/workspace/routing-rules/views/routingRuleSheet.tsx
- ui/app/workspace/prompt-repo/layout.tsx
- ui/lib/types/logs.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- ui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsx
- ui/app/workspace/prompt-repo/prompts/page.tsx
- framework/logstore/migrations.go
- ui/app/workspace/logs/sheets/logDetailView.tsx
- framework/logstore/tables.go
- ui/components/ui/custom/celBuilder/valueEditor.tsx
e6ae152 to
3fa3852
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ui/components/ui/custom/celBuilder/valueEditor.tsx (1)
17-21: ShareCELValueEditorContextbetween producer and consumer to prevent type drift.
Line 17defines the context contract locally. Consider exporting this type and reusing it inui/components/ui/custom/celBuilder/celRuleBuilder.tsxwhere the context object is constructed, so stacked PR changes can’t silently diverge the shape.As per coding guidelines: "
**: always check the stack if there is one for the current PR. do not give localized reviews for the PR, always see all changes in the light of the whole stack of PRs (if there is a stack, if there is no stack you can continue to make localized suggestions/reviews)".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ui/components/ui/custom/celBuilder/valueEditor.tsx` around lines 17 - 21, Export the CELValueEditorContext type so the producer (where it's defined in valueEditor.tsx) and the consumer (where the context object is constructed in celRuleBuilder.tsx) share the exact contract; update valueEditor.tsx to export the type (CELValueEditorContext) and import that exported type into ui/components/ui/custom/celBuilder/celRuleBuilder.tsx, then use the imported type when creating/typing the context object to prevent divergence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ui/app/workspace/logs/sheets/logDetailsSheet.tsx`:
- Around line 46-50: The sheet readiness check currently blocks rendering until
a successful full-log fetch; update the isFullDataReady boolean (and any similar
readiness checks around the useGetLogByIdQuery usage) to treat fetch errors as
"ready" by including the isError flag from the useGetLogByIdQuery result (e.g.,
change the condition to check fullLog?.id === log.id && (!isLoading ||
isError)), so the component can render the base row while retries continue in
the background; apply the same change to the related readiness checks referenced
around the selectedPromptId logic and any other places that only considered
!isLoading.
---
Nitpick comments:
In `@ui/components/ui/custom/celBuilder/valueEditor.tsx`:
- Around line 17-21: Export the CELValueEditorContext type so the producer
(where it's defined in valueEditor.tsx) and the consumer (where the context
object is constructed in celRuleBuilder.tsx) share the exact contract; update
valueEditor.tsx to export the type (CELValueEditorContext) and import that
exported type into ui/components/ui/custom/celBuilder/celRuleBuilder.tsx, then
use the imported type when creating/typing the context object to prevent
divergence.
🪄 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: d70fd994-cec2-44ed-b8fc-2cc4015565c8
📒 Files selected for processing (14)
framework/logstore/migrations.goframework/logstore/tables.goplugins/logging/main.goplugins/logging/writer.gotransports/bifrost-http/handlers/prompts.goui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsxui/app/workspace/logs/sheets/logDetailView.tsxui/app/workspace/logs/sheets/logDetailsSheet.tsxui/app/workspace/prompt-repo/deployments/layout.tsxui/app/workspace/prompt-repo/layout.tsxui/app/workspace/prompt-repo/prompts/page.tsxui/app/workspace/routing-rules/views/routingRuleSheet.tsxui/components/ui/custom/celBuilder/valueEditor.tsxui/lib/types/logs.ts
💤 Files with no reviewable changes (1)
- ui/app/workspace/prompt-repo/deployments/layout.tsx
✅ Files skipped from review due to trivial changes (3)
- ui/app/_fallbacks/enterprise/components/prompt-deployments/promptDeploymentsAccordionItem.tsx
- ui/app/workspace/routing-rules/views/routingRuleSheet.tsx
- ui/app/workspace/prompt-repo/layout.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
- plugins/logging/main.go
- ui/app/workspace/prompt-repo/prompts/page.tsx
- ui/lib/types/logs.ts
- ui/app/workspace/logs/sheets/logDetailView.tsx
- plugins/logging/writer.go
3fa3852 to
6fd8f22
Compare
f13c53d to
31196ed
Compare
6fd8f22 to
49c6229
Compare
31196ed to
7462cc9
Compare
49c6229 to
27ce7d3
Compare
27ce7d3 to
e208a8a
Compare
7462cc9 to
2a1ede0
Compare
Merge activity
|
The base branch was changed.
e208a8a to
bb4ca6e
Compare

Summary
Adds support for tracking and displaying selected prompt information in the logging system. This enhancement allows users to see which prompt name and version were used for each logged request in the UI.
Changes
selected_prompt_nameandselected_prompt_versioncolumns to the Log table schemaType of change
Affected areas
How to test
Verify the database migration runs successfully and the UI displays prompt information:
Test that logs with prompt information display the "Selected Prompt" field in the log detail view, showing both name and version when available.
Screenshots/Recordings
The UI now displays a "Selected Prompt" field in the log detail view showing the prompt name and version (e.g., "my-prompt · v1.2").
Breaking changes
Related issues
Enhances logging capabilities for prompt tracking in enterprise deployments and prompts plugin usage.
Security considerations
No security implications - this only adds display fields for prompt metadata that's already available in the system context.
Checklist
docs/contributing/README.mdand followed the guidelines