fix(acp): preserve permission state when tool input is missing (#1782)

This commit is contained in:
SSU-WEI HUANG
2026-09-09 09:22:27 +08:00
committed by GitHub
parent 9048bfa4f1
commit d332cd5957
7 changed files with 156 additions and 34 deletions
@@ -1,7 +1,7 @@
import type { ApiSessionClient } from '@/api/apiSession'
import type { AgentBackend, PermissionRequest, PermissionResponse } from '@/agent/types'
import type { PermissionMode } from '@hapi/protocol/types'
import { deriveToolName } from '@/agent/utils'
import { deriveToolInput, deriveToolName } from '@/agent/utils'
import { logger } from '@/ui/logger'
import {
BasePermissionHandler,
@@ -17,10 +17,6 @@ interface PermissionResponseMessage {
reason?: string
}
function deriveToolInput(request: PermissionRequest): unknown {
return request.rawInput !== undefined ? request.rawInput : request.rawOutput
}
function pickOptionId(request: PermissionRequest, preferredKinds: string[]): string | null {
for (const kind of preferredKinds) {
const match = request.options.find((option) => option.kind === kind)