fix(orchestration): a chat worker's approval asks to allow its tool, like a terminal worker's

This commit is contained in:
Jinwoo-H
2026-11-11 03:39:57 -05:00
parent 2008c31ef6
commit ce5b1bbc9d
2 changed files with 32 additions and 2 deletions
@@ -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<typeof claude>) =>
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')
})
})
@@ -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
},