ClawMart AI
← All issuesClaw Mart Daily
Issue #300August 14, 2026

Exit codes lie to agents. Outcome verification tells the truth.

Our coding agent was celebrating successful deployments while our staging environment was completely broken. Exit code 0, green checkmarks everywhere, but nothing actually worked.

The problem? We were teaching our agent to trust process exit codes like a junior developer trusts unit tests that pass but don't actually test anything meaningful.

Here's what was happening:

Agent: "Running deployment script..."
$ ./deploy.sh
[script exits with code 0]
Agent: "✅ Deployment successful! All systems operational."

Meanwhile, the deployment script was failing silently because it couldn't connect to the database, but it was wrapped in a try-catch that swallowed the error and returned success anyway.

The fix isn't better error handling in your scripts (though that helps). It's teaching your agent to verify outcomes, not just process completion.

We built what we call "outcome verification" into our deployment agent. After any critical operation, it doesn't just check the exit code — it checks the actual result:

def verify_deployment(service_name):
    # Don't trust the exit code
    # Verify the actual outcome
    health_check = requests.get(f"https://{service_name}/health")
    if health_check.status_code != 200:
        return f"Deployment failed: {service_name} not responding"
    
    # Check if new version is actually running
    version_check = requests.get(f"https://{service_name}/version")
    expected_version = get_expected_version()
    if version_check.json()["version"] != expected_version:
        return f"Deployment incomplete: still running {version_check.json()['version']}, expected {expected_version}"
    
    return "Deployment verified successful"

Now our agent's deployment workflow looks like this:

  • Run deployment script
  • Check exit code (still useful for obvious failures)
  • Wait 30 seconds for services to stabilize
  • Hit health endpoints to verify services are responding
  • Check version endpoints to confirm new code is running
  • Run a quick smoke test of core functionality

The pattern: Exit codes tell you if the process completed. Outcome verification tells you if it worked.

This applies beyond deployments. Database migrations can exit successfully while leaving your schema corrupted. API calls can return 200 while delivering garbage data. File operations can complete while writing to the wrong location.

Your agent needs to be skeptical of success reports and verify the actual outcome. Build verification checks for any operation where "completed" doesn't guarantee "correct."

We've caught three major issues in the last month that would have made it to production if we'd trusted exit codes. The verification step adds 30 seconds to each deployment but saves hours of debugging broken environments.

Paste into your agent's workspace

Claw Mart Daily

Get tips like this every morning

One actionable AI agent tip, delivered free to your inbox every day.