Skip to content

feat(sessions): switch web session list from unified to cli sessions v2 endpoint#2478

Open
kilo-code-bot[bot] wants to merge 2 commits intomainfrom
feat/session-list-v2-migration
Open

feat(sessions): switch web session list from unified to cli sessions v2 endpoint#2478
kilo-code-bot[bot] wants to merge 2 commits intomainfrom
feat/session-list-v2-migration

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot bot commented Apr 15, 2026

Summary

Switches all web cloud-agent session list consumers from the unifiedSessions router (which queries both cli_sessions v1 and cli_sessions_v2 via UNION ALL) to the dedicated cliSessionsV2 router (which queries only cli_sessions_v2).

Key changes:

  • New search procedure on cliSessionsV2Router — ILIKE search on title/session_id with offset pagination, matching the unified router's search but v2-only
  • Default orderBy changed to updated_at in the v2 router's ListSessionsInputSchema (was created_at)
  • All 6 consumer files migrated from unifiedSessions.list/.search/.recentRepositories to cliSessionsV2 equivalents
  • ApiSession type updated to match v2 router output shape (no last_mode/last_model, parent_session_id added)
  • Dead v1 code removed from SessionsPageContent.tsx (the v1-only "Open in Editor"/"Open in CLI" fork branch)
  • The unified sessions router is left intact for backward compatibility and can be removed in a follow-up

Verification

  • pnpm typecheck passes with 0 errors
  • pnpm format applied

Visual Changes

N/A

Reviewer Notes

  • The unifiedSessions router (unified-sessions-router.ts) is intentionally kept — it can be cleaned up once confirmed working in production
  • SessionsPageContent.tsx had a source === 'v1' dialog branch that is now dead code — removed it along with the unused OpenInCliButton import
  • The v2 search uses includeChildren instead of the unified router's includeSubSessions — consumers updated accordingly

kilo-code-bot bot added 2 commits April 15, 2026 20:16
provide a migration plan for the session-list v2 endpoint

outlining steps, milestones, and rollback considerations
}

// Escape ILIKE wildcard characters so literal %, _ in user input are matched exactly
const escaped = search_string.replace(/[%_]/g, '\\$&');

const { data: listData, isLoading: isListLoading } = useQuery({
...trpc.unifiedSessions.list.queryOptions(listInput),
...trpc.cliSessionsV2.list.queryOptions(listInput),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Switching the sidebar to cliSessionsV2 drops legacy sessions

unifiedSessions.list was the only query here that still UNIONed cli_sessions and cli_sessions_v2. After this swap, any user whose history still lives in cli_sessions loses those sessions from the sidebar/search immediately, even though the PR keeps the unified router around for backward compatibility. Unless every legacy row has already been backfilled into cli_sessions_v2, this is a breaking regression.

@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot bot commented Apr 15, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/web/src/components/cloud-agent-next/hooks/useSidebarSessions.ts 92 Switching from unifiedSessions.list to cliSessionsV2.list drops legacy cli_sessions rows from the sidebar/search before the backfill is complete.
apps/web/src/routers/cli-sessions-v2-router.ts 331 Search escaping still leaves backslashes unescaped before interpolating into ILIKE, matching the existing CodeQL finding.
Other Observations (not in diff)

No additional observations outside the diff.

Fix these issues in Kilo Cloud

Files Reviewed (10 files)
  • .plans/session-list-v2-migration.md - 0 issues
  • apps/web/src/app/(app)/cloud/sessions/SessionsPageContent.tsx - 0 issues
  • apps/web/src/components/cloud-agent-next/CloudChatPage.tsx - 0 issues
  • apps/web/src/components/cloud-agent-next/CloudSidebarLayout.tsx - 0 issues
  • apps/web/src/components/cloud-agent-next/NewSessionPanel.tsx - 0 issues
  • apps/web/src/components/cloud-agent-next/hooks/useSidebarSessions.ts - 1 issue
  • apps/web/src/components/cloud-agent-next/store/db-session-atoms.test.ts - 0 issues
  • apps/web/src/components/cloud-agent-next/store/db-session-atoms.ts - 0 issues
  • apps/web/src/components/cloud-agent/CloudSessionsPage.tsx - 0 issues
  • apps/web/src/routers/cli-sessions-v2-router.ts - 1 issue

Reviewed by gpt-5.4-20260305 · 968,019 tokens

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