test: trim unrelated inbox changes
This commit is contained in:
1 parent
bd3b651ea8
commit
90b7ac94e2
3 files changed
+4
-42
No files matched your search
@@ -134,22 +134,6 @@ describe('agent loop', () => {
|
||||
expect(adapter.requests).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('rejects overlapping maintenance work', async () => {
|
||||
const ctx = await harness(new MockAdapter([]))
|
||||
const agent = ctx.agentLoop.create(SessionId('overlapping-maintenance'), {
|
||||
provider: 'mock',
|
||||
model: 'mock',
|
||||
})
|
||||
const finish = Promise.withResolvers<undefined>()
|
||||
const maintenance = agent.runMaintenance(() => finish.promise)
|
||||
|
||||
expect(() => agent.runMaintenance(async () => undefined))
|
||||
.toThrow('agent "overlapping-maintenance" already has active work')
|
||||
|
||||
finish.resolve(undefined)
|
||||
await maintenance
|
||||
})
|
||||
|
||||
it('suppresses the replay when a latched maintenance wake is removed', async () => {
|
||||
const adapter = new MockAdapter([])
|
||||
const ctx = await harness(adapter)
|
||||
|
||||
@@ -55,20 +55,8 @@ async function harness(withRegistry: boolean): Promise<{ ctx: Context; session:
|
||||
}
|
||||
const session = ctx.sessions.create()
|
||||
const agent = {
|
||||
id: session.id,
|
||||
options: {},
|
||||
session,
|
||||
inbox: { nextTurn: [], nextStep: [], hasPending: false } as never,
|
||||
status: 'idle',
|
||||
ctx,
|
||||
send() {},
|
||||
followup() {},
|
||||
steer() {},
|
||||
inject() {},
|
||||
cancel() {},
|
||||
runMaintenance: task => task(new AbortController().signal),
|
||||
whenIdle: () => Promise.resolve(),
|
||||
} satisfies Agent
|
||||
id: session.id, session, inbox: { nextTurn: [], nextStep: [], hasPending: false }, status: 'idle', ctx,
|
||||
} as Agent
|
||||
ctx.agents.register(agent)
|
||||
return { ctx, session, agent }
|
||||
}
|
||||
|
||||
@@ -67,25 +67,15 @@ async function harness(withRegistry: boolean): Promise<{ ctx: Context; session:
|
||||
await ctx.plugin(SessionStore)
|
||||
await ctx.plugin(UserQuestionService)
|
||||
await ctx.plugin(AgentRegistry)
|
||||
if (withRegistry) {
|
||||
await ctx.plugin(SessionProjectionRegistry)
|
||||
}
|
||||
if (withRegistry) await ctx.plugin(SessionProjectionRegistry)
|
||||
const session = ctx.sessions.create()
|
||||
const agent = {
|
||||
id: session.id,
|
||||
options: {},
|
||||
session,
|
||||
inbox: { nextTurn: [], nextStep: [], hasPending: false } as never,
|
||||
status: 'idle',
|
||||
ctx,
|
||||
send() {},
|
||||
followup() {},
|
||||
steer() {},
|
||||
inject() {},
|
||||
cancel() {},
|
||||
runMaintenance: task => task(new AbortController().signal),
|
||||
whenIdle: () => Promise.resolve(),
|
||||
} satisfies Agent
|
||||
} as Agent
|
||||
if (withRegistry) Object.assign(agent, { inbox: new Inbox(ctx, agent.session, agentEvents(ctx, agent)) })
|
||||
ctx.agents.register(agent)
|
||||
return { ctx, session }
|
||||
|
||||
Reference in new issue
Block a user