fix(admin): include sessionId in project logs - #2597
Conversation
The admin project-logs endpoint hand-picks log columns and omitted sessionId, while the shared LogCard it feeds renders the Session ID field. As a result admin log views always showed "—" for Session ID even when the log row had a session id set. Add sessionId to both the select and the response schema. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe PR extends the project logs API endpoint to expose the ChangesProject Logs sessionId API Extension
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 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 |
Problem
In the admin dashboard, the log detail/card Session ID field always showed
—, even for logs that have a session id set in the database (e.g. opencode sticky-routing sessions).Root cause
The admin project-logs endpoint
GET /admin/organizations/{orgId}/projects/{projectId}/logshand-picks its log columns (rather than usinggetTableColumnslike the shared/logsendpoint) and omittedsessionIdfrom both theselectand thelogEntrySchemaresponse shape.The admin
LogCardis a thin wrapper around the sharedLogCard, which renders{log.sessionId ?? "—"}. The wrapper casts the data withas unknown as LogCardData, so the missing field was invisible to the type checker — and at runtimelog.sessionIdwas alwaysundefined.The regular (non-admin) dashboard was unaffected because its
/logsendpoint selects all columns viagetTableColumns.Fix
Add
sessionIdto the admin project-logsselectandlogEntrySchema. The generated admin API client and sharedLogCardalready support the field, so no frontend changes are needed.🤖 Generated with Claude Code
Summary by CodeRabbit
sessionIdfield to project logs API responses for improved session tracking and debugging capabilities.