mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-30 19:32:39 +08:00
fix(agent-manager): keep slow snapshot initialization non-blocking
This commit is contained in:
@@ -59,6 +59,7 @@ type Input = {
|
||||
sessionID: SessionID
|
||||
model: Provider.Model
|
||||
telemetry?: ReviewTelemetry // kilocode_change
|
||||
snapshotInitialization?: "wait" // kilocode_change - managed clients wait silently for slow baseline creation
|
||||
}
|
||||
|
||||
export interface Interface {
|
||||
@@ -121,10 +122,11 @@ export const layer: Layer.Layer<
|
||||
// Pre-capture snapshot before the LLM stream starts. The AI SDK
|
||||
// may execute tools internally before emitting start-step events,
|
||||
// so capturing inside the event handler can be too late.
|
||||
// kilocode_change start - pass sessionID + messageID so the slow-repo prompt/progress indicator can attach
|
||||
// kilocode_change start - pass turn context for slow-snapshot UI/policy handling
|
||||
const initialSnapshot = yield* snapshot.track({
|
||||
sessionID: input.sessionID,
|
||||
messageID: input.assistantMessage.id,
|
||||
snapshotInitialization: input.snapshotInitialization,
|
||||
})
|
||||
// kilocode_change end
|
||||
const ctx: ProcessorContext = {
|
||||
@@ -505,9 +507,13 @@ export const layer: Layer.Layer<
|
||||
case "start-step":
|
||||
ctx.stepStart = performance.now() // kilocode_change
|
||||
ctx.step = { reasoning: false, text: false, tool: false } // kilocode_change
|
||||
// kilocode_change start - pass sessionID + messageID so the slow-repo prompt/progress indicator can attach
|
||||
// kilocode_change start - pass turn context for slow-snapshot UI/policy handling
|
||||
if (!ctx.snapshot)
|
||||
ctx.snapshot = yield* snapshot.track({ sessionID: ctx.sessionID, messageID: ctx.assistantMessage.id })
|
||||
ctx.snapshot = yield* snapshot.track({
|
||||
sessionID: ctx.sessionID,
|
||||
messageID: ctx.assistantMessage.id,
|
||||
snapshotInitialization: input.snapshotInitialization,
|
||||
})
|
||||
// kilocode_change end
|
||||
if (!ctx.assistantMessage.summary) {
|
||||
// TODO(v2): Temporary dual-write while migrating session messages to v2 events.
|
||||
@@ -533,10 +539,11 @@ export const layer: Layer.Layer<
|
||||
return
|
||||
|
||||
case "finish-step": {
|
||||
// kilocode_change start - pass sessionID + messageID
|
||||
// kilocode_change start - pass turn context for slow-snapshot UI/policy handling
|
||||
const completedSnapshot = yield* snapshot.track({
|
||||
sessionID: ctx.sessionID,
|
||||
messageID: ctx.assistantMessage.id,
|
||||
snapshotInitialization: input.snapshotInitialization,
|
||||
})
|
||||
// kilocode_change end
|
||||
const usage = Session.getUsage({
|
||||
|
||||
Reference in New Issue
Block a user