Remove prompt file management functions from init/upgrade/fix commands#14150
Remove prompt file management functions from init/upgrade/fix commands#14150
Conversation
…x commands - Remove ensureCopilotInstructions calls from init.go, upgrade_command.go, and fix_command.go - Update documentation in init_command.go and upgrade_command.go - Update ensureCopilotInstructions documentation to clarify it only checks file existence - Remove test code that tried to create agent files Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…command Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot remove embedded resource from go code in pkg/cli, remove copy from pkg/cli/... |
Per feedback, removed all ensure* functions that only checked for prompt file existence: - Removed ensureCopilotInstructions and related cleanup functions - Removed ensureCreateWorkflowPrompt, ensureUpdateWorkflowPrompt, etc. - Removed ensurePromptFileExists helper function - Removed test files for deleted functions - Kept only essential functions: ensureAgenticWorkflowsDispatcher, deleteSetupAgenticWorkflowsAgent, deleteOldTemplateFiles, deleteOldAgentFiles, cleanupOldPromptFile The init/upgrade/fix commands now only create the dispatcher agent and run cleanup functions. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Removed all unused prompt file check functions from pkg/cli (commit e299d95):
The copilot-agents.go file reduced from 348 to 224 lines. Init command output is now cleaner with no misleading "Writing/Created" messages for files that aren't actually created. |
There was a problem hiding this comment.
Pull request overview
Removes CLI-side management of workflow prompt files so prompt content remains source-controlled in the gh-aw repo and agents resolve prompts directly from GitHub, while keeping only the dispatcher agent creation and cleanup behaviors in CLI commands.
Changes:
- Removed prompt/instructions management helpers and their invocations from
init,upgrade, andfix. - Deleted tests that covered the removed prompt/instructions helper functions.
- Updated CLI help text and docs to reflect the new direction (though some help text still overstates verification/updating of prompts).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/init.go | Removes writing/updating of prompt/instructions files during init; keeps dispatcher agent creation and cleanup. |
| pkg/cli/init_command.go | Updates init command help text (currently claims prompt verification). |
| pkg/cli/upgrade_command.go | Removes prompt/instructions update steps from upgrade; retains dispatcher update + setup steps upgrade (help text still references prompts). |
| pkg/cli/upgrade_command_test.go | Removes test setup that invoked removed instructions helper. |
| pkg/cli/fix_command.go | Removes prompt/instructions update steps from fix; retains dispatcher update + cleanup codemods (log text still mentions prompts). |
| pkg/cli/copilot-agents.go | Deletes prompt/instructions ensure/check functions; keeps dispatcher ensure + cleanup helpers. |
| pkg/cli/copilot_instructions_test.go (deleted) | Removes tests for removed Copilot instructions helper. |
| pkg/cli/agentic_workflow_agent_test.go (deleted) | Removes tests for removed prompt-file helpers. |
| pkg/cli/upgrade_agentic_workflow_agent_test.go (deleted) | Removes tests for removed upgrade prompt helper. |
| docs/src/content/docs/agent-factory-status.mdx | Adds the Daily MCP Tool Concurrency Analysis workflow to the status table. |
Comments suppressed due to low confidence (2)
pkg/cli/upgrade_command.go:264
- The comment for updateAgentFiles says it "updates all agent and prompt files", but the function now only updates the dispatcher agent (and upgrades copilot-setup-steps). Please update the comment to reflect the narrower scope so future changes don’t assume prompts are handled here.
// updateAgentFiles updates all agent and prompt files to the latest templates
func updateAgentFiles(verbose bool) error {
// Update dispatcher agent
if err := ensureAgenticWorkflowsDispatcher(verbose, false); err != nil {
upgradeLog.Printf("Failed to update dispatcher agent: %v", err)
return fmt.Errorf("failed to update dispatcher agent: %w", err)
}
pkg/cli/copilot-agents.go:22
- ensureAgenticWorkflowsDispatcher still accepts a skipInstructions flag, but all current call sites pass false and the rest of the prompt/instructions management helpers were removed. If this flag is no longer part of any user-facing behavior, consider removing it (and the early return) to simplify the API and reduce confusion about what "instructions" means here.
// ensureAgenticWorkflowsDispatcher ensures that .github/agents/agentic-workflows.agent.md contains the dispatcher agent
func ensureAgenticWorkflowsDispatcher(verbose bool, skipInstructions bool) error {
copilotAgentsLog.Print("Ensuring agentic workflows dispatcher agent")
if skipInstructions {
copilotAgentsLog.Print("Skipping agent creation: instructions disabled")
return nil
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| This command: | ||
| 1. Updates all agent and prompt files to the latest templates (like 'init' command) | ||
| 2. Applies automatic codemods to fix deprecated fields in all workflows (like 'fix --write') | ||
| 3. Updates GitHub Actions versions in .github/aw/actions-lock.json (unless --no-actions is set) | ||
| 4. Compiles all workflows to generate lock files (like 'compile' command) | ||
|
|
||
| The upgrade process ensures: | ||
| - GitHub Copilot instructions are up-to-date (.github/aw/github-agentic-workflows.md) | ||
| - Dispatcher agent is current (.github/agents/agentic-workflows.agent.md) | ||
| - All workflow prompts are updated (create, update, debug, upgrade) | ||
| - All workflow prompts exist in .github/aw/ (create, update, debug, upgrade) | ||
| - All workflows use the latest syntax and configuration options |
There was a problem hiding this comment.
The upgrade command help text claims it updates "agent and prompt files" and that the upgrade process ensures workflow prompts exist in .github/aw/, but the upgrade implementation now only updates the dispatcher agent (and copilot-setup-steps). This mismatch can confuse users; adjust the command description/bullets to match the actual behavior (or reintroduce the verification/update logic if it’s still intended).
| // Update prompt and agent files (similar to init command) | ||
| // This ensures the latest templates are always used | ||
| fixLog.Print("Updating prompt and agent files") | ||
|
|
There was a problem hiding this comment.
This log message (and the surrounding comment) still says "Updating prompt and agent files", but the fix command no longer updates prompt files. Consider updating the message to avoid implying prompt management that no longer happens.
See below for a potential fix:
// Update agent workflow files (similar to init command)
// This ensures the latest agent templates are always used
fixLog.Print("Updating agent workflow files")
| - Verifies workflow prompt files exist in .github/aw/ (create-agentic-workflow.md, update-agentic-workflow.md, etc.) | ||
| - Removes old prompt files from .github/prompts/ if they exist |
There was a problem hiding this comment.
The init command help text says it "Verifies workflow prompt files exist in .github/aw/", but the init implementation no longer checks for these prompt files (it only writes the dispatcher agent and performs cleanup). This is misleading for users; either add an explicit verification step (if still desired) or update the help text to reflect that prompt files are not managed/verified by the CLI and are resolved from GitHub by agents.
| - Verifies workflow prompt files exist in .github/aw/ (create-agentic-workflow.md, update-agentic-workflow.md, etc.) | |
| - Removes old prompt files from .github/prompts/ if they exist | |
| - Relies on agents to resolve workflow prompt content from GitHub (no local .github/aw/ prompt verification) |
The prompt files (including
github-agentic-workflows.md) should exist only in the gh-aw repository itself, not be managed by CLI commands. Agents resolve them from GitHub directly.Changes
ensureCopilotInstructions(),ensureCreateWorkflowPrompt(),ensureUpdateWorkflowPrompt(),ensureCreateSharedAgenticWorkflowPrompt(),ensureDebugWorkflowPrompt(),ensureUpgradeAgenticWorkflowsPrompt(),ensureSerenaTool(), andensurePromptFileExists()functions fromcopilot-agents.goinit.go,upgrade_command.go, andfix_command.gocopilot_instructions_test.go,agentic_workflow_agent_test.go, andupgrade_agentic_workflow_agent_test.gofor removed functionsensureAgenticWorkflowsDispatcher()(creates dispatcher agent),deleteSetupAgenticWorkflowsAgent(),deleteOldTemplateFiles(),deleteOldAgentFiles(), andcleanupOldPromptFile()for cleanup operationsBehavior
Before: Init command attempted to check for multiple prompt files and logged misleading "Writing/Created" messages for files that weren't actually created
After: Init command only creates dispatcher agent at
.github/agents/agentic-workflows.agent.mdand runs cleanup functionsImpact
copilot-agents.gofrom 348 to 224 lines (35% reduction)The prompt files remain in the gh-aw repository at
.github/aw/and the compiler continues to reference the GitHub URL.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.