This repository was archived by the owner on Aug 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
fix(git): record every PR created for a local task #3840
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4a302f5
fix(git): record every PR created for a local task
frankh a4e5cf8
Update packages/workspace-server/src/services/agent/agent.ts
frankh 338cd6d
Merge remote-tracking branch 'origin/main' into posthog-code/fix-loca…
frankh 13240e4
Merge branch 'posthog-code/fix-local-task-multiple-prs' of github.com…
frankh 3fcc7b0
fix(git): keep the bot-safe login guard on local PR attribution
frankh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ( | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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