fix: dashboard bulk-analyze false failures + codex/copilot message-id collision - #17
Merged
Merged
Conversation
…sights query DashboardPage/SessionListPanel classified sessions as "unanalyzed" using useInsights() (server-capped at 5000 rows, ordered by insight timestamp). On large histories a single session's analysis produces 5-10+ insight rows, so the cap silently drops already-analyzed sessions out of the response, misclassifying them as unanalyzed and feeding them into Bulk Analyze, where they then genuinely fail against the dashboard's configured LLM provider. Add GET /api/analysis/analyzed-session-ids, backed by analysis_usage (PRIMARY KEY (session_id, analysis_type), one row per session) instead. Also fix a message-id collision bug found while investigating a related "no messages" report: CodexProvider and CopilotCliProvider generated message ids like `codex-user-0` with no session scoping, colliding across every session from that provider. Since messages.id is a global PRIMARY KEY, INSERT ... ON CONFLICT DO UPDATE silently reassigned earlier sessions' messages to whichever session synced last with the same index, leaving most sessions with a correct message_count but zero actual rows. Message ids are now scoped by session id.
ClaudiaFang
marked this pull request as ready for review
July 21, 2026 13:22
ClaudiaFang
pushed a commit
that referenced
this pull request
Jul 23, 2026
feat: scaffold Starlight documentation site
ClaudiaFang
added a commit
that referenced
this pull request
Jul 23, 2026
…ewick fix: dashboard bulk-analyze false failures + codex/copilot message-id collision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useInsights(), which the server caps at 5000 rows (ordered by insight timestamp). On large histories (e.g.insights check --days 36500 --analyze), a single session's analysis produces 5-10+ insight rows, so the cap silently drops already-analyzed sessions from the response — they get misclassified as unanalyzed, land in Bulk Analyze, and then genuinely fail there against the dashboard's own configured LLM provider (separate from whatever runner the CLI used).GET /api/analysis/analyzed-session-ids, backed byanalysis_usage(one row per session,PRIMARY KEY (session_id, analysis_type)) instead — no row-cap risk at this scale.DashboardPageandSessionListPanelnow use it for analyzed/unanalyzed classification.CodexProviderandCopilotCliProvidergenerated message ids likecodex-user-0/copilot-assistant-1with no session scoping. Sincemessages.idis a globalPRIMARY KEY,INSERT ... ON CONFLICT(id) DO UPDATEsilently reassigned earlier sessions' messages to whichever session synced last with the same index — leaving most sessions with a correctmessage_counton thesessionsrow but zero actual rows inmessages. Message ids are now scoped by session id, so they can no longer collide across sessions.Test plan
pnpm --filter @code-insights/cli build,pnpm --filter @code-insights/server build,pnpm --filter @code-insights/dashboard buildall passclitest suite: 902/902 passservertest suite: 655/655 passdashboardtest suite: 15/15 passmessagesrows for codex-cli/copilot-cli sessions +sync --forceto re-populate) — not included in this PR, flagged separately to the user since it mutates their live local DB.🤖 Generated with Claude Code