From 5ddce73b0691af3951ba105767ff5bdcf79d2af7 Mon Sep 17 00:00:00 2001 From: Johannes du Plessis Date: Wed, 20 May 2026 11:47:25 -0700 Subject: [PATCH] fix(dashboard): use deployment LangGraph client for review style analysis (#1317) Hardcoded localhost:2024 caused httpx.ConnectError when starting the review_style_analyzer graph in production. Resolve the SDK URL from LANGGRAPH_URL / LANGGRAPH_URL_PROD like webapp, otherwise get_client(). Co-authored-by: open-swe[bot] Co-authored-by: Cursor --- agent/dashboard/review_style_jobs.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/agent/dashboard/review_style_jobs.py b/agent/dashboard/review_style_jobs.py index 4fa68468..26d605f1 100644 --- a/agent/dashboard/review_style_jobs.py +++ b/agent/dashboard/review_style_jobs.py @@ -3,6 +3,7 @@ from __future__ import annotations import logging +import os from typing import Any from langgraph_sdk import get_client @@ -22,7 +23,14 @@ from .review_styles import ( logger = logging.getLogger(__name__) _ASSISTANT_ID = "review_style_analyzer" -_LANGGRAPH_URL = "http://localhost:2024" + + +def _client(): + """LangGraph SDK client for the current deployment (same resolution as webapp).""" + url = os.environ.get("LANGGRAPH_URL") or os.environ.get("LANGGRAPH_URL_PROD") + if url: + return get_client(url=url) + return get_client() async def start_review_style_analysis( @@ -48,7 +56,7 @@ async def start_review_style_analysis( samples_text = format_samples_for_analyzer(samples) thread_id = generate_review_style_thread_id(owner, repo) - client = get_client(url=_LANGGRAPH_URL) + client = _client() configurable: dict[str, Any] = { "thread_id": thread_id, "review_style_full_name": full_name, @@ -121,7 +129,7 @@ async def sync_review_style_run_status(full_name: str) -> dict[str, Any]: if not isinstance(thread_id, str) or not thread_id: return record - client = get_client(url=_LANGGRAPH_URL) + client = _client() try: if isinstance(run_id, str) and run_id: run = await client.runs.get(thread_id, run_id)