Skip to content

fix(vscode): clear completion indicators when opening results - #13731

Merged
marius-kilocode merged 2 commits into
mainfrom
fix/completion-acknowledgement
Sep 3, 2026
Merged

marius-kilocode merged 2 commits into
mainfrom
fix/completion-acknowledgement

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Fixes #13702.
Supersedes #13703.

What Problem This Solves

Completed-session checks remain visible after the result is opened, making it hard to distinguish unread results from sessions that have already been reviewed. Clearing on a session-ID change alone also misses returning from Review, reopening a retained sidebar/editor, and subagent inspector tabs.

Why This Change Was Made

Acknowledge completion when the session's chat becomes visible in the active view. Use the same path for sidebar, native editor, Agent Manager, and subagent views, and share the acknowledgement through the existing connection service.

Keep acknowledgement separate from the turn outcome so opening a result does not discard completion diagnostics. Match it to the closing event ID so a delayed acknowledgement cannot clear a later completion. Replay pending completion events before activating a new view, allowing a newly opened editor to acknowledge results already held by another view. This state is in memory only; no backend API or persistent storage changes are needed.

User Impact

  • Opening a completed session clears its completion notification across its live views.
  • A worktree keeps its badge if another session in it is still unread.
  • Returning from Review or reopening a sidebar, editor, or subagent inspector follows the same rule.
  • A turn that finishes while its chat is already visible still shows its completion check until revisited.
  • Running, waiting, and error indicators remain unchanged, and turn diagnostics remain available.

Evidence

Validation on the branch rebased onto main:

  • bun run compile: host/webview typechecks, lint, bundles, and CLI smoke tests passed.
  • bun run test:unit: 4,688 passed, 1 skipped, 0 failed.
  • bun run knip and bun run check-kilocode-change: passed.
  • bun run format: no changes.

Isolated VS Code self-tests used a real CLI backend with a local deterministic test provider. Covered worktree switching with two completed sessions, same-session Review returns, sibling subagent tabs and inspector reopening, sidebar/editor reactivation, acknowledgement across views, and a new editor opened after completion. Waiting/error states remained visible, and completion in an already focused chat retained its check. The screenshots below were captured from that tested follow-up before rebasing onto current main.

Manual check: finish session A while viewing B, then open A and confirm only its notification clears. Repeat with a worktree session and a subagent tab. Pending input requests and errors must remain visible after focus changes.

Worktree: the last unread session controls the aggregate badge

Checks has been opened, but Implementation remains unread:

Worktree completion badge remains while Implementation is unread

After opening Implementation, its notification and the worktree badge clear while the result remains:

Opening Implementation clears the session and worktree completion badges
Subagents: opening the completed child leaves its running sibling unchanged

Before and after opening Analysis. Review remains busy:

Analysis has an unread completion while Review remains busy Opening Analysis clears its completion badge while Review remains busy
Focus regression follow-up: command palette versus panel activation

Commit c1da52a makes host activation the sole activity source. DOM focus still reports keyboard context, but cannot acknowledge completion. The separate readiness flag is no longer needed because activity starts false until the host activates the view.

The new active and inactive focus/blur regressions failed before the fix and pass afterward. All 49 targeted tests, typechecks, lint, build, unused-export checks, and change-marker checks pass.

In isolated VS Code, opening the command palette made document focus false; Escape restored it to true without clearing the completed tab:

Completion check remains after dismissing the command palette

Switching to another editor and then reactivating the Kilo tab still clears the completion check:

Completion check clears after switching away and reactivating the Kilo tab

Comment thread packages/kilo-vscode/webview-ui/src/context/vscode.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/kilo-vscode/tests/fixtures/session-provider-activity.tsx
  • packages/kilo-vscode/webview-ui/src/context/vscode.tsx
Previous Review Summary (commit 05ae514)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 05ae514)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/context/vscode.tsx 96 document.hasFocus() overwrites host panel.active, so blur/focus can acknowledge independently of the activation signal
Files Reviewed (20 files)
  • .changeset/clear-completed-indicator-on-focus.md
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/kilo-provider-utils.ts
  • packages/kilo-vscode/src/services/cli-backend/connection-service.ts
  • packages/kilo-vscode/tests/fixtures/session-provider-activity.tsx
  • packages/kilo-vscode/tests/unit/kilo-provider-acknowledgement.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-load-messages.test.ts
  • packages/kilo-vscode/tests/unit/kilo-provider-utils.test.ts
  • packages/kilo-vscode/tests/unit/native-tab-title.test.ts
  • packages/kilo-vscode/tests/unit/presence-registration-contract.test.ts
  • packages/kilo-vscode/tests/unit/session-activity.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/SubagentPanel.tsx
  • packages/kilo-vscode/webview-ui/src/App.tsx
  • packages/kilo-vscode/webview-ui/src/context/session-types.ts
  • packages/kilo-vscode/webview-ui/src/context/session.tsx
  • packages/kilo-vscode/webview-ui/src/context/vscode.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/src/types/messages/extension-messages.ts
  • packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts
  • packages/kilo-vscode/webview-ui/src/utils/session-activity.ts

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 45.3K · Output: 6.1K · Cached: 326K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit c23758a into main Sep 3, 2026
25 checks passed
@marius-kilocode
marius-kilocode deleted the fix/completion-acknowledgement branch September 3, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: VSCode, clear the completed (✓) session indicator when you focus/open that tab

2 participants