refactor(core): name session runner test services (#45445)

This commit is contained in:
Kit Langton 2026-08-27 18:47:44 -04:00 committed by GitHub
parent 7d007670a0
commit ace4249711
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1610,6 +1610,7 @@ describe("SessionRunnerLLM", () => {
it.effect("seeds a fork with the parent's newest instruction values", () =>
Effect.gen(function* () {
const session = yield* setup
const database = yield* Database.Service
yield* runPrompt(session, "First")
systemBaseline = "Changed context"
const second = yield* runPrompt(session, "Second")
@ -1618,7 +1619,7 @@ describe("SessionRunnerLLM", () => {
const forked = yield* session.fork({ sessionID, boundary: { type: "before", messageID: second.id } })
expect(
yield* (yield* Database.Service).db
yield* database.db
.select()
.from(InstructionStateTable)
.where(eq(InstructionStateTable.session_id, forked.id))
@ -1666,6 +1667,7 @@ describe("SessionRunnerLLM", () => {
it.effect("keeps nested forks self-contained", () =>
Effect.gen(function* () {
const session = yield* setup
const database = yield* Database.Service
yield* runPrompt(session, "First")
systemBaseline = "Changed context"
const second = yield* runPrompt(session, "Second")
@ -1681,7 +1683,7 @@ describe("SessionRunnerLLM", () => {
})
expect(
yield* (yield* Database.Service).db
yield* database.db
.select()
.from(InstructionStateTable)
.where(eq(InstructionStateTable.session_id, grandchild.id))
@ -2496,6 +2498,7 @@ describe("SessionRunnerLLM", () => {
it.effect("automatically compacts into a completed summary and retained recent turn", () =>
Effect.gen(function* () {
const session = yield* setup
const store = yield* SessionStore.Service
yield* TestLLM.push(TestLLM.textWithUsage("Earlier answer", "text-first", 3_950))
yield* runPrompt(session, "Earlier question ".repeat(180))
@ -2513,7 +2516,7 @@ describe("SessionRunnerLLM", () => {
expect(userTexts(requests[1])[0]).toContain("<summary>\n## Objective\n- Preserve the task\n</summary>")
expect(userTexts(requests[1])[0]).toContain(`[User]: ${"Recent exact request ".repeat(180)}`)
const context = yield* (yield* SessionStore.Service).context(sessionID)
const context = yield* store.context(sessionID)
expect(context.map((message) => message.type)).toEqual(["compaction", "assistant"])
expect(context[0]).toMatchObject({
type: "compaction",
@ -2533,7 +2536,7 @@ describe("SessionRunnerLLM", () => {
"<previous-summary>\n## Objective\n- Preserve the task\n</previous-summary>",
)
expect(userTexts(requests[0])[0]).toContain("Recent exact request")
expect((yield* (yield* SessionStore.Service).context(sessionID))[0]).toMatchObject({
expect((yield* store.context(sessionID))[0]).toMatchObject({
type: "compaction",
summary: "## Objective\n- Preserve the updated task",
})
@ -3683,6 +3686,7 @@ describe("SessionRunnerLLM", () => {
it.effect("coalesces multiple active steering prompts into one continuation step", () =>
Effect.gen(function* () {
const session = yield* setup
const execution = yield* SessionExecution.Service
yield* admit(session, "Start working")
yield* TestLLM.push(TestLLM.stop(), TestLLM.stop())
@ -3698,7 +3702,7 @@ describe("SessionRunnerLLM", () => {
expect(requests).toHaveLength(2)
expect(userTexts(requests[1])).toEqual(["Start working", "First steer", "Second steer"])
yield* (yield* SessionExecution.Service).wake(sessionID)
yield* execution.wake(sessionID)
yield* Effect.yieldNow
expect(requests).toHaveLength(2)
}),
@ -3933,6 +3937,7 @@ describe("SessionRunnerLLM", () => {
it.effect("promotes the first queued input when woken while idle", () =>
Effect.gen(function* () {
const session = yield* setup
const execution = yield* SessionExecution.Service
yield* session.prompt({
sessionID,
text: "Wait in queue",
@ -3941,7 +3946,7 @@ describe("SessionRunnerLLM", () => {
})
const stream = yield* TestLLM.gate
yield* (yield* SessionExecution.Service).wake(sessionID)
yield* execution.wake(sessionID)
yield* stream.started
yield* stream.release
@ -3953,6 +3958,7 @@ describe("SessionRunnerLLM", () => {
it.effect("retries inbox input after prompt projection rolls back", () =>
Effect.gen(function* () {
const session = yield* setup
const execution = yield* SessionExecution.Service
const bus = yield* Bus.Service
const defect = new Error("fail after prompt promotion")
let fail = true
@ -3965,7 +3971,7 @@ describe("SessionRunnerLLM", () => {
yield* TestLLM.push(TestLLM.stop())
const stream = yield* TestLLM.gate
yield* (yield* SessionExecution.Service).wake(sessionID)
yield* execution.wake(sessionID)
yield* stream.started
yield* stream.release