Skip to content

Security-review follow-up instructions are injected in non-interactive runs despite an explicit no-follow-ups prompt #5471

Backlog

Description

@giladben-dor-alt

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 -p runs (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_user with exactly these three choices, prefaced "As requested, choose an optional follow-up". It treated the injected text as the user's request.
  • The ask_user call 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

  1. 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);
  2. 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
  3. Open the session's ~/.copilot/session-state/<session-id>/events.jsonl. Right after subagent.completed with agentName: "security-review" (the matching subagent.started has agentType: "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

  • -p is non-interactive, so nobody can answer a follow-up question there. --no-ask-user disables 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

Activity

  1. added
    area:agentsSub-agents, fleet, autopilot, plan mode, background agents, and custom agents
    area:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automation
    and removed on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsSub-agents, fleet, autopilot, plan mode, background agents, and custom agentsarea:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automation

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions