From 857053ad95bc347d67ac32a165f1f8afb704e94b Mon Sep 17 00:00:00 2001 From: Palash Shah <35114859+Palashio@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:16:57 -0400 Subject: [PATCH] fix: authentication bugs and example (#643) * fix: fix authentication bugs and example * fix: formatting * fix: move items --- apps/cli/.env.example | 5 ++++- apps/open-swe/.env.example | 5 ++++- .../src/graphs/manager/nodes/classify-message/index.ts | 10 +++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/cli/.env.example b/apps/cli/.env.example index 3ec75640..eca9abe2 100644 --- a/apps/cli/.env.example +++ b/apps/cli/.env.example @@ -11,4 +11,7 @@ GITHUB_CALLBACK_URL="" GITHUB_LOGIN_URL="" GITHUB_ACCESS_TOKEN_LOGIN_LINK= -SECRETS_ENCRYPTION_KEY="" \ No newline at end of file +SECRETS_ENCRYPTION_KEY="" + +OPEN_SWE_LOCAL_MODE=true +OPEN_SWE_LOCAL_PROJECT_PATH="" \ No newline at end of file diff --git a/apps/open-swe/.env.example b/apps/open-swe/.env.example index 4496a3ca..ae060a01 100644 --- a/apps/open-swe/.env.example +++ b/apps/open-swe/.env.example @@ -52,4 +52,7 @@ OPEN_SWE_APP_URL="http://localhost:3000" SECRETS_ENCRYPTION_KEY="" # Whether or not to append the string "[skip ci]" to the commit message. # See the documentation for how to set this up: docs.langchain.com/labs/swe/setup/ci#skip-ci-until-last-commit -SKIP_CI_UNTIL_LAST_COMMIT="true" \ No newline at end of file +SKIP_CI_UNTIL_LAST_COMMIT="true" + +OPEN_SWE_LOCAL_MODE=true +OPEN_SWE_LOCAL_PROJECT_PATH="" \ No newline at end of file diff --git a/apps/open-swe/src/graphs/manager/nodes/classify-message/index.ts b/apps/open-swe/src/graphs/manager/nodes/classify-message/index.ts index 9ee38eef..200ac96a 100644 --- a/apps/open-swe/src/graphs/manager/nodes/classify-message/index.ts +++ b/apps/open-swe/src/graphs/manager/nodes/classify-message/index.ts @@ -45,6 +45,7 @@ import { isLocalMode } from "@open-swe/shared/open-swe/local-mode"; import { Thread } from "@langchain/langgraph-sdk"; import { PlannerGraphState } from "@open-swe/shared/open-swe/planner/types"; import { GraphState } from "@open-swe/shared/open-swe/types"; +import { Client } from "@langchain/langgraph-sdk"; const logger = createLogger(LogLevel.INFO, "ClassifyMessage"); /** @@ -64,11 +65,14 @@ export async function classifyMessage( let plannerThread: Thread | undefined; let programmerThread: Thread | undefined; - const langGraphClient = createLangGraphClient({ - defaultHeaders: getDefaultHeaders(config), - }); + let langGraphClient: Client | undefined; if (!isLocalMode(config)) { + // Only create LangGraph client if not in local mode + langGraphClient = createLangGraphClient({ + defaultHeaders: getDefaultHeaders(config), + }); + plannerThread = state.plannerSession?.threadId ? await langGraphClient.threads.get(state.plannerSession.threadId) : undefined;