Skip to content

--config-dir silently ignores agent files instead of loading them #2281

@cephalin

Description

@cephalin

Behavior

When using --config-dir to point to a directory containing agent files, the CLI finds the agent (no "No such agent" error) but silently ignores the agent's instructions. The agent's system prompt is not applied.

Steps to reproduce

# 1. Create agent in a custom config dir
mkdir -p /tmp/copilot-test/.github/agents
cat > /tmp/copilot-test/.github/agents/dummy-test.agent.md << 'EOF'
---
description: A dummy test agent
---
You are a dummy test agent. Reply with ONLY: DUMMY_AGENT_OK
EOF

# 2. Run with --config-dir (from a workspace with no agents)
cd /some/empty/workspace
copilot --yolo --config-dir /tmp/copilot-test --agent dummy-test -p "hello"
# Result: "Hello! How can I help?" — agent instructions NOT applied, no error

# 3. Compare: nonexistent agent correctly errors
copilot --yolo --agent nonexistent-xyz -p "hello"
# Result: "No such agent: nonexistent-xyz, available: "

# 4. Compare: same agent in ~/.copilot/agents/ works correctly
mkdir -p ~/.copilot/agents
cp /tmp/copilot-test/.github/agents/dummy-test.agent.md ~/.copilot/agents/
copilot --yolo --agent dummy-test -p "hello"
# Result: "DUMMY_AGENT_OK" — agent instructions applied correctly

Expected behavior

Either:

  1. --config-dir should include <config-dir>/.github/agents/ (or <config-dir>/agents/) as an agent discovery path AND load the instructions, or
  2. If --config-dir is not intended for agent discovery, the CLI should return "No such agent" instead of silently running without the agent's instructions.

Environment

  • copilot CLI installed via Homebrew (/opt/homebrew/bin/copilot)
  • macOS
  • March 2026

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions