Advanced
Open
Pro
An Agent That Cleaned Up a Little Too Well
An agent was asked to "clean up the feature branch before opening a
PR." It ran git reset --hard origin/main to remove some stray local
commits it considered clutter, then force-pushed the branch. Two of
the commits it discarded contained a teammate's in-progress fix that
had never been pushed anywhere else.
- Identify specifically which part of the agent's action sequence made this unrecoverable, versus which part alone would have been merely risky but reversible.
- Propose a policy for how agentic git workflows should treat
destructive operations like
reset --hardand force-push, and explain why "just tell the agent to be careful" in the prompt isn't a sufficient control. - This agent was also the sole writer in its working directory (no parallel agents involved). Does git-worktree isolation, as discussed for concurrent writers, do anything to prevent this specific failure? Why or why not?
Share this question