Skip to content

Follow-up for PR #1480: Copilot subagent .agent.md round-trip and test coverage #1486

@dyoshikawa

Description

@dyoshikawa

Background

PR #1480 (#1480) fixed Copilot subagent output to use the .agent.md extension required by microsoft/vscode-copilot-chat. During review, two mid-severity issues were identified that were not addressed before merge. This scrap issue tracks that follow-up work.

Details

#1 Round-trip inconsistency between fromFile and toRulesyncSubagent

CopilotSubagent.fromRulesyncSubagent now rewrites .md -> .agent.md when generating Copilot output. However, toRulesyncSubagent() propagates the on-disk relative file path verbatim back into the rulesync layer. As a result, when a user imports an existing planner.agent.md back into rulesync, the Copilot-specific .agent.md suffix leaks into the tool-agnostic RulesyncSubagent representation.

  • File: src/features/subagents/copilot-subagent.ts
  • Expected: the rulesync-layer representation should carry a neutral .md path; the .agent.md suffix should only be reapplied when converting back to Copilot output.

#2 Missing test coverage for the new transformation

src/features/subagents/copilot-subagent.test.ts does not assert the new path-rewriting behavior. We need explicit tests for:

  • .md source -> .agent.md output
  • .agent.md source -> unchanged (idempotency)
  • Edge cases such as no extension or non-.md extensions

Solution / Next Steps

  1. Extract a small helper (e.g. toCopilotAgentFilePath) in src/features/subagents/copilot-subagent.ts that encapsulates the suffix rule, so it can be unit-tested and reused for the inverse transform.
  2. Apply the inverse transform in toRulesyncSubagent() to strip .agent.md back to .md so the rulesync representation remains tool-agnostic.
  3. Add the test cases listed above to src/features/subagents/copilot-subagent.test.ts.
  4. Verify with pnpm cicheck.

Related PR: #1480

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions