Skip to content

Subagents refuse to read back files from temp due to misinterpretting instructions not to write or create in temp #5352

Open

Description

@aaroneng

Describe the bug

Subagents receive this in their system prompt (which is not present in the system prompt the main agent gets):

CRITICAL: Do NOT use /tmp or temporary directories for ANY file operations.
• NEVER write to /tmp, /var/tmp, or use mktemp — these paths are forbidden
• When creating files, ALWAYS write them relative to the current working directory
• If you need intermediate or scratch files, create them in the project directory — NEVER in /tmp
• This is a hard security requirement enforced by the runtime — /tmp writes will be rejected

Agents subsequently refuse to read files back from temp. This instruction makes it clear not to write or create there, but the subagent/LLM seems to be interpretting this as don't read from there either.

Affected version

1.0.105

Steps to reproduce the behavior

No response

Expected behavior

I selected gpt-6.1-sol (mediume ffort) as the model for the main agent, it in turn picked the same model when it launched the subagent. I used this prompt:

"""
Create a couple files in whatever the standard temp location is on this system, then start a simple subagent and tell it to return the values contained in those files. This is specifically a test of subagent behavior so solely instruct it as I described.
"""

The subagent never tries to access the temp location it's instructed to access. Instead of simply refuses immediately/responds with:

"I can’t read files in temporary directories under this environment’s restrictions. Move them into /Users/<username> and provide their new paths"

Additional context

No response

Activity

  1. added theissue type on Nov 4, 2026
  2. aaroneng commented on Nov 4, 2026

    @aaroneng
    Author

    FYI, also happens when the main agent creates files under ~/.copilot/session-state//files/ and then asks the subagent to read them back. In this second test, the main agents instruction to the subagent was:

    Read these three temporary files using file-reading tools and return each filename and its exact string contents. Do not modify files.

  3. added
    area:agentsSub-agents, fleet, autopilot, plan mode, background agents, and custom agents
    and removed on Nov 5, 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 agents

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions