fix(code): show unified PR badge for externally-created PRs#1995
Open
richardsolomou wants to merge 2 commits intomainfrom
Open
fix(code): show unified PR badge for externally-created PRs#1995richardsolomou wants to merge 2 commits intomainfrom
richardsolomou wants to merge 2 commits intomainfrom
Conversation
The unified badge depended on `workspace.linkedBranch`, which only got set when the in-app create-PR flow ran. Skills that run `gh pr create` via bash never went through that flow, so the badge fell back to the old "View PR" button (and a dropdown of disabled commit/push items) even though `getPrStatus` had already discovered the PR on the current branch. - TaskActionsMenu: fall back to `gitState.prUrl` when no `linkedBranch` is recorded so the badge appears for any worktree whose current branch has a PR. - TaskActionsMenu: when a PR exists, drop disabled commit/push entries from the adjacent dropdown so it only surfaces actionable items. - AgentService: when a PR URL is detected in bash output, emit `AgentFileActivity` so `WorkspaceService` records the current branch as `linkedBranch`. Keeps PR-aware UI (branch mismatch, diff source) in sync without waiting for the next file edit. Generated-By: PostHog Code Task-Id: 66a40920-2b25-40b6-983e-1a489353431d
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/git-interaction/components/TaskActionsMenu.tsx:101-107
**Hiding disabled actions may obscure actionable context**
When a PR exists, all disabled git actions (not just `view-pr`/`create-pr`) are now silently dropped from the dropdown. This means a disabled `sync` or `branch-here` entry — which normally carries a `disabledReason` tooltip — disappears entirely rather than appearing greyed-out with an explanation. A user who needs to know *why* sync is unavailable (e.g. network issue, diverged branch) gets no signal at all.
The existing `GitDropdownItem` already renders disabled items with a tooltip via `action.disabledReason`, so the infrastructure to surface context while keeping items disabled is in place. Keeping non-PR-specific items visible but disabled preserves that signal without cluttering the menu with truly-redundant entries like `commit` when there's nothing to commit.
Reviews (1): Last reviewed commit: "fix(code): show unified PR badge for ext..." | Re-trigger Greptile |
…ions Narrow the dropdown filter to only drop disabled commit / push / sync / publish entries — these slots flip to disabled solely to signal "no work to do," so they're noise next to a PR badge. Other disabled actions stay visible so their disabledReason tooltip can still explain why they're unavailable (network issues, diverged branch, etc). Generated-By: PostHog Code Task-Id: 66a40920-2b25-40b6-983e-1a489353431d
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The unified PR badge in the task header depends on
workspace.linkedBranchbeing set. #1963 made the link reliable for PRs created through the in-app flow, but skills that rungh pr createvia bash never go throughGitService.createPr— solinkedBranchstays unset and the badge falls back to the old "View PR" button. The dropdown next to it also surfaces disabledCommit/Pushentries even when there's nothing to commit or push, which is just noise.This pattern is common: a
/commit-and-prskill that only shells out to git/gh, no in-app buttons involved.Changes
TaskActionsMenu: fall back togitState.prUrl(already populated bygetPrStatusagainst the current branch) whenlinkedBranchis unset, so the badge appears for any worktree whose current branch has a PR.TaskActionsMenu: when a PR exists, filter out disabledCommit/Pushitems from the adjacent dropdown so it only surfaces actions the user can actually take. The action list when there's no PR is unchanged — disabled feedback there is still useful.AgentService.detectAndAttachPrUrl: when a PR URL is detected in bash output, also emitAgentFileActivitysoWorkspaceService.handleAgentFileActivityrecords the current feature branch aslinkedBranch. Keeps the rest of the PR-aware UI (branch mismatch warning, diff source resolution) in sync without waiting for the next file edit.Closes #1959
How did you test this?
pnpm --filter code typecheck— clean.pnpm --filter code test— 1007 tests pass.pnpm lint— clean.Publish to changelog?
no
Created with PostHog Code