fix(core): preserve instruction state on move (#42398)

This commit is contained in:
Kit Langton
2026-08-13 16:20:14 -04:00
committed by GitHub
Unverified
parent 4836356c17
commit b882ccc57d
4 changed files with 13 additions and 4 deletions
-1
View File
@@ -436,7 +436,6 @@ const layer = Layer.effectDiscard(
.where(eq(SessionTable.id, event.data.sessionID))
.run()
.pipe(Effect.orDie)
yield* InstructionState.reset(db, event.data.sessionID)
}),
)
// Sessions whose ownership came from the directory's previous resolution
+7 -2
View File
@@ -1204,12 +1204,17 @@ describe("SessionRunnerLLM", () => {
}),
)
it.effect("interrupts a source Location runner after a Session moves", () =>
it.effect("preserves instruction state and interrupts the source Location runner after a Session moves", () =>
Effect.gen(function* () {
const session = yield* setup
const bus = yield* Bus.Service
const { db } = yield* Database.Service
yield* runPrompt(session, "First")
const instructionState = yield* db
.select()
.from(InstructionStateTable)
.where(eq(InstructionStateTable.session_id, sessionID))
.get()
yield* bus.publish(SessionEvent.Moved, {
sessionID,
@@ -1218,7 +1223,7 @@ describe("SessionRunnerLLM", () => {
})
expect(
yield* db.select().from(InstructionStateTable).where(eq(InstructionStateTable.session_id, sessionID)).get(),
).toBeUndefined()
).toEqual(instructionState)
yield* admit(session, "Second")
const exit = yield* session.resume(sessionID).pipe(Effect.exit)