Skip to content

fix(admin): include sessionId in project logs - #2597

Merged
steebchen merged 1 commit into
mainfrom
fix/admin-log-session-id
Jun 8, 2026
Merged

steebchen merged 1 commit into
mainfrom
fix/admin-log-session-id

Conversation

@steebchen

@steebchen steebchen commented Jun 8, 2026 •

Copy link
Copy Markdown
Member

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}/logs hand-picks its log columns (rather than using getTableColumns like the shared /logs endpoint) and omitted sessionId from both the select and the logEntrySchema response shape.

The admin LogCard is a thin wrapper around the shared LogCard, which renders {log.sessionId ?? "—"}. The wrapper casts the data with as unknown as LogCardData, so the missing field was invisible to the type checker — and at runtime log.sessionId was always undefined.

The regular (non-admin) dashboard was unaffected because its /logs endpoint selects all columns via getTableColumns.

Fix

Add sessionId to the admin project-logs select and logEntrySchema. The generated admin API client and shared LogCard already support the field, so no frontend changes are needed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added sessionId field to project logs API responses for improved session tracking and debugging capabilities.

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>
@coderabbitai

coderabbitai Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 09af0e1d-68d8-4baf-80fe-b51150e72e39

📥 Commits

Reviewing files that changed from the base of the PR and between 9da19a9 and 3f9c720.

📒 Files selected for processing (1)
  • apps/api/src/routes/admin.ts

Walkthrough

The PR extends the project logs API endpoint to expose the sessionId field on each log entry. The sessionId is added to both the OpenAPI schema definition and the database select statement, enabling the API to return session information alongside other log metadata.

Changes

Project Logs sessionId API Extension

Layer / File(s) Summary
Add sessionId to logs API response
apps/api/src/routes/admin.ts
sessionId is added to logEntrySchema for OpenAPI typing and response validation, and is included in the database select query so each returned log entry contains the sessionId field.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding sessionId to project logs in the admin endpoint.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/admin-log-session-id

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.

@steebchen
steebchen enabled auto-merge June 8, 2026 22:33
@steebchen
steebchen added this pull request to the merge queue Jun 8, 2026
Merged via the queue into main with commit 047fef5 Jun 8, 2026
12 checks passed
@steebchen
steebchen deleted the fix/admin-log-session-id branch June 8, 2026 22:49
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.

1 participant