From ce5b1bbc9d64a4deb651b7fbfdbee2cb4ff28e6a Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Tue, 10 Nov 2026 06:56:24 -0500 Subject: [PATCH] fix(orchestration): a chat worker's approval asks to allow its tool, like a terminal worker's --- .../workers/approvals/worker-approval.test.ts | 32 ++++++++++++++++++- .../workers/approvals/worker-approval.ts | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/main/runtime/orchestration/workers/approvals/worker-approval.test.ts b/src/main/runtime/orchestration/workers/approvals/worker-approval.test.ts index 71a84b4380e..9e53d18be6c 100644 --- a/src/main/runtime/orchestration/workers/approvals/worker-approval.test.ts +++ b/src/main/runtime/orchestration/workers/approvals/worker-approval.test.ts @@ -4,7 +4,7 @@ import { codexApprovalItem } from '../../../../codex/structured/prompts/codex-st import { CODEX_MCP_ELICITATION_METHOD } from '../../../../codex/structured/prompts/codex-prompt-registry' import { claudeApprovalItem } from '../../../../claude/structured/journal/claude-structured-prompt-items' import type { AgentJournalPromptOption } from '../../../../../shared/agent-session/journal/agent-session-journal-types' -import { chatAnswerOutcome, workerApprovalOption } from './worker-approval' +import { chatAnswerOutcome, workerApprovalOption, workerApprovalPayload } from './worker-approval' function acpOptions(kinds: string[]): AgentJournalPromptOption[] { const body = acpPermissionPresentation({ @@ -89,3 +89,33 @@ describe('chat answer outcome', () => { }) }) }) + +describe('worker approval title', () => { + const claude = (extra: { displayName?: string; title?: string }) => + claudeApprovalItem({ + requestId: 'r', + promptKey: 'p', + toolUseId: 't', + toolName: 'Bash', + kind: 'approval', + input: { command: 'ls' }, + suggestions: [], + questionIds: [], + settle: () => {}, + ...extra + }) + const title = (item: ReturnType) => + workerApprovalPayload({ + approvalId: 'a', + item, + worker: { handle: 'h', dispatchId: 'd', taskId: 't' } + }).summary.title + + it("asks to allow the tool by Claude's display name, as the terminal card does", () => { + expect(title(claude({ displayName: 'Bash' }))).toBe('Allow Bash?') + }) + + it("keeps Claude's own title when it gives no display name", () => { + expect(title(claude({ title: 'Review proposed plan' }))).toBe('Review proposed plan') + }) +}) diff --git a/src/main/runtime/orchestration/workers/approvals/worker-approval.ts b/src/main/runtime/orchestration/workers/approvals/worker-approval.ts index 45cfb852c5c..09200b928ad 100644 --- a/src/main/runtime/orchestration/workers/approvals/worker-approval.ts +++ b/src/main/runtime/orchestration/workers/approvals/worker-approval.ts @@ -89,7 +89,7 @@ export function workerApprovalPayload(input: { state: outcome ? (outcome.decision === null ? 'expired' : 'answered') : 'open', worker: input.worker, summary: { - title: item.displayName ?? item.title, + title: item.displayName ? `Allow ${item.displayName}?` : item.title, detail, reason: item.decisionReason ?? null },