Cloud Sessions - Unify v1/v2 sessions and refactor ResumeConfigModal#361
Cloud Sessions - Unify v1/v2 sessions and refactor ResumeConfigModal#361
Conversation
| }) | ||
| ); | ||
|
|
||
| const isLoadingRepos = isLoadingGitHubRepos && isLoadingGitLabRepos; |
There was a problem hiding this comment.
WARNING: Logic bug — && should be ||
With &&, isLoadingRepos is only true when both GitHub and GitLab queries are loading simultaneously. As soon as one finishes, the loading indicator disappears even though the other query is still in-flight, causing the repository list to appear incomplete.
| const isLoadingRepos = isLoadingGitHubRepos && isLoadingGitLabRepos; | |
| const isLoadingRepos = isLoadingGitHubRepos || isLoadingGitLabRepos; |
|
|
||
| // Search filter: ILIKE on title and session_id::text | ||
| v1Where.push( | ||
| sql`(${cliSessions.title} ILIKE ${`%${search_string}%`} OR ${cliSessions.session_id}::text ILIKE ${`%${search_string}%`})` |
There was a problem hiding this comment.
SUGGESTION: ILIKE wildcard characters (%, _) in search_string are not escaped
If a user searches for a literal % or _, those characters will be interpreted as ILIKE wildcards, producing unexpected results. Consider escaping them before interpolation:
const escaped = search_string.replace(/[%_]/g, '\\$&');Then use escaped in the ILIKE patterns instead of search_string.
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Fix these issues in Kilo Cloud Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (28 files)
|
| return sql` | ||
| ${cli_sessions_v2.session_id} AS session_id, | ||
| COALESCE(${cli_sessions_v2.title}, 'Untitled') AS title, | ||
| NULL AS git_url, |
There was a problem hiding this comment.
WARNING: cli_sessions_v2 has a git_url column (see schema line 2115), but this hardcodes NULL. V2 sessions that have a git_url set will never display their repository in the UI.
Was this intentional (e.g., v2 sessions never populate git_url yet), or should this read ${cli_sessions_v2.git_url} AS git_url like the v1 projection?
Summary
unified-sessions-router.ts) that queries bothcli_sessions(v1) andcli_sessions_v2(v2) tables via UNION ALL, providing a single API for listing and searching sessions across both versions.cliSessions/cliSessionsV2tRPC routes to the newunifiedSessionsrouter.ResumeConfigModal(cloud-agent-next) to useRepositoryComboboxfor repo selection and a free-text branch input, replacing the previous read-only display that derived repo/branch fromgit_url/git state.githubRepoandbranchfields toResumeConfig/StreamResumeConfigtypes, and propagatesupstreamBranchthrough toprepareSession.SessionsList,ChatSidebar, and the sessions page to handle v2 sessions that don't storegit_url.kilo_user_id,updated_at) oncli_sessions_v2for efficient unified query ordering, with corresponding Drizzle migration.