mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
Merge pull request #13470 from Kilo-Org/fix/jetbrains-deleted-session-activity-snapshot
fix(jetbrains): prune deleted sessions in the merged activity snapshot
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/kilo-jetbrains": patch
|
||||
---
|
||||
|
||||
Stop showing a running badge for a session that was just deleted.
|
||||
+5
-1
@@ -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 {
|
||||
|
||||
+3
-1
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user