René's URL Explorer Experiment


Title: design-code-proxy: quota error in a 200 JSON body hangs the request forever — writeHead precedes the in-body check, so fallback can never fire · Issue #681 · developing-today/code · GitHub

Open Graph Title: design-code-proxy: quota error in a 200 JSON body hangs the request forever — writeHead precedes the in-body check, so fallback can never fire · Issue #681 · developing-today/code

X Title: design-code-proxy: quota error in a 200 JSON body hangs the request forever — writeHead precedes the in-body check, so fallback can never fire · Issue #681 · developing-today/code

Description: Finding bin/design-code-proxy.mjs's local-dispatch fallback can never fire for a quota error reported in the JSON body of an HTTP 200 response, and the client request hangs forever instead. In tryTarget (bin/design-code-proxy.mjs:213-266...

Open Graph Description: Finding bin/design-code-proxy.mjs's local-dispatch fallback can never fire for a quota error reported in the JSON body of an HTTP 200 response, and the client request hangs forever instead. In tryT...

X Description: Finding bin/design-code-proxy.mjs's local-dispatch fallback can never fire for a quota error reported in the JSON body of an HTTP 200 response, and the client request hangs forever instead. In ...

Opengraph URL: https://github.com/developing-today/code/issues/681

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"design-code-proxy: quota error in a 200 JSON body hangs the request forever — writeHead precedes the in-body check, so fallback can never fire","articleBody":"## Finding\n\n`bin/design-code-proxy.mjs`'s local-dispatch fallback can never fire for a quota error reported **in the JSON body of an HTTP 200 response**, and the client request **hangs forever** instead.\n\nIn `tryTarget` (`bin/design-code-proxy.mjs:213-266` on main `4b85ef69`):\n\n1. The response callback calls `clientRes.writeHead(localRes.statusCode || 200, ...)` at **line 219** — before the body has been read. From that moment `clientRes.headersSent` is `true`.\n2. The non-stream body handler (line 254-258) parses the body and, for a quota error, calls `return onFail(new Error('Quota exceeded in JSON body'))`.\n3. The primary target's `onFail` wrapper (line 279-280) begins with `if (clientRes.headersSent) return;` — so it silently returns without trying the fallback target and **without ever ending `clientRes`**. The fallback target's own `onFail` (line 284) is guarded the same way, so the hang happens whichever target returns the quota body.\n\nThe status-based path works fine because the `429`/`>=500` check (line 213) runs *before* `writeHead` — only the in-body check, which the code explicitly added to catch quota exhaustion, is defeated by the ordering.\n\n## Evidence (reproduced on current main `4b85ef6906a25c1a59694c64986cb17828b6c2b6`)\n\nRan the real `bin/design-code-proxy.mjs` locally with stub HTTP backends on the Antigravity/Codex ports (`DESIGN_CODE_PROXY_PORT`/`ANTIGRAVITY_LS_PROXY_PORT`/`CODEX_PROXY_PORT` pointed at the stubs), model `design-code-flash`, non-stream:\n\n- Stub primary returns **HTTP 200** with `{\"error\":{\"code\":429,\"message\":\"quota stub\",\"type\":\"insufficient_quota\"}}`:\n  - `curl --max-time 5` → **timed out after 5002 ms with 0 bytes received** (curl exit 28); the proxy logged only the primary attempt — no \"Falling back\" line, the fallback stub was never contacted, and the response was never ended. Without a client-side timeout this hangs indefinitely.\n- Control — stub primary returns **HTTP 429 status** with an error body:\n  - Proxy logged `returned 429`, tried the fallback target, and answered **502 `All design code backends failed: HTTP 429` in under a second** — the intended behaviour the in-body path was written to provide.\n\n## Why it matters\n\nThe in-body quota shape is exactly what this branch exists for (backends that report quota exhaustion in a 200 JSON error body). Today, instead of failing over to the fallback model/backend, every such request wedges an open client connection forever — the worst failure mode for a dispatch proxy whose whole job is fallback — and leaks the socket on both sides until the client gives up.\n\n## Suggested fix\n\nFor the non-stream path, buffer the body and run the quota check **before** `clientRes.writeHead(...)`; only write the head once the response is known not to be a quota failure (the stream path must keep writing its head up front). Equivalently, restructure so the head is written at the point the body is ended for non-stream responses.\n\n## Acceptance criteria\n\n- [ ] A non-stream request whose primary backend returns HTTP 200 with `{\"error\":{\"code\":429,...}}` or `{\"error\":{\"type\":\"insufficient_quota\",...}}` tries the fallback target instead of hanging; if the fallback succeeds, its (model-rewritten) response is returned; if it also fails, the client gets the existing 502 `All design code backends failed` response promptly.\n- [ ] The same holds when the *fallback* target returns the in-body quota error: prompt 502, no hang.\n- [ ] Unchanged behaviour: HTTP-status 429/5xx fallback, connection-error fallback, successful non-stream responses (status, headers, `model` rewritten to the design model id), and streaming responses.\n- [ ] Regression tests cover the in-body quota case (primary and fallback) with stub backends — `bin/design-code-proxy.mjs` currently has no test file; `bin/codex-proxy.test.mjs` / `bin/muse-proxy.test.mjs` show the stub-backend pattern to follow.\n\nCross-repo check: `design-code-proxy` exists only in this repo (git grep across developing-today/opencode, developing-today/openchamber, dezren39/nix: no copies) — no cross-repo set.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-23T19:18:18Z","url":"https://github.com/developing-today/code/issues/681"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c08e1d4b-9600-5c3f-53b6-375b9182989c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id94DE:130DD7:AC9D8A:E5D054:6B063EDA
html-safe-nonce3916252ecbb461dee8d56f41f5a050ef22d1a36fd264be6d196664efffeda2ce
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NERFOjEzMERENzpBQzlEOEE6RTVEMDU0OjZCMDYzRURBIiwidmlzaXRvcl9pZCI6IjI5MzM3ODIwMTcyNTY4NjU0OTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc256fa96a30a5de18ca53a3436c01cdf5967e5e43bd4e07347f4d1838f6aa79d
hovercard-subject-tagissue:6004033630
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/681/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4eb5e8d060b877f03967649c1d76234eb02e5256d2994393441126c79b17c76b/developing-today/code/issues/681
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4eb5e8d060b877f03967649c1d76234eb02e5256d2994393441126c79b17c76b/developing-today/code/issues/681
og:image:altFinding bin/design-code-proxy.mjs's local-dispatch fallback can never fire for a quota error reported in the JSON body of an HTTP 200 response, and the client request hangs forever instead. In tryT...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedezren39
hostnamegithub.com
expected-hostnamegithub.com
None1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652
turbo-cache-controlno-preview
go-importgithub.com/developing-today/code git https://github.com/developing-today/code.git
octolytics-dimension-user_id26439447
octolytics-dimension-user_logindeveloping-today
octolytics-dimension-repository_id627308783
octolytics-dimension-repository_nwodeveloping-today/code
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627308783
octolytics-dimension-repository_network_root_nwodeveloping-today/code
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseac613d3698d3d8565651455086e1f74da07bf277
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/developing-today/code/issues/681#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F681
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F681
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=developing-today%2Fcode
Reloadhttps://github.com/developing-today/code/issues/681
Reloadhttps://github.com/developing-today/code/issues/681
Reloadhttps://github.com/developing-today/code/issues/681
developing-todayhttps://github.com/developing-today
codehttps://github.com/developing-today/code
Codehttps://github.com/developing-today/code
Issues1.1k (1.1k)https://github.com/developing-today/code/issues
Pull requests168 (168)https://github.com/developing-today/code/pulls
Discussionshttps://github.com/developing-today/code/discussions
Actionshttps://github.com/developing-today/code/actions
Projectshttps://github.com/developing-today/code/projects
Wikihttps://github.com/developing-today/code/wiki
Security and qualityhttps://github.com/developing-today/code/security
Insightshttps://github.com/developing-today/code/insights
https://github.com/developing-today/code
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/681
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/681
#682https://github.com/developing-today/code/pull/682
design-code-proxy: quota error in a 200 JSON body hangs the request forever — writeHead precedes the in-body check, so fallback can never firehttps://github.com/developing-today/code/issues/681#top
#682https://github.com/developing-today/code/pull/682
https://github.com/dezren39
https://github.com/dezren39
dezren39https://github.com/dezren39
on Oct 23, 2026https://github.com/developing-today/code/issues/681#issue-6004033630
github-actionshttps://github.com/apps/github-actions
dezren39https://github.com/dezren39
on Oct 23, 2026https://github.com/developing-today/code/issues/681#event-34084253069
dezren39https://github.com/dezren39
on Oct 23, 2026https://github.com/developing-today/code/issues/681#event-34084525840
Merge pull request #682 from developing-today/creator/681-design-quot…https://github.com/developing-today/code/commit/c6ec7bd623df42909fdfa2225d249b593ad2e44c
#682https://github.com/developing-today/code/pull/682
c6ec7bdhttps://github.com/developing-today/code/commit/c6ec7bd623df42909fdfa2225d249b593ad2e44c
dezren39https://github.com/dezren39
completedhttps://github.com/developing-today/code/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#682https://github.com/developing-today/code/pull/682
on Oct 23, 2026https://github.com/developing-today/code/issues/681#event-34084525950
https://github.com/apps/developing-today-fleet
developing-today-fleethttps://github.com/apps/developing-today-fleet
on Nov 24, 2026https://github.com/developing-today/code/issues/681#issuecomment-7124557247
developing.today fleethttps://kaneo.security.cab
PR #682 — fix(design-code-proxy): fall back on quota errors in a 200 JSON body instead of hanging (#681)https://github.com/developing-today/code/pull/682
Sign up for freehttps://github.com/signup?return_to=https://github.com/developing-today/code/issues/681
Sign in to commenthttps://github.com/login?return_to=https://github.com/developing-today/code/issues/681
dezren39https://github.com/dezren39
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.