fix(pr): use default provider for PR review tasks#1453
fix(pr): use default provider for PR review tasks#1453arnestrickmann merged 4 commits intogeneralaction:mainfrom
Conversation
|
@jschwxrz is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR fixes a bug where PR review tasks were opened with the Key observations:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/main/ipc/githubIpc.ts | Correctly adds agentId from getAppSettings().defaultProvider to newly-built PR review tasks and backfills it for existing tasks that are missing it; nested conditional logic is functionally correct but unnecessarily complex. |
| src/renderer/components/OpenPrsSection.tsx | Properly threads agentId into the task object passed to onReviewPr, but introduces a redundant rpc.appSettings.get() round-trip and a dead-code renderer-side saveTask call that can never fire after the main-process changes. |
Sequence Diagram
sequenceDiagram
participant UI as OpenPrsSection (Renderer)
participant RPC as rpc (IPC Bridge)
participant IPC as githubIpc (Main)
participant DB as DatabaseService
participant Settings as getAppSettings()
UI->>RPC: appSettings.get()
RPC-->>UI: { defaultProvider }
UI->>IPC: githubCreatePullRequestWorktree(...)
IPC->>Settings: getAppSettings().defaultProvider
Settings-->>IPC: reviewProvider (e.g. 'claude')
alt Existing worktree found
IPC->>DB: getTaskByPath(existing.path)
DB-->>IPC: persistedTask (may have agentId=null)
alt persistedTask missing agentId
Note over IPC: Backfill: existingTask = {...persistedTask, agentId: reviewProvider}
IPC->>DB: saveTask(existingTask)
else persistedTask has agentId
Note over IPC: No save needed
end
IPC-->>UI: { success, worktree, task: existingTask (agentId set) }
else New worktree
Note over IPC: buildTaskInfo() always sets agentId: reviewProvider
IPC->>DB: saveTask(taskInfo)
IPC-->>UI: { success, worktree, task: taskInfo (agentId set) }
end
UI->>UI: Build Task with agentId from result.task.agentId
UI->>UI: onReviewPr(task)
Comments Outside Diff (2)
-
src/renderer/types/electron-api.d.ts, line 880-888 (link)agentIdmissing fromtaskreturn type declarationThe main process (
githubIpc.ts) now always setsagentIdon the returnedtaskobject, but neither thetasktype in this file (lines 880–888) nor the parallel declaration inglobal.d.tshas been updated to reflect this. This is why the renderer must use(result.task as { agentId?: string | null }).agentId— a cast that would be unnecessary if the declared type were accurate. The declaration should be updated so TypeScript can enforce the contract without casts:The same update is needed at line 1692–1700 in this file and in
src/renderer/types/global.d.ts. -
src/main/ipc/githubIpc.ts, line 313-321 (link)Redundant nested condition
The inner
if (persistedTask && !persistedTask.agentId)is logically implied by the outerif (!persistedTask || !persistedTask.agentId)— when!persistedTaskis true the inner condition is always false (no-op), and when!persistedTask.agentIdis true the inner condition is always true. The nesting adds cognitive overhead without guarding any additional case. A clearer equivalent:if (!persistedTask || !persistedTask.agentId) { if (persistedTask) { existingTask = { ...persistedTask, agentId: reviewProvider }; } try { await databaseService.saveTask(existingTask); } catch (dbError) { log.warn('Failed to save existing PR review task to database:', dbError); } }
Last reviewed commit: 442e32e
|
🫡 |
summary:
fix:
fixes #1438