The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui): keep approval numbering stable for gateway-supplied choices
teknium1cc27023d24cd
diff --git a/ui-tui/src/__tests__/approvalAction.test.ts b/ui-tui/src/__tests__/approvalAction.test.tsindex 422ea56fb88..8b849c1a056 100644--- a/ui-tui/src/__tests__/approvalAction.test.ts+++ b/ui-tui/src/__tests__/approvalAction.test.ts@@ -81,5 +81,9 @@ describe('approvalAction — pure key dispatch for ApprovalPrompt', () => {description: 'blocked'})).toEqual(['once', 'deny'])+ // Canonical owners send ['once', 'deny', 'session', 'always']: allowed set, not numbering.+ expect(+ approvalOptions({ choices: ['once', 'deny', 'session', 'always'], command: 'rm -rf /', description: 'blocked' })+ ).toEqual(['once', 'session', 'always', 'deny'])})})diff --git a/ui-tui/src/components/prompts.tsx b/ui-tui/src/components/prompts.tsxindex e1d47448809..2d7a8428348 100644--- a/ui-tui/src/components/prompts.tsx+++ b/ui-tui/src/components/prompts.tsx@@ -20,7 +20,8 @@ type ApprovalChoice = 'always' | 'deny' | 'once' | 'session'export function approvalOptions(req: ApprovalReq): readonly ApprovalChoice[] {if (req.choices) {- return req.choices.filter((choice): choice is ApprovalChoice => APPROVAL_OPTS.includes(choice as ApprovalChoice))+ // The gateway decides which choices exist; the numbering stays the familiar one (Deny last).+ return APPROVAL_OPTS.filter(choice => req.choices!.includes(choice))}if (req.smartDenied) {