From daa042add2b74bf9ab6eb762523d989ac129424d Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Fri, 8 Aug 2025 12:36:28 -0700 Subject: [PATCH] fix: dont require an installation ID in eval mode (#721) --- apps/open-swe/src/utils/github-tokens.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/open-swe/src/utils/github-tokens.ts b/apps/open-swe/src/utils/github-tokens.ts index a0ac7ca0..8798ae8a 100644 --- a/apps/open-swe/src/utils/github-tokens.ts +++ b/apps/open-swe/src/utils/github-tokens.ts @@ -24,23 +24,24 @@ export function getGitHubTokensFromConfig(config: GraphConfig): { const isProd = process.env.NODE_ENV === "production"; - const installationId = config.configurable[GITHUB_INSTALLATION_ID]; - if (!installationId) { - throw new Error( - `Missing required ${GITHUB_INSTALLATION_ID} in configuration.`, - ); - } - const githubPat = getGitHubPatFromConfig(config.configurable, encryptionKey); if (githubPat && !isProd) { // check for PAT-only mode return { githubAccessToken: githubPat, githubInstallationToken: githubPat, - installationId, + // installationId is not required in PAT-only mode + installationId: config.configurable[GITHUB_INSTALLATION_ID] ?? "", }; } + const installationId = config.configurable[GITHUB_INSTALLATION_ID]; + if (!installationId) { + throw new Error( + `Missing required ${GITHUB_INSTALLATION_ID} in configuration.`, + ); + } + const encryptedGitHubToken = config.configurable[GITHUB_TOKEN_COOKIE]; const encryptedInstallationToken = config.configurable[GITHUB_INSTALLATION_TOKEN_COOKIE];