fix(test): auto-acknowledge tool-result follow-ups in mock LLM server (#20528)

This commit is contained in:
Kit Langton
2026-04-01 19:47:26 -04:00
committed by GitHub
parent 48db7cf07a
commit d9d4f895bc
13 changed files with 482 additions and 117 deletions

View File

@@ -84,13 +84,17 @@ export namespace SessionProcessor {
const status = yield* SessionStatus.Service
const create = Effect.fn("SessionProcessor.create")(function* (input: Input) {
// 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.
const initialSnapshot = yield* snapshot.track()
const ctx: ProcessorContext = {
assistantMessage: input.assistantMessage,
sessionID: input.sessionID,
model: input.model,
toolcalls: {},
shouldBreak: false,
snapshot: undefined,
snapshot: initialSnapshot,
blocked: false,
needsCompaction: false,
currentText: undefined,
@@ -250,7 +254,7 @@ export namespace SessionProcessor {
throw value.error
case "start-step":
ctx.snapshot = yield* snapshot.track()
if (!ctx.snapshot) ctx.snapshot = yield* snapshot.track()
yield* session.updatePart({
id: PartID.ascending(),
messageID: ctx.assistantMessage.id,