fix(agent-manager): avoid unrelated merged PR badges - #13872
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 112.2K · Output: 11.6K · Cached: 252.7K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
September 7, 2026 12:39
iscekic
approved these changes
Sep 7, 2026
marius-kilocode
deleted the
fix-describe-environments-to-honour-config
branch
September 7, 2026 12:44
This was referenced Sep 8, 2026
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.
What Problem This Solves
A new worktree can start at a commit that was previously the head of a merged or closed pull request. The commit-SHA fallback searched all pull request states and displayed that unrelated pull request on the new worktree.
Why This Change Was Made
The SHA fallback now searches only open pull requests. Branch-based lookups are unchanged, so a worktree on an actual merged or closed PR branch still displays its matching status.
User Impact
Fresh worktrees no longer inherit unrelated merged or closed PR badges when they share an initial commit with an older pull request. Open fork-style pull requests found through an exact head SHA continue to display normally.
Evidence
Before, a fresh branch incorrectly showed the unrelated merged PR badge:
After, the same fresh branch has no PR badge:
The actual Agent Manager flow was tested with a disposable local Git fixture and deterministic GitHub CLI responses. The baseline reproduced the merged badge, while the fixed build removed it. The fixed build also preserved the merged badge for the actual branch and the open badge for an exact-SHA open PR.
Validation:
bun run compilebun run typecheckbun test tests/unit/am-pr-status-bridge.test.tsbun run check-kilocode-changegit diff --check