fix(subagent): keep invalid name errors at admission

This commit is contained in:
Dudu-0223 committed 2026-10-16 15:35:29 +08:00
1 parent 3c0bbdfeb1
commit 72aeefb633
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -244,7 +244,7 @@ export function snapshotSubagentDescriptor(
version: SUBAGENT_DESCRIPTOR_VERSION,
mode: input.mode,
provider: input.provider,
...input.name === undefined ? {} : { name: subagentNameSchema.parse(input.name) },
...input.name === undefined ? {} : { name: input.name },
label: input.label,
...input.agentProvider !== undefined ? { agentProvider: input.agentProvider } : {},
...input.agentModel !== undefined ? { agentModel: input.agentModel } : {},
@@ -119,6 +119,7 @@ describe('tree-wide agent names', () => {
name, childId: SessionId('ephemeral-child'), provider: 'spawn', label: 'Check', delivery: 'caller', signal,
request: { parent, prompt: [{ type: 'text', text: 'Reply' }] },
})
await expect(start('Reviewer')).rejects.toMatchObject({ code: 'INVALID_AGENT_NAME' })
const first = await start('first')
await first.result
expect(ctx.agents.get(first.childId)).toBeUndefined()