-
Notifications
You must be signed in to change notification settings - Fork 62
fix(git): record every PR created for a local task #3840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4a302f5
a4e5cf8
338cd6d
13240e4
3fcc7b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,27 @@ export class TaskPrStatusService { | |
| }); | ||
| } | ||
|
|
||
| async accumulatePrUrl(taskId: string, prUrl: string): Promise<void> { | ||
| if (!this.workspaceRepo.findByTaskId(taskId)) return; | ||
| const details = await this.gitService | ||
| .getPrDetailsByUrl(prUrl) | ||
| .catch(() => null); | ||
|
Comment on lines
+74
to
+76
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When two PRs are created for the same task before either details lookup finishes, their URLs are appended in lookup-completion order rather than creation order. Since the UI treats Knowledge Base Used: workspace-server Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/workspace-server/src/services/git/task-pr-status.ts
Line: 74-76
Comment:
**PR creation order is lost**
When two PRs are created for the same task before either details lookup finishes, their URLs are appended in lookup-completion order rather than creation order. Since the UI treats `prUrls[0]` as primary, the second-created PR is displayed as the primary badge when its lookup resolves first.
**Knowledge Base Used:** [workspace-server](https://app.greptile.com/posthog-org-19734/-/custom-context/knowledge-base/posthog/code/-/docs/workspace-server.md)
How can I resolve this? If you propose a fix, please make it concise. |
||
| const prState: SidebarPrState = details | ||
| ? mapPrState(details.state, details.merged, details.draft) | ||
| : null; | ||
| this.workspaceRepo.updatePrCache(taskId, { | ||
| prUrl, | ||
| prState, | ||
| accumulate: true, | ||
| }); | ||
| this.workspaceService.emit("taskPrInfoChanged", { | ||
| taskId, | ||
| prUrl, | ||
| prUrls: this.workspaceRepo.getPrUrls(taskId), | ||
| prState, | ||
| }); | ||
| } | ||
|
|
||
| private async computeWorktreeHasDiff(taskId: string): Promise<boolean> { | ||
| const workspace = await this.workspaceService.getWorkspace(taskId); | ||
| if ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the app shuts down after PR creation while
getPrDetailsByUrlis still pending, this discarded promise reaches the closed database and rejects without being handled. The create-PR flow has already reported success, but the new PR URL is never persisted and disappears from the task after restart.Rule Used: Always wrap asynchronous calls that may fail, such... (source)
Learned From
PostHog/posthog#32098
Knowledge Base Used:
apps/code)Prompt To Fix With AI