Skip to content

Title: view refuses files whose path is longer than 256 characters in non-interactive runs ("Permission denied and could not request permission from user") #5095

Description

@ericwangffff

Describe the bug

Environment

  • Copilot CLI 1.0.86-0, 1.0.89-3 and 1.0.89 on Windows 11. Windows long paths
    are enabled (LongPathsEnabled = 1).
  • Non-interactive child process, roughly:
    copilot -C --no-ask-user --no-custom-instructions --disable-builtin-mcps
    --available-tools=view,rg,glob --deny-tool=write --deny-tool=shell
    --output-format=json (prompt supplied non-interactively)

Steps to reproduce

  1. Create a directory D. Inside it, create file F whose full path is 257 or more
    characters, and file G whose full path is 256 characters or fewer.
  2. Run the CLI non-interactively with -C D --no-ask-user and ask it to view F and G.

Actual

  • view of G succeeds.
  • view of F fails with: "Permission denied and could not request permission from user".
  • rg over D still returns matching lines from F, so the file itself is readable.

Expected

  • F is inside the allowed working directory, so view should succeed.
  • If there is a path-length limit, the error should say so, rather than report
    a permission problem.

Evidence (production runs, 2026-09-23 to 2026-10-06)

  • 227 view calls across 7 sessions. All 218 successful reads had paths of 256
    characters or fewer. All 7 denied reads of real files inside the -C directory
    had paths of 257-264 characters.
  • The same files were denied consistently across sessions.
  • Windows long paths are enabled, so the operating system is not the cause.

Impact

  • In unattended runs the agent cannot ask for permission, so it silently
    continues without the file. The error message points to permissions, not
    path length, which makes the cause hard to find.

Note

  • These observations come from real unattended runs; I have not yet run a
    controlled minimal repro. Not checked: whether an interactive session
    prompts instead of denying, and whether glob is affected.

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions