@@ -389,7 +389,7 @@ import Foundation
389389 func removeEntries( forModelKey modelKey: String ) {
390390 lock. withLock {
391391 reapDeadSessionsLocked ( )
392- for id in buckets. keys {
392+ for id in Array ( buckets. keys) {
393393 guard var bucket = buckets [ id] else {
394394 continue
395395 }
@@ -410,7 +410,10 @@ import Foundation
410410 }
411411
412412 private func reapDeadSessionsLocked( ) {
413- for (id, bucket) in buckets where bucket. sessionReference. session == nil {
413+ let deadSessionIDs = buckets. compactMap { id, bucket in
414+ bucket. sessionReference. session == nil ? id : nil
415+ }
416+ for id in deadSessionIDs {
414417 buckets [ id] = nil
415418 }
416419 }
@@ -442,7 +445,7 @@ import Foundation
442445 static let shared = GPUMemoryManager ( )
443446
444447 private let lock = NSLock ( )
445- private var knownConfigs : Set < GPUMemoryConfiguration > = [ . automatic ]
448+ private var knownConfigs : Set < GPUMemoryConfiguration > = [ ]
446449 private var activeScopes : [ UUID : GPUMemoryConfiguration ] = [ : ]
447450
448451 private init ( ) {
@@ -500,7 +503,10 @@ import Foundation
500503 }
501504
502505 private func shouldClearOnEviction( ) -> Bool {
503- knownConfigs. contains { $0. clearCacheOnEviction }
506+ if knownConfigs. isEmpty {
507+ return GPUMemoryConfiguration . automatic. clearCacheOnEviction
508+ }
509+ return knownConfigs. contains { $0. clearCacheOnEviction }
504510 }
505511 }
506512
@@ -852,17 +858,6 @@ import Foundation
852858 }
853859 previousToolCallSignature = signature
854860
855- if !assistantText. isEmpty {
856- allEntries. append (
857- . response(
858- Transcript . Response (
859- assetIDs: [ ] ,
860- segments: [ . text( . init( content: assistantText) ) ]
861- )
862- )
863- )
864- }
865-
866861 let resolution = try await resolveToolCalls ( collectedToolCalls, session: session)
867862 switch resolution {
868863 case . stop( let calls) :
0 commit comments