From 002af9f20b2c81ab7a25d0ef1251d0331ce3e125 Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Wed, 26 Aug 2026 13:41:20 +0800 Subject: [PATCH] fix(ui-agent-preset): read a refusal's cause by its detail, not its code --- .../client/ui-agent-preset/src/client/seat-store.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/client/ui-agent-preset/src/client/seat-store.ts b/packages/client/ui-agent-preset/src/client/seat-store.ts index d0b02b2257..0f9f51d4eb 100644 --- a/packages/client/ui-agent-preset/src/client/seat-store.ts +++ b/packages/client/ui-agent-preset/src/client/seat-store.ts @@ -162,11 +162,14 @@ export class AgentPresetSeatController { const { error } = result this.set({ busy: false, - // A mount failure carries its cause twice: `message` wraps it in the + // A refusal carries its cause twice: `message` wraps it in the // roster's own frame, which names the preset the surface reporting - // this already names, and `details.reason` holds the same cause - // without it. - error: error.code === 'agent-preset-invalid' ? error.details.reason : error.message, + // this already names, and a `reason` detail holds the same cause + // without it. Read by the detail rather than by the code, because + // every refusal that has a cause to give names it the same way. + error: 'reason' in error.details && typeof error.details.reason === 'string' + ? error.details.reason + : error.message, current: presetOf(session) ?? '', }) return