Repository navigation
Description
Describe the bug
This report was drafted by an AI assistant (GitHub Copilot) from session logs and a reproduction on my machine, at my request; the reproduction below was run as written.
When the built-in security-review agent (run through the task tool) completes, the runtime adds a persistent instruction to the main agent's context (instruction.update, name: "security-review-reporting", authority: "runtime", lifetime: "persistent", boundary: "afterToolResults"). It says, abridged:
After the security review task completes, you MUST present the findings as a summary table using this exact format … Then, if any issues were found, use the ask_user tool (if available) to offer follow-up actions with these choices: "Fix highest severity issues" … "Fix all issues" … "Commit a summary of findings" … If the ask_user tool is not available, present the follow-up options as a numbered list and ask the user to reply with their choice.
It is injected regardless of the run's mode and instructions. The instruction appeared after all five security-review completions I observed (three in an earlier VS Code session, one in each of two CLI runs), including:
- in non-interactive
-pruns (also with--no-ask-user); - when the prompt explicitly forbade questions and follow-up offers.
Impact, seen in a long-running unattended session in VS Code's agent host (same runtime, 1.0.108-0), whose instructions forbade ask_user:
- after its second security-review subagent, and after delivering its findings, the agent called
ask_userwith exactly these three choices, prefaced "As requested, choose an optional follow-up". It treated the injected text as the user's request. - The
ask_usercall remained pending for about 25 hours before a response was recorded. - The offered choices ("Fix all issues", "Commit a summary…") would also have authorized code changes and commits in a task that was explicitly review-only.
Affected version
GitHub Copilot CLI 1.0.112 (latest), and the runtime 1.0.108-0 embedded in VS Code 1.146.0.
Steps to reproduce the behavior
-
In an empty git repo, add
app.js:const http = require('http'); const { exec } = require('child_process'); http.createServer((req, res) => { const host = new URL(req.url, 'http://localhost').searchParams.get('host'); exec('ping -c 1 ' + host, (err, out) => res.end(out)); }).listen(8080);
-
Run:
copilot -p "Use the security-review agent to review app.js. This is an unattended batch job: no human will read or answer questions. Do not ask any questions and do not offer follow-up actions. Print the findings, then the word DONE, and stop." \ --no-ask-user --no-custom-instructions --allow-all-tools --allow-all-paths -
Open the session's
~/.copilot/session-state/<session-id>/events.jsonl. Right aftersubagent.completedwithagentName: "security-review"(the matchingsubagent.startedhasagentType: "security-review"):instruction.update {"authority":"runtime","lifetime":"persistent","boundary":"afterToolResults","name":"security-review-reporting", ...}with the text quoted above.
In both short runs the model kept the prompt's "no follow-ups" (with the default model and with --model gpt-6.1-sol), but it switched to the injected table format. The earlier, long VS Code session did ask, as described above. I have not isolated why the outcomes differed (model, context length, host, runtime version or chance); the injection itself happened every time I looked.
Expected behavior
-pis non-interactive, so nobody can answer a follow-up question there.--no-ask-userdisables the question form but still allows questions in replies. In a non-interactive run, or when the user explicitly forbids questions and follow-ups, the runtime should not inject an instruction to ask for a follow-up choice.- Runtime-injected reporting hints should not override the user's prompt or custom instructions. At least, they should not be phrased as a "MUST", and they should say they are a default that the user's instructions take precedence over.
- Ideally, a way to turn the follow-up offer off (a setting or flag), and no offer to "Fix all issues" in a session the user told to change nothing.
Additional context
- macOS 27.2.1, arm64, zsh; the
-prun was started from a script, not an interactive terminal. - Related, though about other features: Autopilot task-completion enforcement can override explicit user instructions #4318 (autopilot task-completion enforcement overriding explicit user instructions), Instructions are ignored #1088 (instructions ignored).
Activity