claude-code - 💡(How to fix) Fix Opus repeatedly ships broken code to production without local verification [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51996Fetched 2026-04-23 07:39:21
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Error Message

  1. fetch() with origin URL from getRequest() — Cloudflare Workers can't fetch their own zone (error 522 loop)
  2. Back to server function with static getRequest import — same 522 error
RAW_BUFFERClick to expand / collapse

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.

extent analysis

TL;DR

The most likely fix is to test cross-service communication changes locally with pnpm dev before pushing to staging or production.

Guidance

  • Verify that the agent understands the runtime constraints of Cloudflare Workers, such as the inability to self-fetch and specific access patterns for service bindings.
  • Implement a local testing step using pnpm dev for changes involving cross-service communication or runtime-specific APIs.
  • Consider adding a pre-push hook to enforce local testing for specific types of changes.
  • Review the agent's behavior and adjust its priors to favor local verification for similar tasks in the future.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The issue highlights the importance of local testing, especially for changes involving cross-service communication or runtime-specific APIs. The agent's behavior of pushing untested changes to staging or production can lead to wasted time, erosion of trust, and unnecessary costs.

Recommendation

Apply a workaround by implementing a local testing step using pnpm dev for changes involving cross-service communication or runtime-specific APIs, as this can help prevent similar issues in the future.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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+

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING