Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/jetbrains-deleted-session-badge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kilocode/kilo-jetbrains": patch
---

Stop showing a running badge for a session that was just deleted.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ class KiloSessionService internal constructor(
* Per-session activity for history and session lists. [activity] is the richer source — it also
* carries waiting and failed sessions, and it covers sessions that are not open — but it drops
* sessions whose directory the backend cannot resolve, so the busy statuses stay as a fallback.
*
* [statuses] and [activity] prune [removed] through separate collectors, so one can still carry
* a deleted session while the other has already dropped it. Subtracting [removed] here keeps the
* merged snapshot consistent instead of briefly badging a deleted session as running.
*/
internal fun activitySnapshot(): Map<String, SessionActivityKind> {
val busy = statuses.value.filterValues { it.type == "busy" }.mapValues { SessionActivityKind.RUNNING }
return busy + activity.value.mapValues { it.value.kind.toKind() }
return (busy + activity.value.mapValues { it.value.kind.toKind() }) - removed.value
}

suspend fun list(dir: String): SessionListDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ class KiloSessionServiceTest : BasePlatformTestCase() {
"ses_failed" to SessionActivityDto("/repo/wt", SessionActivityKindDto.ERROR),
"ses_asking" to SessionActivityDto("/repo/wt", SessionActivityKindDto.QUESTION),
)
service.activity.first { it.isNotEmpty() }
// Both maps feed the snapshot through separate collectors, so wait for each one.
service.statuses.first { it.isNotEmpty() }
service.activity.first { it.size == 2 }

assertEquals(
mapOf(
Expand Down
Loading