feat(core): publish interrupted session steps
This commit is contained in:
parent
40ecfceec2
commit
59e8dbb066
12 changed files with 140 additions and 17 deletions
|
|
@ -327,7 +327,7 @@ Recent work
|
|||
])
|
||||
})
|
||||
|
||||
test("drops provider-native continuation metadata from failed assistant turns", () => {
|
||||
test("drops provider-native continuation metadata from interrupted assistant turns", () => {
|
||||
const messages = toLLMMessages(
|
||||
[
|
||||
SessionMessage.Assistant.make({
|
||||
|
|
@ -361,8 +361,7 @@ Recent work
|
|||
time: { created, completed: created },
|
||||
}),
|
||||
],
|
||||
finish: "error",
|
||||
error: { type: "unknown", message: "Provider turn interrupted" },
|
||||
finish: "interrupted",
|
||||
time: { created, completed: created },
|
||||
}),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -542,12 +542,19 @@ const verifyPartialFlushOnInterruption = (kind: FragmentKind) =>
|
|||
const fiber = yield* runner.run({ sessionID, force: true }).pipe(Effect.forkChild)
|
||||
yield* Deferred.await(streamed)
|
||||
yield* Fiber.interrupt(fiber)
|
||||
const { db } = yield* Database.Service
|
||||
const interrupted = yield* db
|
||||
.select({ type: EventTable.type })
|
||||
.from(EventTable)
|
||||
.where(eq(EventTable.type, EventV2.versionedType(SessionEvent.Step.Interrupted.type, 1)))
|
||||
.all()
|
||||
.pipe(Effect.orDie)
|
||||
expect(interrupted).toHaveLength(1)
|
||||
expect(yield* session.context(sessionID)).toMatchObject([
|
||||
{ type: "user", text: prompt },
|
||||
{
|
||||
type: "assistant",
|
||||
finish: "error",
|
||||
error: { type: "unknown", message: "Provider turn interrupted" },
|
||||
finish: "interrupted",
|
||||
content: [
|
||||
kind === "tool input"
|
||||
? { type: "tool", id: fragmentID(kind, "interrupted"), state: { status: "error" } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue