refactor(agent): trim obsolete loop surfaces
This commit is contained in:
@@ -140,13 +140,9 @@ describe('config-driven session id', () => {
|
||||
first.inject([{ type: 'text', text: 'persist before replacement' }], {
|
||||
source: { kind: 'plugin', plugin: 'test' },
|
||||
})
|
||||
await expect.poll(async () => {
|
||||
try {
|
||||
return JSON.stringify((await ctx.sessionPersistence.inspect(sessionId)).events)
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
}).toContain('persist before replacement')
|
||||
await ctx.sessions.flush(first.session)
|
||||
expect(JSON.stringify((await ctx.sessionPersistence.inspect(sessionId)).events))
|
||||
.toContain('persist before replacement')
|
||||
|
||||
const firstDisposal = firstLoop.dispose()
|
||||
await cleanupStarted.promise
|
||||
@@ -190,13 +186,9 @@ describe('config-driven session id', () => {
|
||||
first.inject([{ type: 'text', text: 'persist before cancellation' }], {
|
||||
source: { kind: 'plugin', plugin: 'test' },
|
||||
})
|
||||
await expect.poll(async () => {
|
||||
try {
|
||||
return JSON.stringify((await ctx.sessionPersistence.inspect(sessionId)).events)
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
}).toContain('persist before cancellation')
|
||||
await ctx.sessions.flush(first.session)
|
||||
expect(JSON.stringify((await ctx.sessionPersistence.inspect(sessionId)).events))
|
||||
.toContain('persist before cancellation')
|
||||
|
||||
const firstDisposal = firstLoop.dispose()
|
||||
await cleanupStarted.promise
|
||||
|
||||
@@ -436,7 +436,7 @@ describe('disposal leaves the two-state status contract balanced', () => {
|
||||
await fiber.dispose()
|
||||
await driverDone(agent) // must not hang
|
||||
|
||||
await expect.poll(() => ctx.agents.get(SessionId('scoped')) === undefined).toBe(true)
|
||||
expect(ctx.agents.get(SessionId('scoped'))).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -161,7 +161,6 @@ describe('agent/prompt-submit', () => {
|
||||
expect(log.some(e => e.type === 'turn/end')).toBe(false)
|
||||
expect(log.some(e => e.type === 'user/message')).toBe(false)
|
||||
expect(log.some(e => e.type === 'step/start')).toBe(false)
|
||||
expect(log.some(e => e.type === 'prompt/blocked')).toBe(false)
|
||||
expect(reasons).toEqual([])
|
||||
})
|
||||
|
||||
@@ -189,7 +188,6 @@ describe('agent/prompt-submit', () => {
|
||||
expect(userMsgs).toHaveLength(1)
|
||||
expect(userMsgs[0]?.type === 'user/message' && userMsgs[0].data.content).toEqual([{ type: 'text', text: 'safe' }])
|
||||
expect(adapter.requests.length).toBeGreaterThanOrEqual(1)
|
||||
expect(log.filter(e => e.type === 'prompt/blocked')).toHaveLength(0)
|
||||
expect(log.filter(e => e.type === 'turn/start')).toHaveLength(1)
|
||||
expect(reasons).toEqual([{ kind: 'completed' }])
|
||||
})
|
||||
|
||||
@@ -1041,7 +1041,7 @@ describe('agent loop', () => {
|
||||
await fiber.dispose()
|
||||
await driverDone(agent)
|
||||
|
||||
await expect.poll(() => ctx.agents.get(SessionId('scoped')) === undefined).toBe(true)
|
||||
expect(ctx.agents.get(SessionId('scoped'))).toBeUndefined()
|
||||
})
|
||||
|
||||
it('creates agents from config on startup', async () => {
|
||||
|
||||
Reference in New Issue
Block a user