fix(jetbrains): harden Agent Manager worktree flows - #13423
Merged
Conversation
Session rows in the worktree editor are all peers, so bolding every title added noise without conveying hierarchy. ActiveListConfig now carries a bold flag that defaults to on and the worktree session list opts out, leaving the worktree, history and settings lists unchanged.
…tree start Creating a worktree with a prompt opens the new session and dispatches the prompt in the same EDT event, so the history load resolves afterwards with no messages and fired ViewChanged.ShowEmpty. That re-showed the account overlay and wedged the view state, because showSession() early-returns once model.showSession is set, so hideAccountOverlay() could never run again and the account chip stayed on top of a running session. setControllerViewState now ignores ShowEmpty once the transcript is shown.
New worktrees were appended, so the row the user just created landed at the bottom of a long list. The optimistic row is now inserted at index 0 for create, import-PR and move, reload keeps pending rows on top newest-first, and the backend records the created path at the head of the persisted order so the row stays there across reloads and restarts. Drag reorder still overrides it.
A Stop makes the CLI publish session.error with MessageAbortedError, which the activity manager keeps in a sticky errors set that only session.turn.open cleared. kind() checked that set before busy, so a resumed session kept the resting glyph whenever the turn event was missed or arrived after the busy status: the status stream and the chat events are separate collectors, so their order is not guaranteed. Busy now outranks a pending error and also clears it, and the per-directory aggregate prefers running over error so one stopped session cannot mask a sibling that is still working. An error that is never resumed still persists through idle as before.
Header popups budgeted their height against the IDE layered pane and anchored on the session panel's full bounds, so a session in a short tool window or an editor tab got balloons spanning the whole window. Placement now uses the session panel's visible rect for the height budget and the vertical clamp, mirroring SessionHoverCopyOverlay. The pane still decides only which side has horizontal room: clamping the width to the view rect would collapse the popup, since it deliberately sits beside the session.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Previous Review Summaries (9 snapshots, latest commit b3e1988)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit b3e1988)Status: No Issues Found | Recommendation: Merge Files Reviewed (6 files)
Previous review (commit 80e8213)Status: No Issues Found | Recommendation: Merge Files Reviewed (10 files)
Previous review (commit 4078d7c)Status: No Issues Found | Recommendation: Merge Files Reviewed (20 files)
Previous review (commit 64ab942)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous review (commit 322426d)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous review (commit 28d0f3f)Status: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous review (commit a1ccea4)Status: No Issues Found | Recommendation: Merge Files Reviewed (8 files)
Previous review (commit f80d7d3)Status: No Issues Found | Recommendation: Merge Files Reviewed (8 files)
Previous review (commit 047c989)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (19 files)
Reviewed by grok-4.6 · Input: 51.1K · Output: 4.4K · Cached: 323.8K Review guidance: REVIEW.md from base branch |
The leading icon dropped back to the resting branch glyph for an errored session, so a worktree whose session had just failed looked idle and the failure was only visible after opening the session. Error now takes the leading slot like the other kinds that need the user, and an operation on the row still outranks it.
…read The dot mirrored the activity snapshot, and an error stays in that snapshot until its session runs again, so a failed session left the dot lit for good. AgentAttention now tracks which sessions the user has already seen: attention that is pending while the Agent Manager is on screen counts as read, because the rows carry the badge there. The dot is therefore re-evaluated on tab selection and tool window visibility as well as on activity, and a session that recovers and fails again lights it once more.
…Agents dot activitySnapshot() only mapped busy statuses to RUNNING, so session and history rows had no source for the other kinds: a failed session showed no badge even though the backend already reported ERROR for it. The snapshot now derives from that activity map, with the busy statuses kept as a fallback for sessions whose directory the backend cannot resolve. Worktree rows and session rows therefore read the same source. The dot also treated 'the Agent Manager is on screen' as read, which suppressed it for a session that failed while the user was working in a session editor. Reading now means the panel is focused, so the dot appears on failure and still clears once the user looks at the tab.
Tracking which sessions the user had looked at made the dot disappear on a tab round trip while a worktree was still failed or waiting, which is the opposite of what the signal is for. The dot mirrors the activity snapshot again: it stays up while any session in any worktree needs the user, and clears only when that state does.
Header popups pointed at the edge of the whole session, so a balloon for a card in the middle of a wide transcript was flung to the far side of the session and read as belonging to whatever panel it landed on. The pointer now lands on the edge of the card the popup describes, which keeps it attached to that card. Room is still measured against the window: cards are narrower than the session, so measuring inside the session would leave almost no width for a card in a split editor. Height still comes from the visible session, since a collapsed card header is only a couple of rows tall.
Header popups now set the platform corner-to-pointer distance instead of moving the target point when a balloon body has to shift into the visible session. This keeps the arrow attached to the card or row the popup describes while still fitting the body in the viewport. The geometry tests cover top and bottom shifts, collapsed cards, offscreen fallback, and the platform-legal pointer distance range so the balloon keeps its pointer.
…ession status Render the Agent Manager worktree list titles and section header in normal weight and soften the idle worktree glyphs to a mid-tone neutral. Tint only monochrome row icons to the selection foreground so colored status icons (running/question/error) keep their hue. Prune a deleted session's lingering question/error status locally so the session list, worktree list, and tab attention dot re-evaluate instead of showing a stale badge.
Gate the header hover popup on a suppression predicate so it neither opens nor stays alive while the connection banner or modal blocker covers the session, and dismiss any open popup when such an overlay appears.
johnnyeric
approved these changes
Aug 25, 2026
Replace the popup-level overlay suppression with hit-testing truth. A card's hover exit test now asks which component is topmost at that point instead of only comparing bounds, so an overlay painted above the transcript counts as having left the row. An overlay child can declare that it blocks the content beneath it, and the layered panel then releases the hover of whatever the pointer rests on when such a cover appears, moves, or hides — Swing delivers no exit for that case on its own. The connection banner is the first blocking overlay, so a card it covers no longer stays lit and no longer keeps its hover popup open behind the banner. Also repair the worktree icon palette test the mid-tone glyph change broke.
# Conflicts: # packages/kilo-jetbrains/backend/src/test/kotlin/ai/kilocode/backend/rpc/KiloWorktreeRpcApiImplTest.kt
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.
Issue
No linked issue - defects found while testing the Agent Manager worktree flow in the JetBrains plugin.
Context
This PR groups several small JetBrains Agent Manager fixes that share the same worktree/session testing path. The fixes improve row presentation, worktree ordering, session activity state, hover popup placement, notification attention handling, and local worktree config hygiene.
What Changed
jetbrains.jsonfiles so generated/local JetBrains worktree state is not committed accidentally.Implementation Notes
The account-overlay race came from opening a new session and dispatching its pending prompt in the same EDT event. The later empty history load fired
ShowEmptyafter the transcript was already active, re-showing the account overlay. The view-state handler now ignoresShowEmptyonce the transcript is shown.Worktree activity now makes
busyoutrank and clear pending errors, so a resumed session no longer depends on chat-event/status-stream ordering. Directory aggregation also prefersRUNNINGover staleERROR, while permission/question states still win because they require user action.Attention tracking now records which sessions the user has already seen in Agent Manager. The tab dot represents unseen attention rather than every sticky activity item, so it clears when the user views the relevant rows and lights again for fresh attention.
The PR badge click bug was stale Swing geometry:
WorktreeStatsViewused anulllayout in a single renderer stamp reused across rows, so min-size data from one row could shift the next row's visual badge away from its hit rectangle. The stats view now uses a real layout manager, the renderer invalidates the full stamp before layout, and the metrics memo key covers all state thatsync()applies.Verification
Executed from
packages/kilo-jetbrains/:./gradlew typecheck- passes./gradlew test- passesorigin/main:./gradlew test typecheck- passesNew/updated automated coverage includes:
HistoryLoadingTest/SessionUiLayoutTestfor the account-overlay history race.KiloBackendActivityManagerTest/WorktreeActivityTestfor activity precedence and resumed sessions.AgentAttentionTestfor seen/unseen Agent Manager attention.WorktreeIconsTest,WorktreeControllerTest,AgentManagerPanelTest, andKiloWorktreeRpcApiImplTestfor worktree row icons and ordering.WorktreeSessionEditorPanelTestfor regular-weight session titles.HeaderPopupGeometryTestfor visible-session popup bounds.SettingsListViewTestfor stable PR badge hit regions across rows with different metric widths.Reviewer Notes
Manual IDE verification was not performed in this environment. A reviewer should still run
./gradlew runIdefrompackages/kilo-jetbrains/and smoke-test the visual flows: create/import/move worktrees, Stop -> resume, failed sessions, Agent tab dot clearing, constrained header popups, and clicking PR badges in the worktree list.Checklist