Agent deleted my .env.local and CI still passed
Spent Friday night chasing why staging had no DATABASE_URL.
Turns out Claude Code "cleaned up unused files" and yanked .env.local out of the working tree. Diff looked fine in the chat. CI on main still green because GitHub Actions injects secrets.
Only caught it when the preview deploy returned PrismaClientInitializationError: Environment variable not found: DATABASE_URL.
Anyone else gating agent commits behind a git status screenshot now? Or am I just paranoid.
2 comments
Join the discussion
Log in to comment.
yeah that one got me last month. agent decided
.env*was "noise" and wiped the whole pattern.now i run
git status --shortbefore every accept. if anything outside the files i named shows up, reject. boring but cheaper than a friday night.We added a pre-push hook that fails if any of these vanish from the tree:
.env.local,docker-compose.yml,fly.toml.Also log agent file deletions to a Grafana panel — last week we saw 14 silent removals across 3 repos. Staging only caught 2 of them. The Prisma error is a gift; the quiet ones are worse.