Skip to content

Conversation

@TejasGhatte
Copy link
Collaborator

@TejasGhatte TejasGhatte commented Oct 31, 2025

Summary

Add support for storing and displaying Responses API input history in logs, enabling better tracking and debugging of Responses API requests.

Changes

  • Added a new responses_input_history column to the logs database table
  • Created a database migration to add the new column
  • Modified the logging plugin to extract and store Responses API input messages
  • Updated the UI to display Responses input history in log details
  • Renamed LogResponsesOutputView to LogResponsesMessageView for reuse with both input and output
  • Fixed an issue in the post-hook runner by clearing ChatResponse after converting to ResponsesStreamResponse

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (Next.js)
  • Docs

How to test

  1. Make Responses API requests
  2. Check logs to verify input history is properly stored and displayed
  3. Verify that both input and output messages are properly displayed in the UI
# Core/Transports
go version
go test ./...

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

Breaking changes

  • Yes
  • No

The database schema has been updated with a new column. Users should run the application to trigger the migration.

Security considerations

No new security implications. The implementation follows the same patterns as existing log storage.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

Copy link
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Application now captures and displays input history for responses-based operations in logs.
  • Bug Fixes

    • Fixed handling of responses stream responses in HTTP integration to properly route conversion.
  • UI Updates

    • Enhanced logging interface for consistent viewing of responses-related input messages.

Walkthrough

The changes extend the system to capture, store, and display responses input history alongside existing logging infrastructure. A new database column is added, logging middleware extracts and persists responses input data, response processing is updated to properly convert responses to streaming responses, and the UI is enhanced to display the captured input history.

Changes

Cohort / File(s) Summary
Database Schema & Migration
framework/logstore/migrations.go, framework/logstore/tables.go
Added database migration to create responses_input_history column on Log table. Extended Log struct with ResponsesInputHistory (serialized JSON) and ResponsesInputHistoryParsed (in-memory deserialized data) fields. Updated content summary generation to include responses input content.
Logging Plugin Infrastructure
plugins/logging/main.go, plugins/logging/operations.go, plugins/logging/utils.go
Updated PreHook to capture responses input history via extractInputHistory (now returns both ChatMessage and ResponsesMessage slices). Extended InitialLogData with new ResponsesInputHistory field. Updated initial log entry creation to populate ResponsesInputHistoryParsed alongside existing parsed fields. Modified extractInputHistory signature to return dual-slice tuple instead of single slice.
Response Processing
core/providers/utils.go, transports/bifrost-http/integrations/utils.go
Changed response propagation in getResponsesChunkConverterCombinedPostHookRunner to nullify result.ChatResponse after converting to ResponsesStreamResponse. Added streaming handler routing for BifrostResponsesStreamResponse chunks through StreamConfig.ResponsesStreamResponseConverter.
UI Components & Type Definitions
ui/app/logs/views/logDetailsSheet.tsx, ui/app/logs/views/logResponsesMessageView.tsx, ui/lib/types/logs.ts
Renamed LogResponsesOutputView component to LogResponsesMessageView and updated corresponding props interface. Added responses input history rendering block in log details sheet. Added responses_input_history: ResponsesMessage[] field to LogEntry interface.

Sequence Diagram

sequenceDiagram
    participant Request as BifrostRequest
    participant Logger as LoggerPlugin
    participant Migrator as Database
    participant UI as UI Display
    
    Request->>Logger: PreHook: Capture input
    Logger->>Logger: extractInputHistory()<br/>(returns ChatMessage + ResponsesMessage)
    Logger->>Logger: InitialLogData: Store both<br/>InputHistory & ResponsesInputHistory
    Logger->>Migrator: Create Log entry with<br/>ResponsesInputHistoryParsed
    Note over Migrator: Column: responses_input_history<br/>(serialized JSON)
    
    Migrator-->>UI: Fetch LogEntry
    UI->>UI: Render responses_input_history<br/>using LogResponsesMessageView
    UI-->>Request: Display captured<br/>input messages
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas requiring extra attention:
    • plugins/logging/utils.go: Signature change to extractInputHistory requires verification that all call sites correctly unpack the dual-return tuple
    • core/providers/utils.go: ChatResponse nullification behavior change affects downstream consumers; confirm intended propagation path
    • framework/logstore/migrations.go: Verify migration rollback path and idempotency (column existence check)
    • ui/app/logs/views/logDetailsSheet.tsx: Confirm LogResponsesMessageView component is compatible with both output and input history rendering

🐰 A history of responses, now stored with care,
Input trails captured everywhere,
From backend vault to UI's gleam,
All messages flow in harmonic stream!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix: added responses input history column and fixed chunk conversion" is specific and related to the changeset. It accurately references two key aspects of the pull request: the addition of responses input history storage and the chunk conversion bug fix. However, there's a categorical inconsistency—the title uses the "fix:" prefix typically reserved for bug fixes, while the PR itself is marked as a "Feature" type change with the bug fix being a secondary concern. The title is clear and descriptive enough for a teammate to understand the primary changes, even if the prefix convention is questionable.
Description Check ✅ Passed The pull request description is well-structured and covers most required template sections: a clear summary explaining the purpose, detailed changes with rationale, correct type selection (Feature), appropriate affected areas checked, comprehensive testing instructions with commands, breaking change acknowledgment with explanation, security considerations, and a complete checklist. However, two template sections are absent: screenshots or recordings for the UI changes (logDetailsSheet.tsx, logResponsesMessageView.tsx) and links to related issues. These omissions are relatively minor for code-focused changes, and the description remains substantive and actionable.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 10-31-fix_added_responses_input_history_column_and_fixed_chunk_conversion

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3960bf0 and c655174.

📒 Files selected for processing (10)
  • core/providers/utils.go (1 hunks)
  • framework/logstore/migrations.go (2 hunks)
  • framework/logstore/tables.go (5 hunks)
  • plugins/logging/main.go (3 hunks)
  • plugins/logging/operations.go (1 hunks)
  • plugins/logging/utils.go (3 hunks)
  • transports/bifrost-http/integrations/utils.go (1 hunks)
  • ui/app/logs/views/logDetailsSheet.tsx (3 hunks)
  • ui/app/logs/views/logResponsesMessageView.tsx (2 hunks)
  • ui/lib/types/logs.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (7)
framework/logstore/migrations.go (2)
framework/migrator/migrator.go (3)
  • DefaultOptions (100-106)
  • New (131-149)
  • Migration (62-69)
framework/logstore/tables.go (2)
  • Log (70-122)
  • Log (125-127)
transports/bifrost-http/integrations/utils.go (1)
core/schemas/responses.go (1)
  • BifrostResponsesStreamResponse (1397-1430)
plugins/logging/operations.go (1)
ui/lib/types/logs.ts (2)
  • SpeechInput (9-14)
  • TranscriptionInput (16-22)
framework/logstore/tables.go (2)
ui/lib/types/logs.ts (3)
  • ChatMessage (113-121)
  • ResponsesMessage (408-423)
  • ResponsesReasoning (402-405)
core/schemas/chatcompletions.go (2)
  • ChatMessage (336-345)
  • ChatTool (191-195)
plugins/logging/utils.go (4)
plugins/logging/main.go (1)
  • LoggerPlugin (77-91)
core/schemas/bifrost.go (2)
  • BifrostRequest (130-140)
  • ResponsesRequest (87-87)
ui/lib/types/logs.ts (2)
  • ChatMessage (113-121)
  • ResponsesMessage (408-423)
transports/bifrost-http/handlers/inference.go (2)
  • ChatRequest (165-169)
  • ResponsesRequest (195-199)
plugins/logging/main.go (3)
ui/lib/types/logs.ts (2)
  • ChatMessage (113-121)
  • ResponsesMessage (408-423)
core/schemas/chatcompletions.go (2)
  • ChatMessage (336-345)
  • ChatTool (191-195)
core/schemas/responses.go (1)
  • ResponsesMessage (291-303)
ui/app/logs/views/logDetailsSheet.tsx (2)
ui/app/logs/views/logChatMessageView.tsx (1)
  • LogChatMessageView (65-181)
ui/app/logs/views/logResponsesMessageView.tsx (1)
  • LogResponsesMessageView (337-347)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (2)
transports/bifrost-http/integrations/utils.go (1)

727-728: LGTM! Streaming handler correctly routes ResponsesStreamResponse.

The addition of the BifrostResponsesStreamResponse case properly integrates Responses API streaming support into the centralized streaming handler. The implementation follows the established pattern for other response types (Text, Chat, Speech, Transcription) and correctly invokes the configured converter.

core/providers/utils.go (1)

618-618: Critical fix: Prevents dual-response bug in downstream processing.

Clearing ChatResponse after converting it to ResponsesStreamResponse is essential to prevent downstream switch statements from matching the wrong case. Without this, the streaming handler in transports/bifrost-http/integrations/utils.go (lines 722-736) would match the ChatResponse case before reaching the ResponsesStreamResponse case, causing the wrong converter to be invoked and breaking Responses API streaming.

This ensures only one response type is active at a time, preventing duplicate or incorrect processing.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@TejasGhatte TejasGhatte marked this pull request as ready for review October 31, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants