fix: prevent permission reply from silently escalating "once" to "always"

Remove allow_always from the fallback chain when the user replies "once",
aligning with the ACP spec which says "map by option kind first" with no
fallback for allow_once. Also fix Inspector to use rawSend, revert
hydration guard to accept empty configOptions, and handle respondPermission
errors by rejecting the pending promise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nathan Flurry 2026-03-10 21:52:31 -07:00
parent e8ffd78ac0
commit 6f66f92e72
4 changed files with 16 additions and 9 deletions

View file

@ -870,7 +870,7 @@ export default function App() {
// Apply mode if selected
if (!skipPostCreateConfig && config.agentMode) {
try {
await session.send("session/set_mode", { modeId: config.agentMode });
await session.rawSend("session/set_mode", { modeId: config.agentMode });
} catch {
// Mode application is best-effort
}
@ -886,7 +886,7 @@ export default function App() {
(opt) => opt.category === "model" && opt.type === "select" && typeof opt.id === "string"
);
if (modelOption && config.model !== modelOption.currentValue) {
await session.send("session/set_config_option", {
await session.rawSend("session/set_config_option", {
optionId: modelOption.id,
value: config.model,
});
@ -1241,7 +1241,6 @@ export default function App() {
}));
const title = params?.toolCall?.title ?? params?.toolCall?.toolCallId ?? "Permission request";
const resolved = resolvedPermissions.get(permissionId);
const isPending = pendingPermissionIds.has(permissionId);
entries.push({
id: event.id,
eventId: event.id,
@ -1252,7 +1251,7 @@ export default function App() {
title,
description: params?.toolCall?.description,
options,
resolved: resolved != null || !isPending,
resolved: resolved != null || sdkPermissionId == null,
selectedOptionId: resolved,
},
});
@ -1288,7 +1287,7 @@ export default function App() {
}
return entries;
}, [events, pendingPermissionIds, resolvedPermissions]);
}, [events, resolvedPermissions]);
useEffect(() => {
return () => {