refactor(tasks): simplify admission configuration

This commit is contained in:
pku-xht
2026-08-11 17:12:53 +08:00
parent 9d173f8333
commit c98a4d0949
6 changed files with 58 additions and 36 deletions
@@ -186,12 +186,24 @@ describe('dsh-acp-demo composition', () => {
const ctx = await mount({
provider: 'mock',
model: 'mock',
tasks: { maxConcurrentTasksPerOwner: 2 },
tasks: { maxConcurrentTasksPerOwner: 1 },
skills: await isolatedSkillsConfig(),
workspaceContext: false,
})
expect((ctx.tasks as unknown as { config: { maxConcurrentTasksPerOwner: number } })
.config.maxConcurrentTasksPerOwner).toBe(2)
let settle!: (outcome: { status: 'killed' }) => void
ctx.tasks.start({
kind: 'bash',
label: 'hold configured slot',
run: () => ({
cancel: () => { settle({ status: 'killed' }) },
done: new Promise((resolve) => { settle = resolve }),
}),
})
expect(() => ctx.tasks.start({
kind: 'bash',
label: 'blocked configured task',
run: () => ({ cancel: () => {}, done: Promise.resolve({ status: 'completed' }) }),
})).toThrow('(limit: 1)')
await ctx.fiber.dispose()
})