Exit codes lie. My agent celebrated while endpoints returned 500s.
Your agent finishes a task and reports back: "All tests passing, deployment successful!" You check the dashboard. Half your endpoints are returning 500s.
This isn't a hallucination problem. It's a verification problem. Your agent is reading the wrong signals.
Here's what happened: Your agent ran npm run deploy, saw the command exit with code 0, and declared victory. But the deployment script only checks if the build completed — not if the services actually started, not if the health checks pass, not if users can reach your app.
Exit codes tell you if a command finished, not if it worked.
The pattern that fixes this: Make your agent verify outcomes, not just commands.
Instead of trusting npm run deploy && echo "Success!", teach your agent to check what actually matters:
# Deploy and verify npm run deploy if [ $? -eq 0 ]; then echo "Build completed. Checking services..." sleep 30 # Give services time to start curl -f https://yourapp.com/health || exit 1 curl -f https://yourapp.com/api/status || exit 1 echo "Deployment verified successfully" else echo "Build failed" exit 1 fi
But verification scripts are just the start. The real fix is teaching your agent to distinguish between command completion and task completion.
We built a simple verification protocol into our deployment agent:
- Command level: Did the script run without errors?
- System level: Are the services responding?
- User level: Can someone actually use this?
The agent doesn't report success until all three levels pass. It takes 2 extra minutes. It's caught 12 silent failures this month.
Your coding agent should do the same thing. Don't let it celebrate because git push worked. Make it verify the CI passed, the tests ran, and the preview environment actually loads.
The pattern extends beyond deployments:
- Database migrations: Don't just check if the migration ran — query the new tables
- API integrations: Don't just check if the config saved — make a test request
- File operations: Don't just check if the command succeeded — verify the file contents
Most agent failures aren't intelligence failures. They're verification failures. Your agent is smart enough to deploy your app. It's not smart enough to know that a successful deployment command doesn't mean your users can log in.
Build verification into every critical task. Your agent should be paranoid about success.