From b8122dc916d190dd7e0383f16799e913eec2d160 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Thu, 14 May 2026 00:33:50 -0700 Subject: [PATCH] chore(diag): expose hasDatabaseUrl + instanceId in _proxy_debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Phase 3 rate limit is partially working in production — 12 streaming requests resulted in 7 DB inserts but no 429s. Theory: some Vercel function instances cold-start without DATABASE_URL populated and silently fail-open for their lifetime. This commit adds three fields to the /api/_proxy_debug response so we can confirm: - hasDatabaseUrl: whether the env var is visible at runtime - rateLimitConfigured: whether the proxy was wired with the hook - instanceId: a per-instance random id, so multiple curls can show whether they hit the same instance or different ones Once verified, this commit can stay (cheap) or be reverted as preferred — the cost is 4 lines in the debug response. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/langgraph-proxy.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/langgraph-proxy.ts b/scripts/langgraph-proxy.ts index 246931d2..9d5dab44 100644 --- a/scripts/langgraph-proxy.ts +++ b/scripts/langgraph-proxy.ts @@ -105,6 +105,13 @@ export function createProxyHandler(config: ProxyConfig = {}): (req: VercelReques query: req.query, hasApiKey: !!apiKey, apiKeyPrefix: apiKey.substring(0, 10), + hasDatabaseUrl: !!process.env['DATABASE_URL'], + rateLimitConfigured: !!config.checkRateLimit, + instanceId: (() => { + const g = globalThis as { __instanceId?: string }; + if (!g.__instanceId) g.__instanceId = Math.random().toString(36).slice(2, 10); + return g.__instanceId; + })(), }); return; }