Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(cli): Copilot's questions and permission prompts were unanswerable

0xken155ffef598709b
diff --git a/cli/src/engines/README.md b/cli/src/engines/README.md
index b4ca71a04..238d7d71a 100644
--- a/cli/src/engines/README.md
+++ b/cli/src/engines/README.md
@@ -300,6 +300,18 @@ conversation reports the last turn as still open and nothing is ever coming to c
`turn_heartbeat` every second, indefinitely). Its pane knows — `? for shortcuts` when idle,
`esc to cancel` while busy — so attach reads the pane once and closes the folded turn.
+**A dialog you can read is not a dialog you can judge.** Copilot names the SUBJECT of a permission
+prompt above the question, not in it: "Copilot is attempting to access the following URL:" over a
+boxed value, then "Do you want to allow this access?" with a bare "Yes" as option 1. The shared parser
+returns the question correctly and the device still gets a choice nobody can make — approving network
+access without seeing the domain. Fold the subject into the question; leave the rows alone.
+
+**And one silent run does not prove a prompt is absent.** Copilot gates on FOLDER trust first, so a
+shell command in a trusted directory runs with no prompt at all — which reads exactly like "this
+engine never asks". Its permission model is patterns (`shell(cmd)`, `write(path)`, `url(domain)`),
+and it took a URL fetch to raise one. Find the condition that triggers the prompt before writing that
+an engine has none.
+
**One process can change session underneath you.** Every engine here but Copilot starts a new process
to switch conversations, so `bindObservedAgent` stops at the first `agent.sessionId` and never looks
again. Copilot's `/resume` switches IN PROCESS: same pid, same pane, different conversation — and the
diff --git a/cli/src/engines/copilot/askQuestion.ts b/cli/src/engines/copilot/askQuestion.ts
new file mode 100644
index 000000000..da033675c
--- /dev/null
+++ b/cli/src/engines/copilot/askQuestion.ts
@@ -0,0 +1,66 @@
+/**
+ * Copilot's permission prompts name their SUBJECT above the question, not inside it.
+ *
+ * Measured on 1.0.80, unframed:
+ *
+ * Fetch web content
+ * ─────────────────
+ * Copilot is attempting to access the following URL:
+ * ╭─────────────────────╮
+ * │ https://example.com │
+ * ╰─────────────────────╯
+ * Do you want to allow this access?
+ * ❯ 1. Yes
+ * 2. Yes, and approve all URLs from "https://example.com" for the rest of the running session
+ * …
+ *
+ * The shared parser reads that correctly and returns "Do you want to allow this access?" — which is
+ * the question, exactly as it should. But on a device that is the whole prompt: four options, and no
+ * way to see WHAT is being allowed. Row 1 is a bare "Yes". Approving network access without seeing
+ * the domain is not a choice anyone can make well.
+ *
+ * So the subject is folded into the question. Nothing else is touched: the rows, the decline row and
+ * the row numbering all stay as the shared parser produced them.
+ */
+
+import type { PaneView } from '../../lib/askQuestion.js'
+
+const ESCAPES = /\u001b\[[0-9;:]*[A-Za-z]/g
+/** `Copilot is attempting to access the following URL:` / `… to run the following command:` etc. */
+const ATTEMPT = /Copilot is attempting to [^:]{0,60}:/i
+const MAX_SUBJECT = 120
+
+/**
+ * The boxed value Copilot puts between "attempting to …:" and the question.
+ *
+ * Read from the RAW capture rather than the unframed text: unframing flattens the outer dialog border,
+ * and the subject's own inner box is what makes it findable.
+ */
+export function copilotPromptSubject(capture: string): string | null {
+ const lines = capture.replace(ESCAPES, '').split('\n').map((line) => line.trim())
+ const start = lines.findIndex((line) => ATTEMPT.test(line))
+ if (start === -1) return null
+ const parts: string[] = []
+ for (let i = start + 1; i < lines.length && i < start + 12; i++) {
+ const line = lines[i]
+ // Peel the outer dialog border first, then the subject's own box.
+ const inner = line.replace(/^│\s*/, '').replace(/\s*│$/, '').trim()
+ if (/^[╭╰├└┌]/.test(inner) || !inner) continue
+ const value = inner.replace(/^│\s*/, '').replace(/\s*│$/, '').trim()
+ if (!value) continue
+ // The question itself ends the subject.
+ if (/\?\s*$/.test(value)) break
+ parts.push(value)
+ if (parts.join(' ').length > MAX_SUBJECT) break
+ }
+ const subject = parts.join(' ').trim()
+ return subject ? subject.slice(0, MAX_SUBJECT) : null
+}
+
+/** Fold the subject into the question so the device shows what is being approved. */
+export function withCopilotSubject(view: PaneView, capture: string): PaneView {
+ if (!view || view.kind !== 'question') return view
+ const subject = copilotPromptSubject(capture)
+ if (!subject || view.question.includes(subject)) return view
+ return { ...view, question: `${view.question} — ${subject}` }
+}
diff --git a/cli/src/engines/copilot/normalizer.spec.ts b/cli/src/engines/copilot/normalizer.spec.ts
index 9a4c2e98b..16a46a771 100644
--- a/cli/src/engines/copilot/normalizer.spec.ts
+++ b/cli/src/engines/copilot/normalizer.spec.ts
@@ -157,3 +157,46 @@ describe('the session a Copilot process is in', () => {
expect(await copilotSessionForPid(home, 9999)).toBeNull() // another process holds nothing here
})
})
+
+describe('the ask-user dialog', () => {
+ it('maps the tool to the exact shared name', () => {
+ // Anything else and it renders in the tool feed instead of as a question the device can answer.
+ expect(copilotToolName('ask_user')).toBe('AskUserQuestion')
+ })
+
+ it('is read off a real pane once the box is peeled', async () => {
+ const { parseEngineQuestionPane, parseQuestionPane } = await import('../../lib/askQuestion.js')
+ const capture = readFileSync(fileURLToPath(new URL('../../lib/__fixtures__/question-copilot.txt', import.meta.url)), 'utf8')
+ expect(parseQuestionPane(capture)).toBeNull() // the frame defeats the shared parser
+ const view = parseEngineQuestionPane('copilot', capture)
+ expect(view).not.toBeNull()
+ const question = view as Extract<typeof view, { kind: 'question' }>
+ expect(question.question).toBe('Which colour do you prefer?')
+ expect(question.rows.map((r) => r.label)).toEqual(['Red', 'Green', 'Blue'])
+ // "Other (type your answer)" is a free-text row: the device has no text input, so it must not be
+ // offered as a choice.
+ expect(question.typeRow?.label).toContain('Other')
+ })
+})
+
+describe('the permission prompt', () => {
+ const capture = () => readFileSync(fileURLToPath(new URL('../../lib/__fixtures__/permission-copilot.txt', import.meta.url)), 'utf8')
+
+ it('names what is being approved, not just "allow this access?"', async () => {
+ const { parseEngineQuestionPane } = await import('../../lib/askQuestion.js')
+ const view = parseEngineQuestionPane('copilot', capture())
+ const question = view as Extract<typeof view, { kind: 'question' }>
+ expect(question.question).toContain('Do you want to allow this access?')
+ // Row 1 is a bare "Yes": without the subject the device offers a choice nobody can judge.
+ expect(question.question).toContain('https://example.com')
+ })
+
+ it('keeps a way to say NO', async () => {
+ const { parseEngineQuestionPane } = await import('../../lib/askQuestion.js')
+ const view = parseEngineQuestionPane('copilot', capture())
+ const question = view as Extract<typeof view, { kind: 'question' }>
+ // Three ways to approve and none to refuse means the prompt cannot be answered at all.
+ expect(question.rows.some((r) => /^No\b/i.test(r.label))).toBe(true)
+ expect(question.rows).toHaveLength(4)
+ })
+})
diff --git a/cli/src/engines/copilot/normalizer.ts b/cli/src/engines/copilot/normalizer.ts
index 40001f8c5..84a0c396e 100644
--- a/cli/src/engines/copilot/normalizer.ts
+++ b/cli/src/engines/copilot/normalizer.ts
@@ -42,6 +42,9 @@ const TOOL_NAMES: Record<string, string> = {
bash: 'Bash',
create: 'Write',
view: 'Read',
+ // Must be exactly `AskUserQuestion`, or the dialog renders as an ordinary card in the tool feed —
+ // where nobody can answer it. Measured: it drew as "Asked user" from the Title-Case fallback.
+ ask_user: 'AskUserQuestion',
}
export function copilotToolName(name: string): string {
diff --git a/cli/src/lib/__fixtures__/permission-copilot.txt b/cli/src/lib/__fixtures__/permission-copilot.txt
new file mode 100644
index 000000000..dca710354
--- /dev/null
+++ b/cli/src/lib/__fixtures__/permission-copilot.txt
@@ -0,0 +1,50 @@
+  Current   Sessions   Issues   Pull requests   Gists 
+
+ ╭─╮╭─╮
+ ╰─╯╰─╯ Copilot v1.0.80 uses AI.
+ █ ▘▝ █ Check for mistakes.
+ ▔▔▔▔ 
+
+ ● Tip: /skills
+ └ Manage skills for enhanced capabilities
+ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
+  ❯ Fetch ]8;id=md-v03177;https://example.com\https://example.com]8;;\ and tell me the page title. 14:55 
+ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
+ ⌄ Thought for 1s
+ │ The user is asking me to fetch ]8;id=md-v03177;https://example.com\https://example.com]8;;\ and tell them the page title. I should use the web_fetch tool to retrieve the page content.
+ │
+ │ Let me call web_fetch with the URL ]8;id=md-v03177;https://example.com\https://example.com]8;;\.
+
+ ○ Fetching web content ]8;id=md-v03177;https://example.com\https://example.com]8;;\ · url: "]8;id=md-v03177;https://example.com\https://example.com]8;;\" 38s
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
+│ Fetch web content │
+│ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
+│ Copilot is attempting to access the following URL: │
+│ │
+│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
+│ │ https://example.com │ │
+│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
+│ │
+│ Do you want to allow this access? │
+│ │
+│ ❯ 1. Yes  │
+│ 2. Yes, and approve all URLs from "https://example.com" for the rest of the running session │
+│ 3. Yes, and approve all URLs from "https://example.com" permanently │
+│ 4. No, and tell Copilot what to do differently (Esc to stop) │
+│ │
+│ ↑/↓ to navigate · enter to select · esc to cancel │
+╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
diff --git a/cli/src/lib/__fixtures__/question-copilot.txt b/cli/src/lib/__fixtures__/question-copilot.txt
new file mode 100644
index 000000000..93dfd13fb
--- /dev/null
+++ b/cli/src/lib/__fixtures__/question-copilot.txt
@@ -0,0 +1,50 @@
+  Current   Sessions   Issues   Pull requests   Gists 
+
+ ╭─╮╭─╮
+ ╰─╯╰─╯ Copilot v1.0.80 uses AI.
+ █ ▘▝ █ Check for mistakes.
+ ▔▔▔▔ 
+
+ ● Tip: /clear
+ └ Abandon this session and start fresh
+ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
+  ❯ Ask me a multiple-choice question about which colour I prefer: red, green or blue. Use your ask-user tool and wait for my answer. 14:49 
+ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
+ ⌄ Thought for 1s
+ │ The user wants me to ask them a multiple-choice question about their color preference using the ask_user tool. They want to choose between red, green, or blue. I should use the ask_user tool with
+ │ the choices parameter.
+ │
+ │ Let me use the ask_user tool with:
+ │ - question: A simple question asking about their color preference
+ │ - choices: ["Red", "Green", "Blue"]
+
+ ○ Asking user Which colour do you prefer? 37s
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
+│ Question │
+│ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
+│ Which colour do you prefer? │
+│ │
+│ ❯ 1. Red │
+│ 2. Green │
+│ 3. Blue │
+│ 4. Other (type your answer) │
+│ │
+│ ↑/↓ to select · enter to confirm · esc to cancel │
+╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
diff --git a/cli/src/lib/askQuestion.ts b/cli/src/lib/askQuestion.ts
index 4c3542548..5da2d91c7 100644
--- a/cli/src/lib/askQuestion.ts
+++ b/cli/src/lib/askQuestion.ts
@@ -30,6 +30,7 @@ import { parseCursorPermissionPane } from '../engines/cursor/askQuestion.js'
import { parseDevinPermissionPane, parseDevinQuestionPane } from '../engines/devin/askQuestion.js'
import { parseGrokQuestionPane } from '../engines/grok/askQuestion.js'
import { parseAgyQuestionPane } from '../engines/agy/askQuestion.js'
+import { withCopilotSubject } from '../engines/copilot/askQuestion.js'
/** Device-facing question shape — byte-for-byte the hosted runtime’s `commanderQuestions()` output. */
export interface ShapedQuestion {
@@ -150,8 +151,14 @@ export function parseEngineQuestionPane(engine: AgentEngine, capture: string): P
// shared parser cannot see. Its PERMISSION prompt is numbered rows under `Do you want to proceed?`
// and the shared parser reads that one exactly, so it falls through.
if (engine === 'agy') return parseAgyQuestionPane(capture) ?? parseQuestionPane(capture)
- // Hermes and OpenCode paint Claude's dialog inside a box; peel the border and the shared parser fits.
+ // Hermes, OpenCode and Copilot paint the dialog inside a box; peel the border and the shared parser
+ // fits. Measured on Copilot: framed it returns null, unframed it reads the question, the three
+ // options AND spots `4. Other (type your answer)` as the free-text row rather than an option.
if (engine === 'hermes') return parseQuestionPane(unframe(capture))
+ // Copilot boxes its dialog the same way, but names the SUBJECT of a permission prompt above the
+ // question — "attempting to access the following URL:" over a boxed value. Without it the device
+ // shows "Do you want to allow this access?" and a bare "Yes", with nothing to judge.
+ if (engine === 'copilot') return withCopilotSubject(parseQuestionPane(unframe(capture)), capture)
if (engine === 'opencode') {
// OpenCode's PERMISSION prompt is the horizontal one kilo inherited from it — same `△ Permission
// required` title, same `⇆ select · enter confirm` footer, same unnumbered rows. Measured: the live