Repository navigation
feat(desktop,mobile,trpc): replace Electric sync with plain tRPC + React Query - #6328
Conversation
|
Too many files changed for review (153 files, 100 file limit). Bypass the limit by tagging |
📝 WalkthroughWalkthroughThe pull request replaces Electric and Durable Streams data paths with cloud tRPC and React Query flows. It removes legacy chat, agent, terminal, workspace, and synchronization infrastructure across API, desktop, mobile, and host-service components. ChangesCloud data migration and legacy infrastructure removal
Estimated code review effort: 5 (Critical) | ~120 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
There was a problem hiding this comment.
Actionable comments posted: 19
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/InviteMemberButton/components/InviteMemberDialog/InviteMemberDialog.tsx (1)
65-69: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDo not report a failed refetch as a failed invitation.
Line 65 awaits
invalidate()inside thetryblock.invalidate()refetches active queries and can reject. If it rejects, the catch at line 70 shows "Failed to send invitation" although the invitation was sent, and the dialog stays open with the email retained. Show the success result first, then invalidate.🐛 Proposed fix to separate the invitation result from the cache refresh
- await utils.organization.listInvitations.invalidate(); toast.success(`Invitation sent to ${email}`); setEmail(""); setRole("member"); onOpenChange(false); + void utils.organization.listInvitations.invalidate();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/InviteMemberButton/components/InviteMemberDialog/InviteMemberDialog.tsx` around lines 65 - 69, Update the success flow in InviteMemberDialog so the invitation success toast, form reset, role reset, and dialog close occur immediately after the send operation succeeds, before awaiting utils.organization.listInvitations.invalidate(). Move the invalidation outside the try/catch that reports invitation failures, so a rejected cache refresh cannot show “Failed to send invitation” or leave the dialog open.apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx (1)
37-47: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winDerive project options from a page-limited task set.
Lines 37-47 build the project options only from the rows returned for
TASK_LIST_INPUT, which caps the result at 500 tasks. A project that appears only in later tasks is not selectable. The same cap also affects line 50: if the activevalueis missing fromprojects, the trigger shows "Project" while the filter still applies to the table. See the consolidated comment for the shared cause.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx` around lines 37 - 47, The projects list in the useMemo block must be derived from the complete available project dataset rather than the page-limited taskRows from TASK_LIST_INPUT. Update LinearProjectFilter to use the shared source of all Linear projects, ensuring projects beyond the 500-task limit are selectable and the active value remains represented in the options.apps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.ts (1)
203-217: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winKey snapshots by organization and host.
At Line 211, the hook reads snapshots by
target.machineId. Snapshot loading and persistence use bothorganizationIdandmachineId. If the active organization changes while this hook remains mounted, a matching machine ID can render workspace rows from the previous organization. The snapshot also satisfiesisReady.Use an organization-and-host composite key for
snapshots, or clear snapshots when the organization changes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.ts` around lines 203 - 217, Update the snapshot lookup in the useHostWorkspaces useMemo to key snapshots by both the active organization identifier and target.machineId, matching the key used by snapshot loading and persistence. Ensure organization changes cannot reuse rows from the previous organization and preserve the existing live-query fallback and readiness behavior.apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts (1)
150-178: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winInvalidate the cached session list after a delete.
handleDeleteSessioncallsapiTrpcClient.chat.deleteSession.mutate, but nothing invalidatescloudTrpc.chat.listSessions. The query usesstaleTime: 30_000, so the deleted session stays insessionItemsand remains selectable until the cache refetches. Invalidate the query after the mutation resolves.🔧 Proposed fix
+ const cloudUtils = cloudTrpc.useUtils(); + const handleDeleteSession = useCallback( async (sessionIdToDelete: string) => { try { await apiTrpcClient.chat.deleteSession.mutate({ sessionId: sessionIdToDelete, }); + await cloudUtils.chat.listSessions.invalidate(); posthog.capture("chat_session_deleted", {Add
cloudUtilsto the dependency array.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts` around lines 150 - 178, Update handleDeleteSession to invalidate the cloudTrpc.chat.listSessions query immediately after deleteSession.mutate resolves, using the existing cloudUtils helper. Add cloudUtils to the useCallback dependency array while preserving the current success, switching, and error-handling behavior.
🧹 Nitpick comments (9)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/AutomationRow/AutomationRow.tsx (1)
33-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExport
AutomationSummaryonce and reuse it.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsxdeclares the same alias at line 33. Two independent declarations of the same router-derived type can drift. Export the type from this file and import it in the page.♻️ Proposed change
-type AutomationSummary = RouterOutputs["automation"]["list"][number]; +export type AutomationSummary = RouterOutputs["automation"]["list"][number];Then in
apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx, replace the local alias with an import from theAutomationRowbarrel.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/AutomationRow/AutomationRow.tsx` around lines 33 - 36, Export the AutomationSummary type alias from the AutomationRow module, then remove the duplicate local alias in the automations page and import AutomationSummary from the AutomationRow barrel. Keep AutomationRowProps and all existing type usage unchanged while ensuring both files share the single router-derived definition.apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx (1)
270-295: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy liftGate these queries on the dropdown being open.
HistoryDropdownrenders in the always-mounted navigation chrome. These three queries therefore run on every app launch and refetch every 30 seconds of interaction: all automations, all task statuses, and up to 500 task rows. The data is only needed to label dropdown rows.
AssigneeCellalready usesenabled: openfor the same reason. Apply the same gating here. Note that line 315 usesfilteredEntries.lengthto disable the trigger, so the trigger state must be derived fromrecentEntriesinstead of the resolved query data.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx` around lines 270 - 295, Gate the automation list, task list, and task-status queries in HistoryDropdown with enabled: open, matching AssigneeCell. Update the trigger-disable logic near filteredEntries to derive from recentEntries rather than resolved query data, so it remains correct while gated queries are disabled.apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts (2)
36-36: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winDerive
TaskPatchfrom the mutation input, not from the row shape.
TaskPatchisPartial<TaskRecord>, and line 225 spreads it directly intotask.update.mutate. The type therefore permits sending server-owned columns such asslug,organizationId, orcreatedAtto the mutation, and TypeScript accepts it. Derive the patch type from the router input so the compiler rejects unsupported fields.♻️ Proposed change
-import type { RouterOutputs } from "`@superset/trpc`"; +import type { RouterInputs, RouterOutputs } from "`@superset/trpc`"; @@ -type TaskPatch = Partial<TaskRecord>; +type TaskPatch = Omit<RouterInputs["task"]["update"], "id">;Confirm that
RouterInputsis exported from@superset/trpcbefore you apply this.Also applies to: 224-225
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts` at line 36, Replace the TaskPatch definition with the update mutation input type derived from the exported RouterInputs from `@superset/trpc`, targeting the task.update mutation input. Update the TaskPatch usages in the optimistic update flow, including the task.update.mutate call, so TypeScript rejects server-owned fields while preserving the existing mutation behavior.
411-430: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the unused
organizationIdparameter.v2Host.addMemberderivesorganizationIdfrom the active session. Remove it from the action signature and its caller.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts` around lines 411 - 430, Remove the unused organizationId field from the addMember action input type and update its caller to stop supplying that argument; keep the v2Host.addMember mutation and remaining hostId, userId, and role handling unchanged.apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx (1)
19-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShared read contracts live inside feature-specific directories and are deep-imported across feature trees. The command palette now reaches into the dashboard
HistoryDropdownandTasksViewdirectories for shared query inputs and join helpers. The repository convention is to promote code shared by two or more consumers to the highest shared parent, so these helpers belong in a shared location rather than inside one consumer's subtree.
apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx#L19-L22: movejoinTasksWithStatusesandTASK_LOOKUP_LIMITout of theHistoryDropdown/utilssubtree into a shared task-read module, then import from there.apps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsx#L15-L15: moveTASK_LIST_INPUTout of theTasksView/hooks/useTasksDatasubtree into the same shared task-read module, then import from there.Based on coding guidelines: "Co-locate components, utilities, hooks, constants, configuration, tests, and stories with the code that uses them; promote components shared by two or more consumers to the highest shared parent."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx` around lines 19 - 22, Promote the shared task-read helpers into a common task-read module: move joinTasksWithStatuses and TASK_LOOKUP_LIMIT from the HistoryDropdown utilities and TASK_LIST_INPUT from TasksView/hooks/useTasksData, then update imports in apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx (lines 19-22) and apps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsx (line 15) to use that module.Source: Coding guidelines
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/GroupStrip/GroupStrip.tsx (1)
148-156: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winDisable the chat-session poll when no chat pane needs a title.
The query runs unconditionally and repeats every 30 seconds. It returns every chat session of the organization, and Line 152-156 discards all of them when
shouldSyncChatTitlesis false. The former local query short-circuited throughNO_WORKSPACE_MATCHand cost nothing. A workspace with only terminal panes now keeps an organization-wide poll running.Gate the query on the same condition the effect already uses.
♻️ Proposed refactor
const { data: allChatSessions = [] } = cloudTrpc.chat.listSessions.useQuery( undefined, - { refetchInterval: 30_000 }, + { enabled: shouldSyncChatTitles, refetchInterval: 30_000 }, );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/GroupStrip/GroupStrip.tsx` around lines 148 - 156, Gate the cloudTrpc.chat.listSessions query in GroupStrip so it only runs when shouldSyncChatTitles is true, using the query's enabled/conditional mechanism while preserving the existing 30-second polling interval and chatSessions filtering behavior.apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.ts (1)
442-446: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winGate the organization-wide pull-request poll on actual demand.
This query fetches every pull request of the organization and repeats every 30 seconds. The result is consumed only at Line 481-485, where a row needs both
projectRepoIdand aprNumberfrom the host query. Unscoped callers (palette, dev seeding) never deriveprNumber, so the poll runs with no consumer.Add the demand condition to
enabled.♻️ Proposed refactor
const { data: prRows = [] } = cloudTrpc.integration.github.listOrganizationPullRequests.useQuery( { organizationId: activeOrganizationId ?? "" }, - { enabled: activeOrganizationId != null, refetchInterval: 30_000 }, + { + enabled: activeOrganizationId != null && prNumberByWorkspaceId.size > 0, + refetchInterval: 30_000, + }, );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.ts` around lines 442 - 446, Update the enabled condition for listOrganizationPullRequests in useAccessibleV2Workspaces so polling occurs only when the downstream row-building logic at the PR lookup also has an active consumer requiring both projectRepoId and a host-derived prNumber. Preserve the existing organization ID guard and 30-second refetch interval, while disabling the query for unscoped callers that never derive prNumber.apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.ts (1)
37-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the accessible-host derivation into one shared hook.
This block repeats the host access rule already implemented in
useAccessibleV2Workspaces.ts: queryv2Host.list, queryv2Host.listMembers, filter memberships by the current user, then intersect with hosts of the active organization. Two copies of an access rule drift independently.Move the pair of queries and the membership intersection into a shared hook, then consume it from both call sites.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.ts` around lines 37 - 63, Extract the host queries and user-membership/active-organization intersection from useWorkspaceHostOptions into a shared hook, reusing the existing access-rule implementation in useAccessibleV2Workspaces.ts or consolidating both there. Update useWorkspaceHostOptions and useAccessibleV2Workspaces to consume that hook, preserving the existing accessible host/workspace outputs and query options.apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts (1)
180-182: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify the now-constant readiness surface.
ensureCurrentSessionRecordno longer ensures anything; it returnsBoolean(sessionId).isSessionInitializingis a literalfalse, andhasCurrentSessionRecordduplicatesBoolean(sessionId). Consumers can derive all three fromsessionId. Remove the redundant fields fromUseChatPaneControllerReturn, or renameensureCurrentSessionRecordto reflect the check-only behavior.Also applies to: 212-213
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts` around lines 180 - 182, Remove the redundant readiness fields from UseChatPaneControllerReturn and the useChatPaneController return value, including ensureCurrentSessionRecord, isSessionInitializing, and hasCurrentSessionRecord. Update all consumers to derive readiness directly from sessionId, or rename ensureCurrentSessionRecord only if a callable check is still required.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/desktop/src/renderer/hooks/known-hosts/useKnownHosts/useKnownHosts.ts`:
- Around line 82-89: Update the persistence deduplication logic in the
useKnownHosts effect so the key includes organizationId, or reset
lastPersistedRef when the organization changes. Ensure identical liveRows for
different organizations still trigger saveKnownHostsSnapshot independently.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/`$automationId/page.tsx:
- Around line 40-44: Update the setEnabledMutation success flow in the
automation detail page to invalidate or optimistically update the
cloudTrpc.automation.get cache after automation.setEnabled.mutate succeeds,
ensuring AutomationDetailHeader immediately reflects the new enabled state while
preserving the existing polling behavior.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx`:
- Around line 44-60: The externalAssignees useMemo currently derives options
from the 500-row taskRows page, excluding assignees on later tasks. Update the
AssigneeFilter data flow to source external assignees from the complete task set
or a dedicated unpaginated assignee query, while preserving deduplication by
external ID and the existing option shape.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx`:
- Around line 45-55: Update the tasks useMemo flow in useTasksData so tasks are
not filtered out when their status is missing from the cached statuses list, and
do not return an empty task list solely because statuses are unresolved.
Preserve each task row and provide the appropriate unresolved-status behavior
used by the task detail page, while continuing to enrich tasks with cached
status data when available.
- Around line 45-55: Update useTasksData’s task/status join to preserve task
records when statusById cannot resolve their status, or expose the status list
separately so callers can distinguish stale status data from missing tasks;
update
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx
lines 73-89 to keep loading while taskRecord exists but its status is
unresolved, rather than rendering “Task not found.”
- Around line 12-13: The task filters currently rely on the capped
TASK_LIST_INPUT as their complete data source. In
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx:12-13,
add task-list pagination or raise the limit above the expected task count and
document the ceiling; in
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx:44-60,
source external assignee options from a dedicated procedure returning all
distinct values; and in
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx:37-47,
source project options from a dedicated procedure returning all distinct
external projects.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/hooks/usePaneRegistry/components/ChatPane/hooks/useWorkspaceChatController/useWorkspaceChatController.ts:
- Around line 72-80: Update the successful create flow in
useWorkspaceChatController, specifically createSessionRecord, to reconcile
cloudTrpc.chat.listSessions after creating a session. Either add the new session
to the query cache optimistically or invalidate utils.chat.listSessions so
sessionItems reflects it while the controller remains mounted.
In
`@apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts`:
- Around line 134-153: Make the optimistic patcher asynchronous and await every
queryClient.cancelQueries call for listKey and detailKeys before capturing
previousLists/previousDetails or applying setQueriesData. Update updateTask to
await the patcher before the API call, or explicitly await patch setup in
parallel while preserving rollback and mutation ordering.
In
`@apps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/CollectionsProvider.tsx`:
- Around line 27-58: Update ORG_SCOPED_CLOUD_ROUTERS and
dropCloudQueriesForOrgSwitch to derive the cloud-only router set from the shared
or generated cloudTrpc router source instead of manually maintaining or
inverting the query predicate. Preserve eviction exclusively for
organization-scoped cloud routers, ensuring Electron IPC queries such as
settings, workspaces, and auth remain untouched while newly added cloud routers
are included automatically.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/billing/plans/page.tsx`:
- Around line 236-242: The interval comparison around isCurrentlyYearly must
remain neutral while activePlan is unresolved. Gate the comparison on the
active-plan query’s resolved state and treat intervalMatches as true until
activePlan is available, preventing the Pro card’s interval-change action from
rendering during the loading window while preserving normal comparison behavior
once resolved.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsx`:
- Around line 39-42: Update the cloudTrpc.integration.list query in
IntegrationsSettings to read its isPending state, then pass that value as
isLoading to both the Linear and Slack IntegrationRow components so they show
loading content instead of “Not connected” during the initial request.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/MemberActions/MemberActions.tsx`:
- Line 72: Update the success handlers in MemberActions to report the mutation
result before awaiting organization member-cache invalidation, so a rejected
refresh cannot turn a successful removal or role change into a failure. Adjust
both invalidate calls associated with the member removal and role-change flows,
while preserving the existing cache refresh behavior.
- Around line 63-64: Update the mutation success handlers so invalidation cannot
block or surface as a mutation failure: in MemberActions.tsx at lines 63-64,
navigate before calling organization.listMembers.invalidate and do not await it;
at line 72, resolve removeMember after the mutation and do not await
invalidation; at line 121, show the role-change success toast before non-awaited
invalidation; in InviteMemberDialog.tsx at lines 65-69, show the success toast
and reset the form before non-awaited invalidation.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/MembersSettings.tsx`:
- Around line 55-76: Update the members data flow around the members mapping and
listMembers procedure to use the organizationId returned by listMembers instead
of activeOrganizationId. Ensure the query is scoped to the active organization
and suppress or discard cached rows whose returned organizationId does not match
the active organization before exposing them to MemberActions.
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts`:
- Around line 109-148: Update createAndActivateSession to persist the new
session through apiTrpcClient.chat.createSession using the same newSessionId
before calling switchChatSession. Ensure both handleNewChat and
handleStartFreshSession await the persistence operation while preserving their
existing analytics and return behavior.
In `@apps/mobile/hooks/useWorkspaceHost/useWorkspaceHost.ts`:
- Around line 28-32: Update useWorkspaceHost to consume the pending/loading
state exposed by useOrgHosts alongside hosts, and include that state in the
isResolving result near the queries.some(...) check. Keep resolution pending
while the host list is loading, even when targets and workspace queries are
empty, while preserving the existing query-based resolution behavior afterward.
In
`@apps/mobile/screens/`(authenticated)/hooks/useOrganizations/useOrganizations.ts:
- Around line 12-16: Update the organization-switching flow around the
useOrganizations hook and related useOrgHosts, useOrgMembers, and useActivePlan
queries to clear or invalidate organization-scoped cached queries when the
active organization changes. Target the stable organization data query keys,
including the ["cloud"] namespace, while preserving the existing myOrganizations
query behavior.
In `@apps/mobile/screens/`(authenticated)/hooks/useOrgMembers/useOrgMembers.ts:
- Around line 11-15: Update useOrgMembers in
apps/mobile/screens/(authenticated)/hooks/useOrgMembers/useOrgMembers.ts at
lines 11-15 to read activeOrganizationId from the session, include it in the
listMembers queryKey, and enable the query only when the identifier is
available. Apply the same change in useActivePlan at
apps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.ts
lines 9-13: include activeOrganizationId in the activePlan queryKey and gate the
query with enabled.
In `@packages/trpc/src/router/integration/github/github.ts`:
- Around line 183-191: Bound the listOrganizationPullRequests query by adding
cursor pagination or an intentional limit combined with a state filter, rather
than returning every organization pull request. Update the
githubPullRequests.findMany call while preserving descending updatedAt ordering
and the existing organizationId filter.
---
Outside diff comments:
In
`@apps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.ts`:
- Around line 203-217: Update the snapshot lookup in the useHostWorkspaces
useMemo to key snapshots by both the active organization identifier and
target.machineId, matching the key used by snapshot loading and persistence.
Ensure organization changes cannot reuse rows from the previous organization and
preserve the existing live-query fallback and readiness behavior.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx`:
- Around line 37-47: The projects list in the useMemo block must be derived from
the complete available project dataset rather than the page-limited taskRows
from TASK_LIST_INPUT. Update LinearProjectFilter to use the shared source of all
Linear projects, ensuring projects beyond the 500-task limit are selectable and
the active value remains represented in the options.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/InviteMemberButton/components/InviteMemberDialog/InviteMemberDialog.tsx`:
- Around line 65-69: Update the success flow in InviteMemberDialog so the
invitation success toast, form reset, role reset, and dialog close occur
immediately after the send operation succeeds, before awaiting
utils.organization.listInvitations.invalidate(). Move the invalidation outside
the try/catch that reports invitation failures, so a rejected cache refresh
cannot show “Failed to send invitation” or leave the dialog open.
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts`:
- Around line 150-178: Update handleDeleteSession to invalidate the
cloudTrpc.chat.listSessions query immediately after deleteSession.mutate
resolves, using the existing cloudUtils helper. Add cloudUtils to the
useCallback dependency array while preserving the current success, switching,
and error-handling behavior.
---
Nitpick comments:
In
`@apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx`:
- Around line 19-22: Promote the shared task-read helpers into a common
task-read module: move joinTasksWithStatuses and TASK_LOOKUP_LIMIT from the
HistoryDropdown utilities and TASK_LIST_INPUT from TasksView/hooks/useTasksData,
then update imports in
apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx
(lines 19-22) and
apps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsx (line 15)
to use that module.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/AutomationRow/AutomationRow.tsx`:
- Around line 33-36: Export the AutomationSummary type alias from the
AutomationRow module, then remove the duplicate local alias in the automations
page and import AutomationSummary from the AutomationRow barrel. Keep
AutomationRowProps and all existing type usage unchanged while ensuring both
files share the single router-derived definition.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx`:
- Around line 270-295: Gate the automation list, task list, and task-status
queries in HistoryDropdown with enabled: open, matching AssigneeCell. Update the
trigger-disable logic near filteredEntries to derive from recentEntries rather
than resolved query data, so it remains correct while gated queries are
disabled.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.ts`:
- Around line 442-446: Update the enabled condition for
listOrganizationPullRequests in useAccessibleV2Workspaces so polling occurs only
when the downstream row-building logic at the PR lookup also has an active
consumer requiring both projectRepoId and a host-derived prNumber. Preserve the
existing organization ID guard and 30-second refetch interval, while disabling
the query for unscoped callers that never derive prNumber.
In
`@apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.ts`:
- Around line 37-63: Extract the host queries and
user-membership/active-organization intersection from useWorkspaceHostOptions
into a shared hook, reusing the existing access-rule implementation in
useAccessibleV2Workspaces.ts or consolidating both there. Update
useWorkspaceHostOptions and useAccessibleV2Workspaces to consume that hook,
preserving the existing accessible host/workspace outputs and query options.
In
`@apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts`:
- Line 36: Replace the TaskPatch definition with the update mutation input type
derived from the exported RouterInputs from `@superset/trpc`, targeting the
task.update mutation input. Update the TaskPatch usages in the optimistic update
flow, including the task.update.mutate call, so TypeScript rejects server-owned
fields while preserving the existing mutation behavior.
- Around line 411-430: Remove the unused organizationId field from the addMember
action input type and update its caller to stop supplying that argument; keep
the v2Host.addMember mutation and remaining hostId, userId, and role handling
unchanged.
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/GroupStrip/GroupStrip.tsx`:
- Around line 148-156: Gate the cloudTrpc.chat.listSessions query in GroupStrip
so it only runs when shouldSyncChatTitles is true, using the query's
enabled/conditional mechanism while preserving the existing 30-second polling
interval and chatSessions filtering behavior.
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts`:
- Around line 180-182: Remove the redundant readiness fields from
UseChatPaneControllerReturn and the useChatPaneController return value,
including ensureCurrentSessionRecord, isSessionInitializing, and
hasCurrentSessionRecord. Update all consumers to derive readiness directly from
sessionId, or rename ensureCurrentSessionRecord only if a callable check is
still required.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c39eeb76-99cd-4e42-9693-27fd157cc0eb
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (152)
.env.example.github/workflows/deploy-preview.yml.github/workflows/deploy-production.ymlapps/api/package.jsonapps/api/src/app/api/chat/[sessionId]/route.tsapps/api/src/app/api/chat/[sessionId]/stream/route.tsapps/api/src/app/api/chat/lib.tsapps/api/src/app/api/chat/tools/web-search/route.tsapps/api/src/env.tsapps/api/src/proxy.tsapps/desktop/package.jsonapps/desktop/src/main/index.tsapps/desktop/src/main/lib/quit-sequence.test.tsapps/desktop/src/main/lib/quit-sequence.tsapps/desktop/src/main/network-logger-sweep.tsapps/desktop/src/main/network-logger/index.tsapps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsxapps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsxapps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsxapps/desktop/src/renderer/components/Chat/components/LinkedTaskChip/LinkedTaskChip.tsxapps/desktop/src/renderer/components/Paywall/usePaywall.tsapps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.tsapps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.utils.tsapps/desktop/src/renderer/hooks/known-hosts/useKnownHosts/useKnownHosts.tsapps/desktop/src/renderer/hooks/known-hosts/useKnownHosts/useKnownHosts.utils.tsapps/desktop/src/renderer/hooks/useCurrentPlan.tsapps/desktop/src/renderer/lib/api-trpc-client.tsapps/desktop/src/renderer/lib/cloud-trpc.tsapps/desktop/src/renderer/lib/dev-chat.test.tsapps/desktop/src/renderer/lib/dev-chat.tsapps/desktop/src/renderer/lib/jwt-refresh/index.tsapps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.test.tsapps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.tsapps/desktop/src/renderer/providers/ElectronTRPCProvider/ElectronTRPCProvider.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/AutomationRow/AutomationRow.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/WorkspacePicker/WorkspacePicker.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceHoverCardContent/components/LinkedTaskSection/LinkedTaskSection.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/utils/joinTasksWithStatuses/index.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/utils/joinTasksWithStatuses/joinTasksWithStatuses.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/OrganizationDropdown/OrganizationDropdown.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/hooks/useFailedAutomations/useFailedAutomations.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/AssigneeProperty/AssigneeProperty.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/StatusProperty/StatusProperty.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/TasksView.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTableView/components/TaskContextMenu/TaskContextMenu.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/CreateTaskDialog/CreateTaskDialog.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/index.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/AssigneeCell/AssigneeCell.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/StatusCell/StatusCell.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/useTasksTable.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useConsumeAutomationRunLink/useConsumeAutomationRunLink.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/hooks/useWorkspaceChatController/useWorkspaceChatController.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/hooks/useRemoteHostStatus/useRemoteHostStatus.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/AgentHooks.tsxapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/index.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/create-worktree.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/delete-workspace.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-app-context.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-workspace-details.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/index.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-projects.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.test.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.utils.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/start-agent-session.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/switch-workspace.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/types.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/update-workspace.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/useCommandWatcher.tsapps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.tsapps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.tsapps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/CollectionsProvider.tsxapps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/collections.tsapps/desktop/src/renderer/routes/_authenticated/settings/account/components/AccountSettings/AccountSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/api-keys/components/ApiKeysSettings/ApiKeysSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/billing/components/BillingOverview/BillingOverview.tsxapps/desktop/src/renderer/routes/_authenticated/settings/billing/plans/page.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/$hostId/components/HostSettings/HostSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/components/HostsSettingsSidebar/HostsSettingsSidebar.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/page.tsxapps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/MembersSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/InviteMemberButton/components/InviteMemberDialog/InviteMemberDialog.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/MemberActions/MemberActions.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/PendingInvitations.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/components/InvitationActions/InvitationActions.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/types.tsapps/desktop/src/renderer/routes/_authenticated/settings/organization/components/OrganizationSettings/OrganizationSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/project/$projectId/cloud/secrets/components/SecretsSettings/SecretsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/TeamDetailSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/components/AddMemberButton/AddMemberButton.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/TeamsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/components/CreateTeamButton/CreateTeamButton.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/GroupStrip/GroupStrip.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.test.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.tsapps/electric-proxy/src/where.tsapps/mobile/AGENTS.mdapps/mobile/app/(authenticated)/_layout.tsxapps/mobile/hooks/useOrgHosts/index.tsapps/mobile/hooks/useOrgHosts/useOrgHosts.tsapps/mobile/hooks/useWorkspaceHost/useWorkspaceHost.tsapps/mobile/lib/collections/collections.tsapps/mobile/lib/env.tsapps/mobile/package.jsonapps/mobile/screens/(authenticated)/(home)/filter/FilterScreen.tsxapps/mobile/screens/(authenticated)/(home)/filter/host/HostFilterScreen.tsxapps/mobile/screens/(authenticated)/(home)/filter/project/ProjectFilterScreen.tsxapps/mobile/screens/(authenticated)/(home)/home/HomeScreen.tsxapps/mobile/screens/(authenticated)/(home)/home/components/NewChatWidget/hooks/useNewChatTargets/useNewChatTargets.tsapps/mobile/screens/(authenticated)/(home)/home/hooks/useHostTerminalAgents/useHostTerminalAgents.tsapps/mobile/screens/(authenticated)/(home)/hooks/useSelectedHost/useSelectedHost.tsapps/mobile/screens/(authenticated)/hooks/useOrgMembers/index.tsapps/mobile/screens/(authenticated)/hooks/useOrgMembers/useOrgMembers.tsapps/mobile/screens/(authenticated)/hooks/useOrganizations/useOrganizations.tsapps/mobile/screens/(authenticated)/hooks/usePullRequests/index.tsapps/mobile/screens/(authenticated)/hooks/usePullRequests/usePullRequests.tsapps/mobile/screens/(authenticated)/providers/CollectionsProvider/CollectionsProvider.tsxapps/mobile/screens/(authenticated)/providers/CollectionsProvider/index.tsapps/mobile/screens/(authenticated)/settings/SettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/billing/BillingSettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/index.tsapps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.tsapps/mobile/screens/(authenticated)/settings/hosts/HostsSettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/organization/OrganizationSettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/utils/activeSubscription/activeSubscription.tsapps/mobile/screens/(authenticated)/settings/utils/activeSubscription/index.tsapps/mobile/screens/(authenticated)/workspace/[id]/chat/[sessionId]/ChatThreadScreen.tsxapps/mobile/screens/(authenticated)/workspace/[id]/commits/components/AuthorAvatar/AuthorAvatar.tsxapps/mobile/screens/(authenticated)/workspace/[id]/hooks/useWorkspaceHeaderActions/useWorkspaceHeaderActions.tsapps/mobile/screens/(authenticated)/workspace/[id]/hooks/useWorkspacePullRequest/useWorkspacePullRequest.tspackages/trpc/src/root.tspackages/trpc/src/router/agent/agent.tspackages/trpc/src/router/agent/index.tspackages/trpc/src/router/api-key/api-key.tspackages/trpc/src/router/automation/automation.tspackages/trpc/src/router/billing/billing.tspackages/trpc/src/router/chat/chat.tspackages/trpc/src/router/integration/github/github.tspackages/trpc/src/router/organization/organization.tspackages/trpc/src/router/project/project.tspackages/trpc/src/router/task/statuses.tspackages/trpc/src/router/v2-host/v2-host.ts
💤 Files with no reviewable changes (46)
- apps/api/package.json
- apps/mobile/screens/(authenticated)/settings/utils/activeSubscription/index.ts
- apps/mobile/screens/(authenticated)/settings/utils/activeSubscription/activeSubscription.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/index.ts
- apps/desktop/package.json
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.ts
- apps/mobile/screens/(authenticated)/providers/CollectionsProvider/index.ts
- .env.example
- apps/desktop/src/renderer/lib/jwt-refresh/index.ts
- apps/desktop/src/main/lib/quit-sequence.test.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/AgentHooks.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.ts
- apps/mobile/lib/collections/collections.ts
- apps/mobile/screens/(authenticated)/providers/CollectionsProvider/CollectionsProvider.tsx
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/start-agent-session.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-app-context.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/update-workspace.ts
- apps/api/src/env.ts
- apps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.test.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/types.ts
- packages/trpc/src/router/agent/agent.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/switch-workspace.ts
- apps/api/src/app/api/chat/[sessionId]/stream/route.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.utils.ts
- packages/trpc/src/router/agent/index.ts
- apps/desktop/src/renderer/lib/dev-chat.ts
- apps/desktop/src/renderer/lib/dev-chat.test.ts
- apps/mobile/package.json
- .github/workflows/deploy-production.yml
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-projects.ts
- packages/trpc/src/root.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/index.ts
- apps/mobile/lib/env.ts
- .github/workflows/deploy-preview.yml
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-workspace-details.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/delete-workspace.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/useCommandWatcher.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.test.ts
- apps/api/src/app/api/chat/tools/web-search/route.ts
- apps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.ts
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.test.ts
- apps/desktop/src/main/network-logger/index.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/create-worktree.ts
- apps/desktop/src/main/lib/quit-sequence.ts
- apps/api/src/app/api/chat/[sessionId]/route.ts
- apps/api/src/app/api/chat/lib.ts
| const externalAssignees = useMemo(() => { | ||
| if (!allTasks) return []; | ||
| if (!taskRows) return []; | ||
| const seen = new Map< | ||
| string, | ||
| { id: string; name: string | null; avatar: string | null } | ||
| >(); | ||
| for (const t of allTasks) { | ||
| if (t.assigneeExternalId && !seen.has(t.assigneeExternalId)) { | ||
| seen.set(t.assigneeExternalId, { | ||
| id: t.assigneeExternalId, | ||
| name: t.assigneeDisplayName, | ||
| avatar: t.assigneeAvatarUrl, | ||
| for (const { task } of taskRows) { | ||
| if (task.assigneeExternalId && !seen.has(task.assigneeExternalId)) { | ||
| seen.set(task.assigneeExternalId, { | ||
| id: task.assigneeExternalId, | ||
| name: task.assigneeDisplayName, | ||
| avatar: task.assigneeAvatarUrl, | ||
| }); | ||
| } | ||
| } | ||
| return [...seen.values()]; | ||
| }, [allTasks]); | ||
| }, [taskRows]); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Derive the external assignee list from a page-limited task set.
Lines 44-60 build the external assignee options only from the rows returned for TASK_LIST_INPUT. That input caps the result at 500 tasks. An external assignee that appears only on task 501 or later never becomes selectable. See the consolidated comment for the shared cause and the sites involved.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx`
around lines 44 - 60, The externalAssignees useMemo currently derives options
from the 500-row taskRows page, excluding assignees on later tasks. Update the
AssigneeFilter data flow to source external assignees from the complete task set
or a dedicated unpaginated assignee query, while preserving deduplication by
external ID and the existing option shape.
| export const TASK_LIST_INPUT = { limit: 500 }; | ||
| export const TASK_LIST_REFETCH_INTERVAL = 15_000; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
The shared 500-row TASK_LIST_INPUT cap is used as a complete data source. TASK_LIST_INPUT limits every task read to 500 rows. Two filter components derive their full option lists from that single page, so options outside the first 500 tasks never appear.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx#L12-L13: add pagination for the task list, or raise the limit above the expected task count and document the ceiling.apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx#L44-L60: source the external assignee options from a dedicated procedure that returns all distinct external assignees.apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx#L37-L47: source the project options from a dedicated procedure that returns all distinct external projects.
📍 Affects 3 files
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx#L12-L13(this comment)apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx#L44-L60apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx#L37-L47
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx`
around lines 12 - 13, The task filters currently rely on the capped
TASK_LIST_INPUT as their complete data source. In
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx:12-13,
add task-list pagination or raise the limit above the expected task count and
document the ceiling; in
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx:44-60,
source external assignee options from a dedicated procedure returning all
distinct values; and in
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx:37-47,
source project options from a dedicated procedure returning all distinct
external projects.
| const tasks = useMemo(() => { | ||
| if (!taskRows || statuses.length === 0) return []; | ||
| const statusById = new Map(statuses.map((status) => [status.id, status])); | ||
| return taskRows | ||
| .flatMap((row) => { | ||
| const status = statusById.get(row.task.statusId); | ||
| if (!status) return []; | ||
| return [{ ...row.task, status, assignee: row.assignee }]; | ||
| }) | ||
| .sort(compareTasks); | ||
| }, [taskRows, statuses]); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Dropping tasks with an unresolved status hides rows.
Line 51 removes any task whose statusId is absent from the separately cached status list. The two queries have independent cache lifetimes, so a task that uses a newly created status disappears from the table until the next status refetch. Line 46 also returns an empty list while only the status query is unresolved. This shares one root cause with the task detail page. See the consolidated comment.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx`
around lines 45 - 55, Update the tasks useMemo flow in useTasksData so tasks are
not filtered out when their status is missing from the cached statuses list, and
do not return an empty task list solely because statuses are unresolved.
Preserve each task row and provide the appropriate unresolved-status behavior
used by the task detail page, while continuing to enrich tasks with cached
status data when available.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Tasks and statuses are joined on the client from two independently cached queries. Each site requires the task's statusId to exist in the separately cached status list. When the status list is stale, the task is treated as absent instead of unresolved.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx#L45-L55: keep tasks whose status is unresolved, or return the status list separately so the caller can distinguish a stale status list from a missing task.apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx#L73-L89: keep the loading state whiletaskRecordexists and its status is unresolved, so the page does not render "Task not found".
📍 Affects 2 files
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx#L45-L55(this comment)apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx#L73-L89
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx`
around lines 45 - 55, Update useTasksData’s task/status join to preserve task
records when statusById cannot resolve their status, or expose the status list
separately so callers can distinguish stale status data from missing tasks;
update
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx
lines 73-89 to keep loading while taskRecord exists but its status is
unresolved, rather than rendering “Task not found.”
| const { data: organizations } = useQuery({ | ||
| queryKey: ["cloud", "user", "myOrganizations"], | ||
| queryFn: () => apiClient.user.myOrganizations.query(), | ||
| staleTime: 30_000, | ||
| }); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Look for cache clearing tied to the active organization in the mobile app.
rg -nP --type=ts --type=tsx -C5 'activeOrganizationId' apps/mobile | rg -nP -B3 -A6 '(invalidateQueries|removeQueries|resetQueries|clear\(\))'
# Inspect the shared QueryClient setup and providers.
fd -t f 'client.ts|_layout.tsx' apps/mobile/lib apps/mobile/app --exec rg -nP -C4 'QueryClient|invalidateQueries|removeQueries'Repository: superset-sh/superset
Length of output: 190
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- candidate files ---'
fd -t f . apps/mobile | rg 'useOrganizations|organization|QueryClient|_layout|provider|query'
printf '%s\n' '--- organization switch and active organization references ---'
rg -n -C4 'switchOrganization|activeOrganizationId|setActiveOrganization|myOrganizations' apps/mobile -g '*.ts' -g '*.tsx'
printf '%s\n' '--- query cache operations ---'
rg -n -C5 'invalidateQueries|removeQueries|resetQueries|queryClient|QueryClient|clear\(' apps/mobile -g '*.ts' -g '*.tsx'Repository: superset-sh/superset
Length of output: 50376
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- useOrganizations ---'
cat -n 'apps/mobile/screens/(authenticated)/hooks/useOrganizations/useOrganizations.ts'
printf '%s\n' '--- RootLayout ---'
cat -n apps/mobile/screens/RootLayout/RootLayout.tsx
printf '%s\n' '--- authenticated layouts ---'
for f in 'apps/mobile/app/(authenticated)/_layout.tsx' 'apps/mobile/app/(authenticated)/(home)/_layout.tsx' 'apps/mobile/app/_layout.tsx'; do
if [ -f "$f" ]; then
echo "--- $f ---"
cat -n "$f"
fi
done
printf '%s\n' '--- cloud query definitions ---'
rg -n -C6 'queryKey\s*:|useQuery\(|useQueries\(' apps/mobile -g '*.ts' -g '*.tsx' | rg -B6 -A6 'cloud|organization|organizationId|activeOrganization'
printf '%s\n' '--- all cloud key literals ---'
rg -n '["'"'"']cloud|cloud.*organization|organization.*cloud' apps/mobile -g '*.ts' -g '*.tsx'Repository: superset-sh/superset
Length of output: 38509
🏁 Script executed:
#!/bin/bash
set -e
python3 - <<'PY'
from pathlib import Path
import re
root = Path("apps/mobile")
organizations = root / "screens/(authenticated)/hooks/useOrganizations/useOrganizations.ts"
root_layout = root / "screens/RootLayout/RootLayout.tsx"
org_text = organizations.read_text()
layout_text = root_layout.read_text()
print("switches active organization:", "organization.setActive" in org_text)
print("organization hook imports QueryClient:", "useQueryClient" in org_text)
print("organization hook cache operations:",
bool(re.search(r"\b(?:invalidateQueries|removeQueries|resetQueries|clear)\s*\(", org_text)))
print("root QueryClient is module-scoped:",
bool(re.search(r"^const queryClient = new QueryClient\(\);", layout_text, re.M)))
stable_org_queries = {
"useOrgHosts": root / "hooks/useOrgHosts/useOrgHosts.ts",
"useOrgMembers": root / "screens/(authenticated)/hooks/useOrgMembers/useOrgMembers.ts",
"useActivePlan": root / "screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.ts",
"ChatThreadScreen": root / "screens/(authenticated)/workspace/[id]/chat/[sessionId]/ChatThreadScreen.tsx",
}
for name, path in stable_org_queries.items():
text = path.read_text()
keys = re.findall(r"queryKey\s*:\s*([^\n]+)", text)
print(f"{name} query keys:", keys)
print(f"{name} references activeOrganizationId:",
"activeOrganizationId" in text or "organizationId" in text)
PYRepository: superset-sh/superset
Length of output: 787
Clear organization-scoped queries after switching organizations. The global QueryClient persists across routes, while hooks such as useOrgHosts, useOrgMembers, and useActivePlan use stable keys without activeOrganizationId. Switching organizations can therefore render the previous organization’s data until a manual refresh invalidates ["cloud"].
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/mobile/screens/`(authenticated)/hooks/useOrganizations/useOrganizations.ts
around lines 12 - 16, Update the organization-switching flow around the
useOrganizations hook and related useOrgHosts, useOrgMembers, and useActivePlan
queries to clear or invalidate organization-scoped cached queries when the
active organization changes. Target the stable organization data query keys,
including the ["cloud"] namespace, while preserving the existing myOrganizations
query behavior.
| listOrganizationPullRequests: protectedProcedure | ||
| .input(z.object({ organizationId: z.string().uuid() })) | ||
| .query(async ({ ctx, input }) => { | ||
| await verifyOrgMembership(ctx.session.user.id, input.organizationId); | ||
|
|
||
| return db.query.githubPullRequests.findMany({ | ||
| where: eq(githubPullRequests.organizationId, input.organizationId), | ||
| orderBy: [desc(githubPullRequests.updatedAt)], | ||
| }); |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift
Bound this pull-request query.
Line 188 returns every pull request in the organization. This includes unbounded historical closed pull requests. A large organization can create a slow database query, a large tRPC response, and excessive renderer memory use.
Add cursor pagination or an intentional limit with a state filter. Keep the returned page ordered by updatedAt.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/trpc/src/router/integration/github/github.ts` around lines 183 -
191, Bound the listOrganizationPullRequests query by adding cursor pagination or
an intentional limit combined with a state filter, rather than returning every
organization pull request. Update the githubPullRequests.findMany call while
preserving descending updatedAt ordering and the existing organizationId filter.
There was a problem hiding this comment.
8 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mobile/screens/(authenticated)/(home)/filter/host/HostFilterScreen.tsx">
<violation number="1" location="apps/mobile/screens/(authenticated)/(home)/filter/host/HostFilterScreen.tsx:13">
P1: Switching organizations can show and select a host from the previous organization because `useOrgHosts` shares one org-less React Query key. Make its key include active organization identity (and derive that identity in the hook) so this filter reads the current org's cache entry.</violation>
</file>
<file name="apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/hooks/useRemoteHostStatus/useRemoteHostStatus.ts">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/hooks/useRemoteHostStatus/useRemoteHostStatus.ts:37">
P2: Host records stop refreshing while this view remains open: `staleTime` only marks cached data stale, so add a 30-second `refetchInterval` to preserve required host-presence polling.</violation>
</file>
<file name="apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts:372">
P2: Chat-session, host, and membership writes no longer update cached UI optimistically; affected rows remain visible or unchanged until the RPC completes and its invalidated query refetches. Patch the relevant React Query caches before each mutation and restore snapshots on failure, matching the prior collection behavior and this hook's optimistic contract.</violation>
</file>
<file name="apps/mobile/screens/(authenticated)/hooks/useOrganizations/useOrganizations.ts">
<violation number="1" location="apps/mobile/screens/(authenticated)/hooks/useOrganizations/useOrganizations.ts:12">
P2: Opening an authenticated screen before session hydration can issue `myOrganizations` without a confirmed session and surface/cache an auth failure; gate this query on a resolved session.</violation>
</file>
<file name="apps/mobile/screens/(authenticated)/settings/organization/OrganizationSettingsScreen.tsx">
<violation number="1" location="apps/mobile/screens/(authenticated)/settings/organization/OrganizationSettingsScreen.tsx:14">
P1: Switching organizations can display the previous organization’s member list because this query has one cache key despite its result depending on the active organization. Include the active organization ID in `useOrgMembers`’ query key (and invalidate/refetch on a switch).</violation>
</file>
<file name="apps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.ts">
<violation number="1" location="apps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.ts:15">
P2: The hook returns only query.data, collapsing the loading and error states into the same `undefined` a free plan returns, so consumers cannot distinguish "plan not loaded yet" from "genuinely free". Per the PR's documented paywall behavior, cold-start orgs are meant to fail-closed for gated actions, but with this shape a consumer reading `undefined` as free will instead fail-open (e.g., offer trial/paywall-gated actions) while the plan is still resolving. Consider exposing the query result (data + isLoading + isError) or returning a fallback plan value so gating can differentiate the unresolved state.</violation>
</file>
<file name="apps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/components/AddMemberButton/AddMemberButton.tsx">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/components/AddMemberButton/AddMemberButton.tsx:88">
P2: The invalidation targets organization.listTeams, but adding/removing a member mutates a single team's member set, not the org's list of teams. If the member roster is served by a per-team query (e.g. team.get or a members query), this invalidate won't refresh it, and the popover/team view can keep showing the old membership until another refetch happens. Consider invalidating the query that actually supplies the team's members instead.</violation>
</file>
<file name="apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx:76">
P2: Returning `null` when the task exists but its status row hasn’t arrived can make this page fall through to “Task not found.” It’s safer to keep an unresolved/loading state until statuses catch up so existing tasks aren’t misreported as missing.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| export function HostFilterScreen() { | ||
| const router = useRouter(); | ||
| const collections = useCollections(); | ||
| const hosts = useOrgHosts(); |
There was a problem hiding this comment.
P1: Switching organizations can show and select a host from the previous organization because useOrgHosts shares one org-less React Query key. Make its key include active organization identity (and derive that identity in the hook) so this filter reads the current org's cache entry.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mobile/screens/(authenticated)/(home)/filter/host/HostFilterScreen.tsx, line 13:
<comment>Switching organizations can show and select a host from the previous organization because `useOrgHosts` shares one org-less React Query key. Make its key include active organization identity (and derive that identity in the hook) so this filter reads the current org's cache entry.</comment>
<file context>
@@ -1,29 +1,23 @@
export function HostFilterScreen() {
const router = useRouter();
- const collections = useCollections();
+ const hosts = useOrgHosts();
const selectedHost = useSelectedHost();
const setHostFilter = useWorkspacesFilterStore(
</file context>
| staleTime: 30_000, | ||
| }); | ||
|
|
||
| return query.data; |
There was a problem hiding this comment.
P2: The hook returns only query.data, collapsing the loading and error states into the same undefined a free plan returns, so consumers cannot distinguish "plan not loaded yet" from "genuinely free". Per the PR's documented paywall behavior, cold-start orgs are meant to fail-closed for gated actions, but with this shape a consumer reading undefined as free will instead fail-open (e.g., offer trial/paywall-gated actions) while the plan is still resolving. Consider exposing the query result (data + isLoading + isError) or returning a fallback plan value so gating can differentiate the unresolved state.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.ts, line 15:
<comment>The hook returns only query.data, collapsing the loading and error states into the same `undefined` a free plan returns, so consumers cannot distinguish "plan not loaded yet" from "genuinely free". Per the PR's documented paywall behavior, cold-start orgs are meant to fail-closed for gated actions, but with this shape a consumer reading `undefined` as free will instead fail-open (e.g., offer trial/paywall-gated actions) while the plan is still resolving. Consider exposing the query result (data + isLoading + isError) or returning a fallback plan value so gating can differentiate the unresolved state.</comment>
<file context>
@@ -0,0 +1,16 @@
+ staleTime: 30_000,
+ });
+
+ return query.data;
+}
</file context>
| userId: user.id, | ||
| }); | ||
| } | ||
| await utils.organization.listTeams.invalidate(); |
There was a problem hiding this comment.
P2: The invalidation targets organization.listTeams, but adding/removing a member mutates a single team's member set, not the org's list of teams. If the member roster is served by a per-team query (e.g. team.get or a members query), this invalidate won't refresh it, and the popover/team view can keep showing the old membership until another refetch happens. Consider invalidating the query that actually supplies the team's members instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/components/AddMemberButton/AddMemberButton.tsx, line 88:
<comment>The invalidation targets organization.listTeams, but adding/removing a member mutates a single team's member set, not the org's list of teams. If the member roster is served by a per-team query (e.g. team.get or a members query), this invalidate won't refresh it, and the popover/team view can keep showing the old membership until another refetch happens. Consider invalidating the query that actually supplies the team's members instead.</comment>
<file context>
@@ -83,6 +85,7 @@ export function AddMemberButton({
userId: user.id,
});
}
+ await utils.organization.listTeams.invalidate();
} catch (error) {
toast.error(
</file context>
| const task = taskData[0]; | ||
| if (!taskRecord) return null; | ||
| const status = statuses?.find((entry) => entry.id === taskRecord.statusId); | ||
| if (!status) return null; |
There was a problem hiding this comment.
P2: Returning null when the task exists but its status row hasn’t arrived can make this page fall through to “Task not found.” It’s safer to keep an unresolved/loading state until statuses catch up so existing tasks aren’t misreported as missing.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx, line 76:
<comment>Returning `null` when the task exists but its status row hasn’t arrived can make this page fall through to “Task not found.” It’s safer to keep an unresolved/loading state until statuses catch up so existing tasks aren’t misreported as missing.</comment>
<file context>
@@ -67,55 +56,37 @@ function TaskDetailPage() {
- const task = taskData[0];
+ if (!taskRecord) return null;
+ const status = statuses?.find((entry) => entry.id === taskRecord.statusId);
+ if (!status) return null;
+ const findMember = (userId: string | null) =>
+ userId
</file context>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx (1)
49-51: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRemove the shared 500-row limit from task-backed selectors.
TASK_LIST_INPUTcaps the source at 500 rows. Both components treat that response as complete, so users cannot find later tasks or external assignees.
apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx#L49-L51: use pagination or server-side task search.apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx#L38-L38: use the complete external-assignee set or a dedicated assignee query.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx` around lines 49 - 51, Remove the 500-row TASK_LIST_INPUT dependency from IssueLinkCommand.tsx (lines 49-51) by using pagination or server-side task search so all matching tasks are discoverable; update AssigneeFilter.tsx (line 38) to use the complete external-assignee set or a dedicated assignee query. Use the existing query APIs where possible and ensure both selectors no longer treat a capped response as complete.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx`:
- Line 69: Update the open-only filtering around statusMap and
isClosedStatus(undefined) so tasks are not treated as open while allStatuses is
unavailable or status loading failed. Gate the result on successful status
readiness, or render an explicit loading/error state, while preserving normal
filtering once statuses are loaded.
---
Outside diff comments:
In
`@apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx`:
- Around line 49-51: Remove the 500-row TASK_LIST_INPUT dependency from
IssueLinkCommand.tsx (lines 49-51) by using pagination or server-side task
search so all matching tasks are discoverable; update AssigneeFilter.tsx (line
38) to use the complete external-assignee set or a dedicated assignee query. Use
the existing query APIs where possible and ensure both selectors no longer treat
a capped response as complete.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 62cf04c0-2874-46e1-925d-c351b72db60a
📒 Files selected for processing (42)
apps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsxapps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsxapps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsxapps/desktop/src/renderer/components/Chat/components/LinkedTaskChip/LinkedTaskChip.tsxapps/desktop/src/renderer/components/Paywall/usePaywall.tsapps/desktop/src/renderer/hooks/useCurrentPlan.tsapps/desktop/src/renderer/lib/cloud-trpc.tsapps/desktop/src/renderer/providers/ElectronTRPCProvider/ElectronTRPCProvider.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/WorkspacePicker/WorkspacePicker.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceHoverCardContent/components/LinkedTaskSection/LinkedTaskSection.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/OrganizationDropdown/OrganizationDropdown.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/AssigneeProperty/AssigneeProperty.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/StatusProperty/StatusProperty.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/TasksView.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTableView/components/TaskContextMenu/TaskContextMenu.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/CreateTaskDialog/CreateTaskDialog.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/AssigneeCell/AssigneeCell.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/StatusCell/StatusCell.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useConsumeAutomationRunLink/useConsumeAutomationRunLink.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/hooks/useWorkspaceChatController/useWorkspaceChatController.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.tsapps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.tsapps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/CollectionsProvider.tsxapps/desktop/src/renderer/routes/_authenticated/settings/api-keys/components/ApiKeysSettings/ApiKeysSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/billing/components/BillingOverview/BillingOverview.tsxapps/desktop/src/renderer/routes/_authenticated/settings/billing/plans/page.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/$hostId/components/HostSettings/HostSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/components/HostsSettingsSidebar/HostsSettingsSidebar.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/page.tsxapps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/MembersSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/PendingInvitations.tsxapps/desktop/src/renderer/routes/_authenticated/settings/organization/components/OrganizationSettings/OrganizationSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/project/$projectId/cloud/secrets/components/SecretsSettings/SecretsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/TeamDetailSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/TeamsSettings.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts
💤 Files with no reviewable changes (1)
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useConsumeAutomationRunLink/useConsumeAutomationRunLink.ts
🚧 Files skipped from review as they are similar to previous changes (37)
- apps/desktop/src/renderer/routes/_authenticated/settings/project/$projectId/cloud/secrets/components/SecretsSettings/SecretsSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/TasksView.tsx
- apps/desktop/src/renderer/components/Chat/components/LinkedTaskChip/LinkedTaskChip.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/AssigneeCell/AssigneeCell.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/TeamDetailSettings.tsx
- apps/desktop/src/renderer/components/Paywall/usePaywall.ts
- apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/StatusProperty/StatusProperty.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/CreateTaskDialog/CreateTaskDialog.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceHoverCardContent/components/LinkedTaskSection/LinkedTaskSection.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/hosts/page.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx
- apps/desktop/src/renderer/hooks/useCurrentPlan.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/TeamsSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/PendingInvitations.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/api-keys/components/ApiKeysSettings/ApiKeysSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/organization/components/OrganizationSettings/OrganizationSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/OrganizationDropdown/OrganizationDropdown.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/WorkspacePicker/WorkspacePicker.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/billing/components/BillingOverview/BillingOverview.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/hooks/useWorkspaceChatController/useWorkspaceChatController.ts
- apps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/MembersSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/billing/plans/page.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx
- apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/hosts/components/HostsSettingsSidebar/HostsSettingsSidebar.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/StatusCell/StatusCell.tsx
- apps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/CollectionsProvider.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/hosts/$hostId/components/HostSettings/HostSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTableView/components/TaskContextMenu/TaskContextMenu.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/AssigneeProperty/AssigneeProperty.tsx
There was a problem hiding this comment.
All reported issues were addressed across 42 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
6f998e5 to
ed25d5b
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
There was a problem hiding this comment.
4 issues found across 24 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TableContent/TableContent.tsx">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TableContent/TableContent.tsx:68">
P2: A failed Load more request produces an unhandled rejection because the callback discards `fetchNextPage()` without handling errors; catch and log/surface the failure in `fetchNextTasksPage` before exposing it to this button.
(Based on your team's feedback about explicit async error handling.)</violation>
</file>
<file name="apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx:39">
P1: Organizations with more than 200 tasks cannot select external assignees found only on older tasks, even though those tasks load through the dashboard paginator. Populate this filter from all task pages or expose a distinct external-assignee query instead of the capped picker window.</violation>
</file>
<file name="apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx">
<violation number="1" location="apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx:50">
P2: The chat issue picker can no longer find or link tasks that fall outside the 200 most recently created. The Fuse search index is built only from taskPage.items (TASK_PICKER_INPUT limit 200) and nextCursor is discarded, whereas previously the full local task set (collections.tasks) was searchable — so an exact-slug search for an older task now returns nothing. Consider loading all pages (walk nextCursor) or keeping the picker on an unbounded/complete read so historical tasks stay linkable.</violation>
</file>
<file name="packages/trpc/src/router/task/task.ts">
<violation number="1" location="packages/trpc/src/router/task/task.ts:421">
P2: Task pagination can skip remaining tasks from a bulk-created timestamp group because the `Date` cursor loses PostgreSQL microseconds before the keyset equality comparison. Preserve a lossless timestamp cursor (or normalize stored `created_at` precision) before using it as the `(createdAt, id)` key.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| ); | ||
|
|
||
| const { data: taskPage } = | ||
| cloudTrpc.task.listPage.useQuery(TASK_PICKER_INPUT); |
There was a problem hiding this comment.
P1: Organizations with more than 200 tasks cannot select external assignees found only on older tasks, even though those tasks load through the dashboard paginator. Populate this filter from all task pages or expose a distinct external-assignee query instead of the capped picker window.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx, line 39:
<comment>Organizations with more than 200 tasks cannot select external assignees found only on older tasks, even though those tasks load through the dashboard paginator. Populate this filter from all task pages or expose a distinct external-assignee query instead of the capped picker window.</comment>
<file context>
@@ -35,15 +35,16 @@ export function AssigneeFilter({ value, onChange }: AssigneeFilterProps) {
- const { data: taskRows } = cloudTrpc.task.list.useQuery(TASK_LIST_INPUT);
+ const { data: taskPage } =
+ cloudTrpc.task.listPage.useQuery(TASK_PICKER_INPUT);
const externalAssignees = useMemo(() => {
</file context>
| </div> | ||
| {hasNextTasksPage && ( | ||
| <LoadMoreTasksButton | ||
| onLoadMore={fetchNextTasksPage} |
There was a problem hiding this comment.
P2: A failed Load more request produces an unhandled rejection because the callback discards fetchNextPage() without handling errors; catch and log/surface the failure in fetchNextTasksPage before exposing it to this button.
(Based on your team's feedback about explicit async error handling.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TableContent/TableContent.tsx, line 68:
<comment>A failed Load more request produces an unhandled rejection because the callback discards `fetchNextPage()` without handling errors; catch and log/surface the failure in `fetchNextTasksPage` before exposing it to this button.
(Based on your team's feedback about explicit async error handling.) </comment>
<file context>
@@ -48,12 +56,20 @@ export function TableContent({
- </div>
+ {hasNextTasksPage && (
+ <LoadMoreTasksButton
+ onLoadMore={fetchNextTasksPage}
+ isLoading={isFetchingNextTasksPage}
+ />
</file context>
| branch: t.branch, | ||
| })), | ||
| [collections.tasks], | ||
| const { data: taskPage } = cloudTrpc.task.listPage.useQuery( |
There was a problem hiding this comment.
P2: The chat issue picker can no longer find or link tasks that fall outside the 200 most recently created. The Fuse search index is built only from taskPage.items (TASK_PICKER_INPUT limit 200) and nextCursor is discarded, whereas previously the full local task set (collections.tasks) was searchable — so an exact-slug search for an older task now returns nothing. Consider loading all pages (walk nextCursor) or keeping the picker on an unbounded/complete read so historical tasks stay linkable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx, line 50:
<comment>The chat issue picker can no longer find or link tasks that fall outside the 200 most recently created. The Fuse search index is built only from taskPage.items (TASK_PICKER_INPUT limit 200) and nextCursor is discarded, whereas previously the full local task set (collections.tasks) was searchable — so an exact-slug search for an older task now returns nothing. Consider loading all pages (walk nextCursor) or keeping the picker on an unbounded/complete read so historical tasks stay linkable.</comment>
<file context>
@@ -47,13 +47,16 @@ export function IssueLinkCommand({
- const { data: taskRows } = cloudTrpc.task.list.useQuery(TASK_LIST_INPUT, {
- enabled: open,
- });
+ const { data: taskPage } = cloudTrpc.task.listPage.useQuery(
+ TASK_PICKER_INPUT,
+ {
</file context>
| const last = items.at(-1); | ||
| const nextCursor = | ||
| rows.length > input.limit && last | ||
| ? { createdAt: last.task.createdAt, id: last.task.id } |
There was a problem hiding this comment.
P2: Task pagination can skip remaining tasks from a bulk-created timestamp group because the Date cursor loses PostgreSQL microseconds before the keyset equality comparison. Preserve a lossless timestamp cursor (or normalize stored created_at precision) before using it as the (createdAt, id) key.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/trpc/src/router/task/task.ts, line 421:
<comment>Task pagination can skip remaining tasks from a bulk-created timestamp group because the `Date` cursor loses PostgreSQL microseconds before the keyset equality comparison. Preserve a lossless timestamp cursor (or normalize stored `created_at` precision) before using it as the `(createdAt, id)` key.</comment>
<file context>
@@ -371,6 +387,43 @@ export const taskRouter = {
+ const last = items.at(-1);
+ const nextCursor =
+ rows.length > input.limit && last
+ ? { createdAt: last.task.createdAt, id: last.task.id }
+ : null;
+
</file context>
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/BoardContent/BoardContent.tsx (1)
38-56: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winThe empty state hides in-progress page loading in both task views. Both components call
useAutoLoadEmptyPages, which can fetch up to five additional pages while the filtered list is empty. Both then return the "No tasks found" panel before any loading indicator renders, so the view reports a definitive empty result while data is still loading.
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/BoardContent/BoardContent.tsx#L38-L56: render a loading indicator instead of the empty panel whenisLoadingTasksorisFetchingNextTasksPageis true.apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TableContent/TableContent.tsx#L48-L78: apply the same guard to therows.length === 0branch, usingisLoadingTasksandisFetchingNextTasksPage.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/BoardContent/BoardContent.tsx` around lines 38 - 56, The empty-state branches hide ongoing task-page loading. In apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/BoardContent/BoardContent.tsx lines 38-56, render the loading indicator when isLoadingTasks or isFetchingNextTasksPage is true before showing “No tasks found”; apply the same guard to the rows.length === 0 branch in apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TableContent/TableContent.tsx lines 48-78, using those same loading flags.
🧹 Nitpick comments (2)
packages/trpc/src/router/task/task.ts (1)
401-415: 🚀 Performance & Scalability | 🔵 TrivialConsider a composite index to support the keyset scan.
The keyset predicate and
ORDER BY desc(tasks.createdAt), desc(tasks.id)are correct, and the limit-plus-one paging has no off-by-one. The available indexes aretasks_organization_id_idxandtasks_created_at_idxseparately, so Postgres cannot satisfy the org scope and the two-column sort from one index. Deep pages will fall back to a wider scan plus a sort.Add a composite index on
(organization_id, created_at DESC, id DESC)when this query becomes a hot path.task.listPageis the primary desktop task read after this migration, so the load is sustained rather than incidental. Add the index through the normaldrizzle-kit generateflow on the schema file, not by hand-editingpackages/db/drizzle/.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/trpc/src/router/task/task.ts` around lines 401 - 415, Update the task schema used by task.listPage to define a composite index on organization_id, createdAt descending, and id descending, matching the query’s organization filter and ordering. Generate the migration through the normal drizzle-kit generate workflow, rather than editing packages/db/drizzle/ manually.apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx (1)
46-53: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winBound the scope of task polling
refetchIntervalon this v5useInfiniteQueryrefetches every cached page. Scrolling can add pages without a bound, so each 15-second poll can issue onelistPagerequest per page and recompute the flattened task list. AddmaxPagesonly if dropping older pages is acceptable for client-side search and filtering, or use a separate first-page freshness query.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx` around lines 46 - 53, Bound polling in useTasksData by preventing each interval from refetching an unbounded number of cached pages. Prefer a separate first-page freshness query if client-side search and filtering must retain all loaded pages; otherwise add an appropriate maxPages setting to useInfiniteQuery and preserve the intended task-list behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/hosts/components/HostsSettingsSidebar/HostsSettingsSidebar.tsx`:
- Line 26: Update the cloudTrpc.v2Host.list query destructuring in
HostsSettingsSidebar to include isPending and pass a loading state to
SettingsListSidebar only when isPending is true and hosts has no data. Preserve
cached host rows during refetch, and prevent the “No hosts yet” empty state from
rendering before the initial query resolves.
In `@packages/trpc/src/router/organization/organization.ts`:
- Around line 97-124: Update the listInvitations procedure to require
verifyOrgAdmin authorization before executing its pending-invitation query,
matching the existing getInvitation behavior while preserving the current result
selection and organization filtering.
---
Outside diff comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/BoardContent/BoardContent.tsx`:
- Around line 38-56: The empty-state branches hide ongoing task-page loading. In
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/BoardContent/BoardContent.tsx
lines 38-56, render the loading indicator when isLoadingTasks or
isFetchingNextTasksPage is true before showing “No tasks found”; apply the same
guard to the rows.length === 0 branch in
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TableContent/TableContent.tsx
lines 48-78, using those same loading flags.
---
Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsx`:
- Around line 46-53: Bound polling in useTasksData by preventing each interval
from refetching an unbounded number of cached pages. Prefer a separate
first-page freshness query if client-side search and filtering must retain all
loaded pages; otherwise add an appropriate maxPages setting to useInfiniteQuery
and preserve the intended task-list behavior.
In `@packages/trpc/src/router/task/task.ts`:
- Around line 401-415: Update the task schema used by task.listPage to define a
composite index on organization_id, createdAt descending, and id descending,
matching the query’s organization filter and ordering. Generate the migration
through the normal drizzle-kit generate workflow, rather than editing
packages/db/drizzle/ manually.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1c57fcf2-4010-4d8c-881e-20e5598364fd
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (204)
.agents/skills/db-migrations/SKILL.md.env.example.github/workflows/deploy-preview.yml.github/workflows/deploy-production.ymlAGENTS.mdapps/api/package.jsonapps/api/src/app/api/chat/[sessionId]/route.tsapps/api/src/app/api/chat/[sessionId]/stream/route.tsapps/api/src/app/api/chat/lib.tsapps/api/src/app/api/chat/tools/web-search/route.tsapps/api/src/env.tsapps/api/src/proxy.tsapps/desktop/package.jsonapps/desktop/src/main/index.tsapps/desktop/src/main/lib/quit-sequence.test.tsapps/desktop/src/main/lib/quit-sequence.tsapps/desktop/src/main/network-logger-sweep.tsapps/desktop/src/main/network-logger/index.tsapps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsxapps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsxapps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsxapps/desktop/src/renderer/components/Chat/components/LinkedTaskChip/LinkedTaskChip.tsxapps/desktop/src/renderer/components/Paywall/usePaywall.tsapps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.tsapps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.utils.tsapps/desktop/src/renderer/hooks/known-hosts/useKnownHosts/useKnownHosts.tsapps/desktop/src/renderer/hooks/known-hosts/useKnownHosts/useKnownHosts.utils.tsapps/desktop/src/renderer/hooks/useCurrentPlan.tsapps/desktop/src/renderer/hooks/useHostsPresence/useHostsPresence.tsapps/desktop/src/renderer/lib/api-trpc-client.tsapps/desktop/src/renderer/lib/cloud-trpc.tsapps/desktop/src/renderer/lib/dev-chat.test.tsapps/desktop/src/renderer/lib/dev-chat.tsapps/desktop/src/renderer/lib/jwt-refresh/index.tsapps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.test.tsapps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.tsapps/desktop/src/renderer/providers/ElectronTRPCProvider/ElectronTRPCProvider.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/$automationId/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/AutomationRow/AutomationRow.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/WorkspacePicker/WorkspacePicker.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/DashboardSidebarWorkspaceItem.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceHoverCardContent/components/LinkedTaskSection/LinkedTaskSection.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/hooks/useDashboardSidebarWorkspaceItemActions/useDashboardSidebarWorkspaceItemActions.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/utils/joinTasksWithStatuses/index.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/utils/joinTasksWithStatuses/joinTasksWithStatuses.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/OrganizationDropdown/OrganizationDropdown.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/hooks/useFailedAutomations/useFailedAutomations.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/AssigneeProperty/AssigneeProperty.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/PriorityProperty/PriorityProperty.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/StatusProperty/StatusProperty.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/TaskActionMenu/TaskActionMenu.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/TasksView.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/BoardContent/BoardContent.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TableContent/TableContent.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksBoardView/TasksBoardView.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksBoardView/components/KanbanColumn/KanbanColumn.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTableView/TasksTableView.test.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTableView/TasksTableView.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTableView/components/TaskContextMenu/TaskContextMenu.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/CreateTaskDialog/CreateTaskDialog.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useAutoLoadEmptyPages/index.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useAutoLoadEmptyPages/useAutoLoadEmptyPages.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/index.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksData/useTasksData.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/AssigneeCell/AssigneeCell.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/PriorityCell/PriorityCell.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/StatusCell/StatusCell.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/useTasksTable.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useConsumeAutomationRunLink/useConsumeAutomationRunLink.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/hooks/useWorkspaceChatController/useWorkspaceChatController.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/hooks/useRemoteHostStatus/useRemoteHostStatus.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/AgentHooks.tsxapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/index.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/create-worktree.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/delete-workspace.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-app-context.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-workspace-details.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/index.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-projects.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.test.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.utils.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/start-agent-session.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/switch-workspace.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/types.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/update-workspace.tsapps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/useCommandWatcher.tsapps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.tsapps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticActions/index.tsapps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticActions/useOptimisticActions.tsapps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/index.tsapps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.tsapps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/CollectionsProvider.tsxapps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/collections.tsapps/desktop/src/renderer/routes/_authenticated/providers/HostWorkspacesProvider/HostWorkspacesProvider.tsxapps/desktop/src/renderer/routes/_authenticated/settings/account/components/AccountSettings/AccountSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/api-keys/components/ApiKeysSettings/ApiKeysSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/billing/components/BillingOverview/BillingOverview.tsxapps/desktop/src/renderer/routes/_authenticated/settings/billing/plans/page.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/$hostId/components/HostSettings/HostSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/$hostId/components/HostSettings/components/DeleteHostSection/DeleteHostSection.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/$hostId/components/HostSettings/components/HostHeader/HostHeader.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/components/HostsSettingsSidebar/HostsSettingsSidebar.tsxapps/desktop/src/renderer/routes/_authenticated/settings/hosts/page.tsxapps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/MembersSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/InviteMemberButton/components/InviteMemberDialog/InviteMemberDialog.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/MemberActions/MemberActions.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/PendingInvitations.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/components/InvitationActions/InvitationActions.tsxapps/desktop/src/renderer/routes/_authenticated/settings/members/types.tsapps/desktop/src/renderer/routes/_authenticated/settings/organization/components/OrganizationSettings/OrganizationSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/project/$projectId/cloud/secrets/components/SecretsSettings/SecretsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/TeamDetailSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/components/AddMemberButton/AddMemberButton.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/TeamsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/components/CreateTeamButton/CreateTeamButton.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/GroupStrip/GroupStrip.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/hooks/useChatPaneController/useChatPaneController.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.test.tsapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.tsapps/electric-proxy/src/where.tsapps/mobile/AGENTS.mdapps/mobile/app/(authenticated)/_layout.tsxapps/mobile/hooks/useOrgHosts/index.tsapps/mobile/hooks/useOrgHosts/useOrgHosts.tsapps/mobile/hooks/useWorkspaceHost/useWorkspaceHost.tsapps/mobile/lib/collections/collections.tsapps/mobile/lib/env.tsapps/mobile/package.jsonapps/mobile/screens/(authenticated)/(home)/filter/FilterScreen.tsxapps/mobile/screens/(authenticated)/(home)/filter/host/HostFilterScreen.tsxapps/mobile/screens/(authenticated)/(home)/filter/project/ProjectFilterScreen.tsxapps/mobile/screens/(authenticated)/(home)/home/HomeScreen.tsxapps/mobile/screens/(authenticated)/(home)/home/components/NewChatWidget/hooks/useNewChatTargets/useNewChatTargets.tsapps/mobile/screens/(authenticated)/(home)/home/hooks/useHostTerminalAgents/useHostTerminalAgents.tsapps/mobile/screens/(authenticated)/(home)/hooks/useSelectedHost/useSelectedHost.tsapps/mobile/screens/(authenticated)/hooks/useOrgMembers/index.tsapps/mobile/screens/(authenticated)/hooks/useOrgMembers/useOrgMembers.tsapps/mobile/screens/(authenticated)/hooks/useOrganizations/useOrganizations.tsapps/mobile/screens/(authenticated)/hooks/usePullRequests/index.tsapps/mobile/screens/(authenticated)/hooks/usePullRequests/usePullRequests.tsapps/mobile/screens/(authenticated)/providers/CollectionsProvider/CollectionsProvider.tsxapps/mobile/screens/(authenticated)/providers/CollectionsProvider/index.tsapps/mobile/screens/(authenticated)/settings/SettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/billing/BillingSettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/index.tsapps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.tsapps/mobile/screens/(authenticated)/settings/hosts/HostsSettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/organization/OrganizationSettingsScreen.tsxapps/mobile/screens/(authenticated)/settings/utils/activeSubscription/activeSubscription.tsapps/mobile/screens/(authenticated)/settings/utils/activeSubscription/index.tsapps/mobile/screens/(authenticated)/workspace/[id]/chat/[sessionId]/ChatThreadScreen.tsxapps/mobile/screens/(authenticated)/workspace/[id]/commits/components/AuthorAvatar/AuthorAvatar.tsxapps/mobile/screens/(authenticated)/workspace/[id]/hooks/useWorkspaceHeaderActions/useWorkspaceHeaderActions.tsapps/mobile/screens/(authenticated)/workspace/[id]/hooks/useWorkspacePullRequest/useWorkspacePullRequest.tsapps/web/package.jsonapps/web/src/app/globals.cssapps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/TerminalConnection.test.tsapps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/TerminalConnection.tsapps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/WebTerminal.tsxapps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/index.tsapps/web/src/app/workspaces/[workspaceId]/components/WebTerminalPresetsBar/WebTerminalPresetsBar.tsxapps/web/src/app/workspaces/[workspaceId]/components/WebTerminalPresetsBar/index.tsapps/web/src/app/workspaces/[workspaceId]/page.tsxapps/web/src/app/workspaces/page.tsxapps/web/src/trpc/host-client.tspackages/db/drizzle/0065_drop_chat_sessions_v2_workspace_fk.sqlpackages/db/drizzle/meta/0065_snapshot.jsonpackages/db/drizzle/meta/_journal.jsonpackages/db/src/schema/relations.tspackages/db/src/schema/schema.tspackages/host-service/src/app.tspackages/host-service/src/runtime/project-backfill.tspackages/host-service/src/runtime/workspace-backfill.tspackages/host-service/src/trpc/router/workspace-cleanup/workspace-cleanup.tspackages/host-service/src/trpc/router/workspace/workspace.tspackages/host-service/src/workspaces/local-workspace-store.tspackages/host-service/test/integration/bug-hunt-4.integration.test.tspackages/host-service/test/integration/workspace-cleanup.integration.test.tspackages/host-service/test/integration/workspace-create-delete.integration.test.tspackages/host-service/test/workspace-cleanup.test.tspackages/trpc/src/root.tspackages/trpc/src/router/agent/agent.tspackages/trpc/src/router/agent/index.tspackages/trpc/src/router/api-key/api-key.tspackages/trpc/src/router/automation/automation.tspackages/trpc/src/router/billing/billing.tspackages/trpc/src/router/chat/chat.tspackages/trpc/src/router/integration/github/github.tspackages/trpc/src/router/organization/organization.tspackages/trpc/src/router/project/project.tspackages/trpc/src/router/task/schema.tspackages/trpc/src/router/task/statuses.tspackages/trpc/src/router/task/task.tspackages/trpc/src/router/v2-host/v2-host.tspackages/trpc/src/router/v2-workspace/v2-workspace.tspackages/trpc/src/trpc.ts
💤 Files with no reviewable changes (61)
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.test.ts
- apps/desktop/src/renderer/lib/dev-chat.test.ts
- apps/web/src/app/globals.css
- apps/desktop/package.json
- apps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/index.ts
- apps/web/src/app/workspaces/[workspaceId]/components/WebTerminalPresetsBar/index.ts
- apps/api/src/app/api/chat/tools/web-search/route.ts
- apps/mobile/package.json
- apps/web/src/app/workspaces/[workspaceId]/page.tsx
- apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/index.ts
- apps/mobile/screens/(authenticated)/settings/utils/activeSubscription/index.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/update-workspace.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/switch-workspace.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/index.ts
- apps/web/src/app/workspaces/[workspaceId]/components/WebTerminalPresetsBar/WebTerminalPresetsBar.tsx
- packages/trpc/src/router/agent/index.ts
- apps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/TerminalConnection.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/useCommandWatcher.ts
- apps/mobile/screens/(authenticated)/providers/CollectionsProvider/CollectionsProvider.tsx
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.test.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/index.ts
- apps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.test.ts
- .env.example
- .github/workflows/deploy-production.yml
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/create-worktree.ts
- apps/mobile/screens/(authenticated)/providers/CollectionsProvider/index.ts
- apps/desktop/src/main/network-logger/index.ts
- packages/host-service/test/integration/workspace-create-delete.integration.test.ts
- apps/desktop/src/renderer/lib/jwt-refresh/index.ts
- apps/desktop/src/main/lib/quit-sequence.test.ts
- apps/web/package.json
- apps/api/package.json
- apps/mobile/screens/(authenticated)/settings/utils/activeSubscription/activeSubscription.ts
- apps/desktop/src/main/lib/quit-sequence.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/types.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-app-context.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-projects.ts
- apps/api/src/app/api/chat/lib.ts
- apps/mobile/lib/collections/collections.ts
- apps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/WebTerminal.tsx
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/delete-workspace.ts
- apps/api/src/app/api/chat/[sessionId]/stream/route.ts
- packages/trpc/src/router/agent/agent.ts
- .github/workflows/deploy-preview.yml
- apps/desktop/src/renderer/routes/_authenticated/hooks/useOptimisticCollectionActions/useOptimisticCollectionActions.ts
- packages/host-service/src/runtime/workspace-backfill.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-workspace-details.ts
- packages/trpc/src/root.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/list-workspaces.utils.ts
- apps/web/src/app/workspaces/[workspaceId]/components/WebTerminal/TerminalConnection.test.ts
- apps/desktop/src/renderer/lib/jwt-refresh/jwt-refresh.ts
- apps/api/src/env.ts
- apps/web/src/trpc/host-client.ts
- apps/web/src/app/workspaces/page.tsx
- apps/api/src/app/api/chat/[sessionId]/route.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/AgentHooks.tsx
- apps/desktop/src/renderer/lib/dev-chat.ts
- apps/mobile/lib/env.ts
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ChatPane/utils/session-init-runner.ts
- apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/start-agent-session.ts
🚧 Files skipped from review as they are similar to previous changes (95)
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/AssigneeProperty/AssigneeProperty.tsx
- apps/desktop/src/renderer/hooks/known-hosts/useKnownHosts/useKnownHosts.utils.ts
- apps/mobile/screens/(authenticated)/(home)/filter/host/HostFilterScreen.tsx
- packages/trpc/src/router/api-key/api-key.ts
- apps/mobile/screens/(authenticated)/(home)/filter/FilterScreen.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/utils/joinTasksWithStatuses/index.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/hooks/useRemoteHostStatus/useRemoteHostStatus.ts
- apps/mobile/screens/(authenticated)/(home)/home/hooks/useHostTerminalAgents/useHostTerminalAgents.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/AssigneeFilter/AssigneeFilter.tsx
- packages/trpc/src/router/task/statuses.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/components/InvitationActions/InvitationActions.tsx
- apps/electric-proxy/src/where.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/LinearProjectFilter/LinearProjectFilter.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/components/AddMemberButton/AddMemberButton.tsx
- apps/mobile/screens/(authenticated)/hooks/usePullRequests/index.ts
- apps/desktop/src/renderer/providers/ElectronTRPCProvider/ElectronTRPCProvider.tsx
- apps/mobile/screens/(authenticated)/(home)/filter/project/ProjectFilterScreen.tsx
- apps/mobile/screens/(authenticated)/hooks/useOrgMembers/index.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTableView/components/TaskContextMenu/TaskContextMenu.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/TeamsSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/StatusProperty/StatusProperty.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/CreateTaskDialog/CreateTaskDialog.tsx
- apps/mobile/app/(authenticated)/_layout.tsx
- apps/mobile/screens/(authenticated)/settings/billing/BillingSettingsScreen.tsx
- apps/desktop/src/renderer/commandPalette/ui/LinkTask/LinkTaskFrame.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/utils/joinTasksWithStatuses/joinTasksWithStatuses.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/OrganizationDropdown/OrganizationDropdown.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/AssigneeCell/AssigneeCell.tsx
- apps/mobile/screens/(authenticated)/hooks/useOrganizations/useOrganizations.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/teams/components/TeamsSettings/components/CreateTeamButton/CreateTeamButton.tsx
- apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/components/DevicePicker/hooks/useWorkspaceHostOptions/useWorkspaceHostOptions.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/hosts/page.tsx
- apps/desktop/src/main/network-logger-sweep.ts
- apps/mobile/screens/(authenticated)/workspace/[id]/hooks/useWorkspacePullRequest/useWorkspacePullRequest.ts
- apps/desktop/src/renderer/lib/api-trpc-client.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/teams/$teamId/components/TeamDetailSettings/TeamDetailSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/hooks/useWorkspaceChatController/useWorkspaceChatController.ts
- packages/trpc/src/router/integration/github/github.ts
- apps/mobile/screens/(authenticated)/(home)/hooks/useSelectedHost/useSelectedHost.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/project/$projectId/cloud/secrets/components/SecretsSettings/SecretsSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/hooks/useFailedAutomations/useFailedAutomations.ts
- apps/mobile/screens/(authenticated)/settings/hosts/HostsSettingsScreen.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/billing/plans/page.tsx
- apps/desktop/src/renderer/hooks/known-hosts/useKnownHosts/useKnownHosts.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceHoverCardContent/components/LinkedTaskSection/LinkedTaskSection.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/InviteMemberButton/components/InviteMemberDialog/InviteMemberDialog.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/members/components/PendingInvitations/PendingInvitations.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/TasksView.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/AutomationRow/AutomationRow.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx
- apps/mobile/screens/(authenticated)/(home)/home/HomeScreen.tsx
- apps/desktop/src/renderer/components/Chat/ChatInterface/components/IssueLinkCommand/IssueLinkCommand.tsx
- apps/mobile/screens/(authenticated)/(home)/home/components/NewChatWidget/hooks/useNewChatTargets/useNewChatTargets.ts
- apps/mobile/screens/(authenticated)/settings/organization/OrganizationSettingsScreen.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/components/WorkspacePicker/WorkspacePicker.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/GroupStrip/GroupStrip.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/account/components/AccountSettings/AccountSettings.tsx
- apps/mobile/screens/(authenticated)/workspace/[id]/chat/[sessionId]/ChatThreadScreen.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/billing/components/BillingOverview/BillingOverview.tsx
- apps/desktop/src/main/index.ts
- apps/desktop/src/renderer/hooks/useCurrentPlan.ts
- apps/mobile/AGENTS.md
- apps/desktop/src/renderer/routes/_authenticated/settings/organization/components/OrganizationSettings/OrganizationSettings.tsx
- apps/mobile/screens/(authenticated)/hooks/usePullRequests/usePullRequests.ts
- apps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/collections.ts
- packages/trpc/src/router/v2-host/v2-host.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/hooks/useTasksTable/components/StatusCell/StatusCell.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/members/types.ts
- apps/desktop/src/renderer/lib/cloud-trpc.ts
- packages/trpc/src/router/project/project.ts
- apps/mobile/screens/(authenticated)/workspace/[id]/commits/components/AuthorAvatar/AuthorAvatar.tsx
- apps/mobile/screens/(authenticated)/workspace/[id]/hooks/useWorkspaceHeaderActions/useWorkspaceHeaderActions.ts
- packages/trpc/src/router/billing/billing.ts
- apps/mobile/screens/(authenticated)/settings/SettingsScreen.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/api-keys/components/ApiKeysSettings/ApiKeysSettings.tsx
- packages/trpc/src/router/chat/chat.ts
- apps/desktop/src/renderer/routes/_authenticated/providers/CollectionsProvider/CollectionsProvider.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useConsumeAutomationRunLink/useConsumeAutomationRunLink.ts
- apps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/index.ts
- packages/trpc/src/router/automation/automation.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/MembersSettings.tsx
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/hooks/useAccessibleV2Workspaces/useAccessibleV2Workspaces.ts
- apps/mobile/screens/(authenticated)/settings/hooks/useActivePlan/useActivePlan.ts
- apps/desktop/src/renderer/routes/_authenticated/_dashboard/automations/page.tsx
- apps/desktop/src/renderer/components/Paywall/usePaywall.ts
- apps/desktop/src/renderer/components/Chat/components/LinkedTaskChip/LinkedTaskChip.tsx
- apps/api/src/proxy.ts
- apps/mobile/screens/(authenticated)/hooks/useOrgMembers/useOrgMembers.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/integrations/components/IntegrationsSettings/IntegrationsSettings.tsx
- apps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.ts
- apps/desktop/src/renderer/commandPalette/ui/RecentlyViewed/RecentlyViewedFrame.tsx
- apps/desktop/src/renderer/hooks/host-workspaces/useHostWorkspaces/useHostWorkspaces.utils.ts
- apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/components/MemberActions/MemberActions.tsx
- apps/desktop/src/renderer/routes/_authenticated/settings/hosts/$hostId/components/HostSettings/HostSettings.tsx
| }: HostsSettingsSidebarProps) { | ||
| const collections = useCollections(); | ||
| const { data: session } = authClient.useSession(); | ||
| const { data: hosts = [] } = cloudTrpc.v2Host.list.useQuery(undefined); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Do not show the empty state before the host query resolves.
Line 26 converts unresolved data to []. SettingsListSidebar then receives no loading state and can show “No hosts yet.” during the initial cloud fetch. Use isPending to render a loading state only when no data exists. Keep cached rows rendered during refetch. The related hosts index route already follows this pattern.
Proposed fix
- const { data: hosts = [] } = cloudTrpc.v2Host.list.useQuery(undefined);
+ const { data: hosts = [], isPending } =
+ cloudTrpc.v2Host.list.useQuery(undefined);
+
+ if (isPending) return null;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const { data: hosts = [] } = cloudTrpc.v2Host.list.useQuery(undefined); | |
| const { data: hosts = [], isPending } = | |
| cloudTrpc.v2Host.list.useQuery(undefined); | |
| if (isPending) return null; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/hosts/components/HostsSettingsSidebar/HostsSettingsSidebar.tsx`
at line 26, Update the cloudTrpc.v2Host.list query destructuring in
HostsSettingsSidebar to include isPending and pass a loading state to
SettingsListSidebar only when isPending is true and hosts has no data. Preserve
cached host rows during refetch, and prevent the “No hosts yet” empty state from
rendering before the initial query resolves.
| listInvitations: protectedProcedure.query(async ({ ctx }) => { | ||
| const organizationId = await requireActiveOrgMembership(ctx); | ||
| return db | ||
| .select({ | ||
| id: invitations.id, | ||
| email: invitations.email, | ||
| role: invitations.role, | ||
| status: invitations.status, | ||
| expiresAt: invitations.expiresAt, | ||
| createdAt: invitations.createdAt, | ||
| inviterId: invitations.inviterId, | ||
| inviter: { | ||
| id: users.id, | ||
| name: users.name, | ||
| email: users.email, | ||
| image: users.image, | ||
| }, | ||
| }) | ||
| .from(invitations) | ||
| .innerJoin(users, eq(invitations.inviterId, users.id)) | ||
| .where( | ||
| and( | ||
| eq(invitations.organizationId, organizationId), | ||
| eq(invitations.status, "pending"), | ||
| ), | ||
| ) | ||
| .orderBy(desc(invitations.createdAt)); | ||
| }), |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Restrict pending invitation enumeration to organization administrators.
Any active member can call listInvitations and read pending invitee email addresses and inviter identity fields. getInvitation already requires verifyOrgAdmin for users who are not the invitee. Require the same administrator authorization before this query.
Proposed fix
listInvitations: protectedProcedure.query(async ({ ctx }) => {
const organizationId = await requireActiveOrgMembership(ctx);
+ await verifyOrgAdmin(ctx.session.user.id, organizationId);
return db📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| listInvitations: protectedProcedure.query(async ({ ctx }) => { | |
| const organizationId = await requireActiveOrgMembership(ctx); | |
| return db | |
| .select({ | |
| id: invitations.id, | |
| email: invitations.email, | |
| role: invitations.role, | |
| status: invitations.status, | |
| expiresAt: invitations.expiresAt, | |
| createdAt: invitations.createdAt, | |
| inviterId: invitations.inviterId, | |
| inviter: { | |
| id: users.id, | |
| name: users.name, | |
| email: users.email, | |
| image: users.image, | |
| }, | |
| }) | |
| .from(invitations) | |
| .innerJoin(users, eq(invitations.inviterId, users.id)) | |
| .where( | |
| and( | |
| eq(invitations.organizationId, organizationId), | |
| eq(invitations.status, "pending"), | |
| ), | |
| ) | |
| .orderBy(desc(invitations.createdAt)); | |
| }), | |
| listInvitations: protectedProcedure.query(async ({ ctx }) => { | |
| const organizationId = await requireActiveOrgMembership(ctx); | |
| await verifyOrgAdmin(ctx.session.user.id, organizationId); | |
| return db | |
| .select({ | |
| id: invitations.id, | |
| email: invitations.email, | |
| role: invitations.role, | |
| status: invitations.status, | |
| expiresAt: invitations.expiresAt, | |
| createdAt: invitations.createdAt, | |
| inviterId: invitations.inviterId, | |
| inviter: { | |
| id: users.id, | |
| name: users.name, | |
| email: users.email, | |
| image: users.image, | |
| }, | |
| }) | |
| .from(invitations) | |
| .innerJoin(users, eq(invitations.inviterId, users.id)) | |
| .where( | |
| and( | |
| eq(invitations.organizationId, organizationId), | |
| eq(invitations.status, "pending"), | |
| ), | |
| ) | |
| .orderBy(desc(invitations.createdAt)); | |
| }), |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/trpc/src/router/organization/organization.ts` around lines 97 - 124,
Update the listInvitations procedure to require verifyOrgAdmin authorization
before executing its pending-invitation query, matching the existing
getInvitation behavior while preserving the current result selection and
organization filtering.
Unused since #6328 replaced Electric sync with plain tRPC + React Query; nothing in the codebase reads it anymore.
…ills/docs (#6442) * docs(agents): slim AGENTS.md to essentials and move deep guides to skills/docs Root AGENTS.md was 171 lines of always-on context. Cut it to the facts an agent can't infer from the code, and move the long-form material to places that load on demand: - CDP verification (evidence rules + desktop mechanics) -> .agents/skills/cdp-verification - cross-agent-CLI config notes -> docs/agent-tooling.md - iOS-only scope -> apps/mobile/AGENTS.md Also drops the MCP config rule, which described .mcp.json/.cursor/mcp.json/.vibe files that do not exist in the repo, and fixes the desktop localStorage guardrail that still pointed at createElectronSQLitePersistence (deleted in #6328). Adds a short section pointing agents at the superset CLI for orchestrating workspaces and subagents. * docs(agents): address review feedback on placeholders and force exception
…b procedures (#6462) * chore(host-service,desktop): remove dead cloud-sync leftovers and stub procedures Four verified-dead items: - workspace.cloudList: a stub returning [] with zero callers repo-wide - the cloud router (whoami): its own comment called it a test router to remove; the only callers were its own integration test - workspace_cloud_deletes table and workspaces.cloud_synced_at (host.db migration 0023): leftovers from the dual-write cloud sync deleted in #6328. Nothing read either; the sole remaining write set cloud_synced_at to null - the client-side findBackfillConflict precheck: the procedure has always returned conflict: null, so both desktop callers paid a round-trip to take a branch that could never fire. Removing it orphaned a Repository already linked dialog that could never open, plus its state, type, and prop chain The findBackfillConflict procedure itself stays: roughly 4,900 weekly users are on builds that still call it, and deleting it server-side would turn their precheck from a null result into a thrown error mid project setup. It can go once those builds drain. * chore(desktop): remove the vestigial client construction left by the precheck removal Removing the findBackfillConflict precheck left proposeRelocate with a try/catch that built a host-service client, discarded it, and caught errors from a query that no longer existed. lint:fix had renamed the unused binding to _client rather than flagging the dead block, which hid it. * test(host-service): drop stale cloudSyncedAt assertions
ParadevAI#6328 replaced Electric sync with tRPC + React Query, which removed the collections the per-org pinned API client protected. Per-window scoping moves to the cloud client instead: it sends the window's organization header, read per request. Module state is per renderer and every window is its own renderer, so that is per-window by construction. Also addresses the Devin review: - Adds useActiveOrganizationId() as the single sanctioned way to read the active org, and converts every reader that scopes data or writes — useAccessibleV2Workspaces above all, which filtered every row against the session org and so emptied the dashboard in any switched window. - BillingOverview judged owner-only actions from the session's organization while billing the window's. Membership now comes from the window-scoped member list. - Creating or leaving an organization now moves the window too, and the provider only adopts a registry org that is still in your membership list — so leaving no longer pins a window to an org you have left. - A test pins the remaining account-wide readers with a reason each, so the next session read has to be argued for rather than added by habit.
- acpSessions is gone from the host schema; detach no longer clears it. - The organizations collection went with Electric (ParadevAI#6328); the move-to-org menu reads cloudTrpc.organization.list instead.
Electric sync was replaced with plain tRPC + React Query (#6328); the Electric/Caddy machinery left behind in setup/teardown was still probing docker, which hangs when Docker Desktop is wedged and made every workspace delete time out at the 60s teardown cap. - setup/teardown scripts: drop Electric container + replication steps, caddy/docker checks, ELECTRIC_* env writes, Caddyfile generation - delete apps/electric-proxy and its production deploy job (the deployed worker stays up until old clients drain) - docker-compose: remove the electric service and logical-replication postgres flags - package.json/turbo: drop dev:caddy and the electric-proxy dev filter - desktop: remove NEXT_PUBLIC_ELECTRIC_URL / ELECTRIC_PORT env plumbing, the CSP entry, and the dead clearElectricCache router Claude-Session: https://claude.ai/code/session_01Law6XbGYUMMgimvXm6WLHT
Electric sync was replaced with plain tRPC + React Query (#6328); the Electric/Caddy machinery left behind in setup/teardown was still probing docker, which hangs when Docker Desktop is wedged and made every workspace delete time out at the 60s teardown cap. - setup/teardown scripts: drop Electric container + replication steps, caddy/docker checks, ELECTRIC_* env writes, Caddyfile generation - delete apps/electric-proxy and its production deploy job (the deployed worker stays up until old clients drain) - docker-compose: remove the electric service and logical-replication postgres flags - package.json/turbo: drop dev:caddy and the electric-proxy dev filter - desktop: remove NEXT_PUBLIC_ELECTRIC_URL / ELECTRIC_PORT env plumbing, the CSP entry, and the dead clearElectricCache router Claude-Session: https://claude.ai/code/session_01Law6XbGYUMMgimvXm6WLHT
…d Caddyfile (#7334) Electric Cloud is being decommissioned. Shape sync was replaced with tRPC + React Query in #6328 (shipped in desktop-v1.21.0) and the proxy's source was deleted in #6667; these are the two remaining references in the repo. - `subprocessors.mdx`: remove ElectricSQL Ltd. It no longer processes any of our data once the replication slot and publications are dropped, so listing it overstates the set of subprocessors. - `Caddyfile`: delete. Its only content was the TLS shim fronting the Electric proxy (`CADDY_ELECTRIC_PORT` -> wrangler), and nothing has invoked caddy since #6667 removed it from the dev stack. Not included, deliberately: the `agent_commands` table drop (own migration, own risk profile) and the stale `caddy` prereq in the 17 READMEs (predates this change; touching 16 hand-maintained translations wants its own review). Claude-Session: https://claude.ai/code/session_019bjPymf8tNyyhNXPpJTkh8
…7764) Since #6328 replaced Electric sync with tRPC + React Query, no renderer code consumes the SQLite persistence the main process exposes. The main process still opened tanstack-db.sqlite synchronously during startup, so a corrupt file threw out of the whenReady chain before any window, tray, or auto-updater was set up, and every relaunch failed the same way. Remove the dead module, its quit hook, and the two tanstack persistence packages. Refs DESKTOP-1AY
…ow path Before creating the window, main registered with Notification Center, spawned osascript for the Apple Events prompt, opened a UDP socket for the local-network prompt, decoded and set the dock icon, and opened the 58 MB tanstack-db.sqlite with a WAL checkpoint. The first four now run from the post-show startup maintenance; the TanStack DB persistence is removed: since ParadevAI#6328 no renderer collection uses the SQLite bridge, and the database had not been written since. The file stays on disk. Measured with its group (21 launches, 20 measured, P00 markers from Node start, p50): i18n-ready -> app-state-ready 83 -> 50 ms against the build that still ran them there (the remaining 81 ms of that span in the previous group were the host spawns moved after the window).
Electric (the company) is winding down; this is PR 1 of 2 removing our dependency on it. This PR cuts Electric out of the app: every synced read becomes a plain tRPC + React Query query, dead code paths found during the audit are deleted, and nothing new is built — no push channel, no sync engine, no client data layer. PR 2 decommissions the infrastructure (
apps/electric-proxy, docker-compose service, env/CSP plumbing, remaining deps) once the release ramp drains, because old desktop builds keep dialing the proxy until they age out — that's also why the proxy's shape allowlist still serves tables whose app-side features this PR deletes.What this PR does
Deletions (dead code found during the audit)
apps/apichat REST/SSE routes (rode Electric Cloud's durable-streams service),DURABLE_STREAMS_*/TAVILY_*env + deploy plumbing,@durable-streams/client+@tavily/core, and the ChatPane cloud-session lifecycle.agent_commandscontrol plane: zero insert sites in the repo (the writer died with MCP v1) —useCommandWatcher, the collection, and the agent router are gone.v2_workspacespre-R1 fallback (hosts have been authoritative since R1),v2_clients(zero consumers), v1workspacescollection (zero consumers), mobile-onlyv2_projects.includeSensitive, up to 4GB/user); a boot sweep reclaims stranded log dirs.jwt-refresh401 gate and desktop's@electric-sql/*deps.Replacement (deliberately boring)
cloudTrpc:createTRPCReact<AppRouter>overhttpBatchStreamLinkwith bearer auth, sharing the renderer's existing QueryClient (IndexedDB persistence + Electron focus wiring already there).electric-proxy/where.tsscoping + column restrictions verbatim:organization.list/listMembers/listInvitations/listTeams,apiKey.list,chat.listSessions,v2Host.listMembers,project.list,automation.latestRuns,integration.github.listOrganizationPullRequests, plus shape widenings all verified within the proxy's column-restriction spec.useLiveQuerysites rewritten touseQuery: settings screens fetch on mount + focus; always-visible surfaces (host presence, PR chips) poll at 30s; actively-watched screens (automation runs, tasks) at 5–15s; dropdown-gated queries useenabled: open.useOptimisticCollectionActionskeeps its exact API; internals now do React Query optimistic patches + tRPC mutations + invalidation.collections.tsretains only the 6 localStorage UI-state collections and their quota/heal hardening. Org switch drops org-scoped cloud queries from the QueryClient (replacing per-org collection eviction;analytics/deviceroots excluded — they exist on the electron router too).useQueryhooks.Behavior changes made deliberately
automation.get/getPromptreads are org-scoped (Electric shape parity; the Team tab links to teammates' automations). Mutations stay owner-scoped.ensureData) instead of resolving on an unknown: fail-open leaks gated actions to free users, fail-closed paywalls trialing orgs on every cold start.trialingas active (aligning withuseCurrentPlan/host-gating, which already did) and pick subscriptions deterministically (newest-first) instead of Electric arrival order.Verification
bun run lintexits 0 (verified exit code).Follow-ups (deliberately not in this PR)
session.plan(packages/auth) withACTIVE_SUBSCRIPTION_STATUSES+ deterministic ordering — it currently disagrees withbilling.activePlanfor trialing orgs (touches web + mobile).TASKSgating is client-side only (no server-side plan check on the task router) — the deferred gate closes the cold-start window, but server enforcement is the real fix.organization.listMembers' nested user shape (full row is Electric parity, incl. peers'organizationIds, but tighter is better).task.listis capped at 500 rows (Electric synced all); paginate if any org approaches that.PR 2 checklist (after adoption drains)
Delete
apps/electric-proxy+ deploy job, docker-composeelectric+ Caddyfile,ELECTRIC_*/NEXT_PUBLIC_ELECTRIC_URL/EXPO_PUBLIC_ELECTRIC_URLplumbing (turbo/vite/env/CSP/build secrets/setup scripts),clearElectricCache, main-process SQLite persistence layer (now write-only), deadELECTRIC_TASKS_ACCESSflag,packages/local-dbsynced-tables block; dropagent_commands/v2_clientstables (v2_workspacesafter host-heartbeat retirement); updatesubprocessors.mdx(legal — remove both Electric and Tavily; Tavily's last consumer was the deleted web-search route, Slack's web search is Anthropic's server-side tool), changelog, AGENTS.md rule 9, and the 5 docs referencingOPTIMISTIC_ELECTRIC_UPDATES.md.https://claude.ai/code/session_01Rq18Ske93pkaTqTHByebtq
Rebase note (2026-08-10)
Now stacked on #6331 (client version header) — merge that first; this PR's base is
feat/client-version-headerand should be retargeted tomainafter #6331 lands. Rebased across main's session-workspaces, kanban board, and workspace-tombstone work: their new Electric reads (automations stat cards, run→workspace linking, session/archived flows inuseAccessibleV2Workspaces) were ported to the same tRPC procedures, withautomation.latestRunswidened to carryv2WorkspaceId/chatSessionId/terminalSessionId. One deliberate narrowing: the automations page's 7-day created/failed stat cards now derive from the latest run per automation rather than all runs in the window (an org-scoped run-history procedure restores exact counts if wanted). Desktop full-suite deltas vs base are threenotifyQuotaExhaustedtests that pass in isolation — test-order mock leakage from the changed file set, not a code regression.Runtime footgun audit (post-rebase, prompted by a live repro)
A dev-run surfaced
Subscriptions are unsupported by httpBatchStreamLink— cloudTrpc lacked a dedicated React context, so its Provider shadowed electronTrpc's hooks (the PR #5877 trap). Fixed, plus an audit of every always-mounted cloud query:chat.listSessionscapped at recent-200 for unfiltered reads; pane/run-link callers passsessionIdsand fetch exactly what they name.listOrganizationPullRequests(unbounded, org-wide) deleted — zero consumers after main moved PR chips to per-host queries.task.listPage(keyset, 100/page, Load-more on table/board, 200-row picker windows);task.listuntouched because released CLI/SDK/MCP clients depend on its array shape. Optimistic task patches cover both listPage cache shapes.Summary by CodeRabbit