Summary
gh aw fix modifies repository files even when run without --write, despite its documented dry-run contract: “Without --write (dry-run mode), no files are modified.”
The command rewrites .github/agents/agentic-workflows.md and can rewrite .github/skills/agentic-workflows/SKILL.md whenever those files differ from the bundled/current dispatcher templates.
Confirmed with stable v0.82.14, v0.82.15 prerelease, and current public main.
Minimal reproduction
In a throwaway repository:
git init
gh aw init
printf '\n<!-- preserve-this-local-change -->\n' >> .github/agents/agentic-workflows.md
git add . && git commit -m baseline
gh aw fix --verbose
git diff --exit-code
gh aw fix reports that it updated the custom agent and git diff shows the file was overwritten, despite no --write flag.
Expected behavior
Dry-run mode reports what would change but does not modify any file.
Actual behavior
The dispatcher agent and skill are written immediately when their content differs from the generated templates.
Root cause
pkg/cli/fix_command.go correctly passes the write flag to workflow codemods, but runFixCommand later calls these functions unconditionally:
ensureAgenticWorkflowsDispatcher(verbose, false)
ensureAgenticWorkflowsAgent(verbose)
Both functions write files through os.WriteFile when content differs and do not receive the dry-run flag.
TestFixCommand_UpdatesPromptAndAgentFiles currently uses Write: false while asserting that files are created or overwritten, so the test codifies behavior that conflicts with the CLI help.
Agentic implementation plan
- Pass the write/dry-run state into dispatcher artifact refresh.
- When
write == false, compare content without writing and report Would update ... when a difference exists.
- When
write == true, preserve the current update behavior.
- Split or update
TestFixCommand_UpdatesPromptAndAgentFiles to cover both modes:
- dry-run leaves existing files byte-for-byte unchanged;
--write updates the agent and skill.
- Update
gh aw fix --help to explicitly list dispatcher agent/skill refresh among write-mode actions.
This preserves useful drift reporting while honoring the documented no-write guarantee.
Summary
gh aw fixmodifies repository files even when run without--write, despite its documented dry-run contract: “Without--write(dry-run mode), no files are modified.”The command rewrites
.github/agents/agentic-workflows.mdand can rewrite.github/skills/agentic-workflows/SKILL.mdwhenever those files differ from the bundled/current dispatcher templates.Confirmed with stable v0.82.14, v0.82.15 prerelease, and current public main.
Minimal reproduction
In a throwaway repository:
gh aw fixreports that it updated the custom agent andgit diffshows the file was overwritten, despite no--writeflag.Expected behavior
Dry-run mode reports what would change but does not modify any file.
Actual behavior
The dispatcher agent and skill are written immediately when their content differs from the generated templates.
Root cause
pkg/cli/fix_command.gocorrectly passes thewriteflag to workflow codemods, butrunFixCommandlater calls these functions unconditionally:Both functions write files through
os.WriteFilewhen content differs and do not receive the dry-run flag.TestFixCommand_UpdatesPromptAndAgentFilescurrently usesWrite: falsewhile asserting that files are created or overwritten, so the test codifies behavior that conflicts with the CLI help.Agentic implementation plan
write == false, compare content without writing and reportWould update ...when a difference exists.write == true, preserve the current update behavior.TestFixCommand_UpdatesPromptAndAgentFilesto cover both modes:--writeupdates the agent and skill.gh aw fix --helpto explicitly list dispatcher agent/skill refresh among write-mode actions.This preserves useful drift reporting while honoring the documented no-write guarantee.