mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
fix: complete instance boot deferreds on interruption
When an instance boot fiber is interrupted by an enclosing scope close, its cache entry kept a never-resolving deferred, hanging every later load or reload of that directory. Complete the deferred and drop failed entries on any exit so subsequent loads boot fresh.
This commit is contained in:
@@ -73,12 +73,20 @@ export const layer: Layer.Layer<Service, never, Project.Service | InstanceBootst
|
||||
return true
|
||||
})
|
||||
|
||||
// kilocode_change start - complete the deferred and drop failed entries on any exit,
|
||||
// including interruption of the boot fiber when an enclosing scope closes. Otherwise a
|
||||
// boot killed mid-flight leaves a never-resolving deferred in the cache and every later
|
||||
// load or reload of that directory hangs forever.
|
||||
const completeLoad = (directory: string, input: LoadInput, entry: Entry) =>
|
||||
Effect.gen(function* () {
|
||||
const exit = yield* Effect.exit(boot({ ...input, directory }))
|
||||
if (Exit.isFailure(exit)) yield* removeEntry(directory, entry)
|
||||
yield* Deferred.done(entry.deferred, exit).pipe(Effect.asVoid)
|
||||
})
|
||||
Effect.suspend(() => boot({ ...input, directory })).pipe(
|
||||
Effect.onExit((exit) =>
|
||||
Effect.gen(function* () {
|
||||
if (Exit.isFailure(exit)) yield* removeEntry(directory, entry)
|
||||
yield* Deferred.done(entry.deferred, exit)
|
||||
}),
|
||||
),
|
||||
)
|
||||
// kilocode_change end
|
||||
|
||||
const emitDisposed = (input: { directory: string; project?: string }) =>
|
||||
Effect.sync(() =>
|
||||
|
||||
Reference in New Issue
Block a user