Opus repeatedly ships broken code to production without local verification

Resolved 💬 1 comment Opened Apr 22, 2026 by tkowalczyk Closed May 28, 2026

Problem

During a session where I asked Claude Code (Opus) to add a simple "Trigger Now" button that calls between two Cloudflare Workers in a monorepo, the agent pushed 6 consecutive broken commits to staging without once testing locally.

What happened

The task: add a button in user-application (TanStack Start on CF Workers) that triggers an endpoint on data-service (Hono on CF Workers). Both are on the same domain via Cloudflare routing.

Claude attempted the following approaches, each deployed to stage and failing in production:

  1. Service binding via import { env } from "cloudflare:workers" — env not available in TanStack Start server functions
  2. Dynamic import("cloudflare:workers") — same issue, DATA_SERVICE undefined at runtime
  3. fetch() with origin URL from getRequest() — Cloudflare Workers can't fetch their own zone (error 522 loop)
  4. Direct browser fetch('/worker/...') — worked but exposed unauthenticated endpoint
  5. Back to server function with static getRequest import — same 522 error
  6. globalThis hack to pass service binding from server entry — still broken

Each iteration was: write code → commit → push → wait for CI deploy (~1 min) → user tests in browser → fails → repeat. No local pnpm dev testing was attempted at any point.

Expected behavior

  • Agent should understand the runtime constraints before writing code (CF Workers can't self-fetch, service bindings need specific access patterns)
  • Agent should test locally before pushing to staging/production
  • If unsure about runtime behavior, agent should say so and propose a research step rather than shipping untested guesses
  • Maximum 1-2 deploy iterations should be needed, not 6+

Impact

  • 6 broken commits polluting git history on main
  • ~30 minutes of wasted user time waiting for deploys and testing
  • Erosion of trust in the tool's ability to handle cross-service communication patterns
  • Cost of Anthropic subscription feels unjustified when the output quality is this low for a straightforward integration task

Environment

  • Claude Code CLI with Opus model
  • Cloudflare Workers monorepo (pnpm workspaces)
  • TanStack Start (user-application) + Hono (data-service)
  • Both workers deployed to same domain with route-based separation

Suggestion

When working with deployment pipelines, the agent should have a strong prior toward local verification before pushing. A simple heuristic: if the change involves cross-service communication or runtime-specific APIs, always test with the local dev server first.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗