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
- 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.
- Apply the inverse transform in
toRulesyncSubagent() to strip .agent.md back to .md so the rulesync representation remains tool-agnostic.
- Add the test cases listed above to
src/features/subagents/copilot-subagent.test.ts.
- Verify with
pnpm cicheck.
Related PR: #1480
Background
PR #1480 (#1480) fixed Copilot subagent output to use the
.agent.mdextension required bymicrosoft/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
fromFileandtoRulesyncSubagentCopilotSubagent.fromRulesyncSubagentnow rewrites.md->.agent.mdwhen 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 existingplanner.agent.mdback into rulesync, the Copilot-specific.agent.mdsuffix leaks into the tool-agnosticRulesyncSubagentrepresentation.src/features/subagents/copilot-subagent.ts.mdpath; the.agent.mdsuffix should only be reapplied when converting back to Copilot output.#2 Missing test coverage for the new transformation
src/features/subagents/copilot-subagent.test.tsdoes not assert the new path-rewriting behavior. We need explicit tests for:.mdsource ->.agent.mdoutput.agent.mdsource -> unchanged (idempotency).mdextensionsSolution / Next Steps
toCopilotAgentFilePath) insrc/features/subagents/copilot-subagent.tsthat encapsulates the suffix rule, so it can be unit-tested and reused for the inverse transform.toRulesyncSubagent()to strip.agent.mdback to.mdso the rulesync representation remains tool-agnostic.src/features/subagents/copilot-subagent.test.ts.pnpm cicheck.Related PR: #1480