From 005190e7bdc4c970d9ab06b133415cb0e7a12091 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Thu, 24 Jul 2025 12:40:57 -0700 Subject: [PATCH] fix: better logging for gh token refresh --- apps/open-swe/src/utils/github/api.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/open-swe/src/utils/github/api.ts b/apps/open-swe/src/utils/github/api.ts index 7c3f7d40..2420a3dd 100644 --- a/apps/open-swe/src/utils/github/api.ts +++ b/apps/open-swe/src/utils/github/api.ts @@ -12,6 +12,7 @@ const logger = createLogger(LogLevel.INFO, "GitHub-API"); async function getInstallationTokenAndUpdateConfig() { try { + logger.info("Fetching a new GitHub installation token."); const config = getConfig(); const encryptionSecret = process.env.SECRETS_ENCRYPTION_KEY; if (!encryptionSecret) { @@ -30,6 +31,7 @@ async function getInstallationTokenAndUpdateConfig() { const token = await getInstallationToken(installationId, appId, privateKey); const encryptedToken = encryptSecret(token, encryptionSecret); updateConfig(GITHUB_INSTALLATION_ID, encryptedToken); + logger.info("Successfully fetched a new GitHub installation token."); return token; } catch (e) { logger.error("Failed to get installation token and update config", { @@ -77,6 +79,7 @@ async function withGitHubRetry( } logger.error(errorMessage, { + numRetries, ...additionalLogFields, ...(errorFields ?? { error }), });