Skip to content

Python: GitHubCopilotAgent session behavior varies with the working directory #7516

Description

@giles17

Describe the bug

GitHubCopilotAgent session behavior depends on which working directory the agent happens to run in.

The Copilot CLI supports file hooks defined in a checkout's .github/hooks/, controlled by the SDK enable_file_hooks session option. The agent never sets that option, so it inherits the runtime default and the surrounding checkout can change how a session behaves.

This makes runs harder to reason about and reproduce: the same agent, the same options, and the same prompt can behave differently depending only on the directory the process started in. It also sits outside the options the agent gives an explicit default (today just on_permission_request), so there is no single place a caller can see or control it.

Expected behavior

A session should behave the same way regardless of the working directory, unless the caller opts in. enable_file_hooks should have an explicit default of False in _build_session_kwargs, be surfaced as a documented GitHubCopilotOptions key, and remain settable through default_options or per-run options for callers that do want checkout-driven hooks.

Options that only shape prompt context, such as enable_host_git_operations, should be left alone.

Platform

  • Language: Python
  • Package: agent-framework-github-copilot

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonUsage: [Issues, PRs], Target: Python

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions