Skip to content

Fix agent identifier extraction for .agent.md and .agent files#5790

Merged
pelikhan merged 5 commits intomainfrom
copilot/fix-speckit-dispatcher-agent
Dec 7, 2025
Merged

Fix agent identifier extraction for .agent.md and .agent files#5790
pelikhan merged 5 commits intomainfrom
copilot/fix-speckit-dispatcher-agent

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

Custom agent files using .agent.md extension were generating incorrect agent identifiers. speckit-dispatcher.agent.md became speckit-dispatcher.agent instead of speckit-dispatcher, causing Copilot CLI to fail with "No such agent" errors.

Changes

  • pkg/workflow/engine_helpers.go: Modified ExtractAgentIdentifier to strip .agent.md, .md, and .agent suffixes in order
  • pkg/workflow/engine_helpers_test.go: Added test coverage for .agent.md and .agent filename patterns
  • Workflow recompilation: Updated compiled workflows to use correct agent identifiers

Example

// Before
ExtractAgentIdentifier(".github/agents/speckit-dispatcher.agent.md")
// Returns: "speckit-dispatcher.agent" ❌

// After
ExtractAgentIdentifier(".github/agents/speckit-dispatcher.agent.md")
// Returns: "speckit-dispatcher" ✅

ExtractAgentIdentifier(".github/agents/my-agent.agent")
// Returns: "my-agent" ✅

The fix maintains backward compatibility with existing .md agent files while properly handling the .agent.md naming convention used by custom agents, and also supports .agent extension for edge cases.

[!WARNING]

Original prompt

Fix agent

No such agent: speckit-dispatcher.agent, available: create-agentic-workflow, create-shared-agentic-workflow, debug-agentic-workflow, interactive-agent-designer, speckit-dispatcher, technical-doc-writer


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@pelikhan
Copy link
Contributor

pelikhan commented Dec 7, 2025

@copilot trim .agent from agent name

Copilot AI and others added 3 commits December 7, 2025 21:19
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Update ExtractAgentIdentifier to strip both .agent.md and .md extensions.
This fixes the issue where custom agent files like "speckit-dispatcher.agent.md"
were being converted to "speckit-dispatcher.agent" instead of "speckit-dispatcher"
when passed to Copilot CLI's --agent flag.

- Updated ExtractAgentIdentifier to try .agent.md first, then .md
- Added 4 test cases for .agent.md filename pattern
- All tests pass including agent import tests
- Manually verified speckit-dispatcher workflow compiles correctly

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Recompiled all workflows to apply the agent identifier fix.
Agent identifiers in compiled workflows now correctly use:
- speckit-dispatcher (was speckit-dispatcher.agent)
- technical-doc-writer (was technical-doc-writer.agent)

All tests pass and make agent-finish completes successfully.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing agent in speckit-dispatcher Fix agent identifier extraction for .agent.md files Dec 7, 2025
Copilot AI requested a review from pelikhan December 7, 2025 21:36
Extended ExtractAgentIdentifier to also trim .agent extension (without .md).
This makes the function more robust and handles edge cases where agent files
might use .agent extension alone.

- Added trimming of .agent suffix after .agent.md and .md
- Added 2 test cases for .agent extension handling
- All tests pass including agent import tests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 7, 2025

@copilot trim .agent from agent name

Added support for trimming .agent extension in commit 478a252. The function now strips .agent.md, .md, and .agent suffixes to handle all naming conventions.

Copilot AI changed the title Fix agent identifier extraction for .agent.md files Fix agent identifier extraction for .agent.md and .agent files Dec 7, 2025
@pelikhan pelikhan marked this pull request as ready for review December 7, 2025 21:52
@pelikhan pelikhan merged commit 00974cb into main Dec 7, 2025
5 checks passed
@pelikhan pelikhan deleted the copilot/fix-speckit-dispatcher-agent branch December 7, 2025 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants