Add comprehensive logging for debugging 500 errors in commit_files

- Log token type (GitHub App vs PAT) and age to detect expiration issues
- Add detailed logging at ref update step where 500 error occurs
- Capture GitHub Request ID for support tickets
- Log environment context (repo, branch, files)
- Fix error handling to throw errors instead of returning custom objects
- Pass TOKEN_CREATED_AT and GITHUB_API_URL to MCP subprocess

This will help diagnose why commit_files gets 500 errors on ref updates
while tree/commit creation succeeds.
This commit is contained in:
Lina Tawfik
2025-05-23 15:52:39 -07:00
parent c845eee45f
commit cde954dda0
2 changed files with 67 additions and 22 deletions

View File

@@ -35,6 +35,8 @@ export async function prepareMcpConfig(
REPO_NAME: repo,
BRANCH_NAME: branch,
REPO_DIR: process.env.GITHUB_WORKSPACE || process.cwd(),
TOKEN_CREATED_AT: new Date().toISOString(),
GITHUB_API_URL: process.env.GITHUB_API_URL || "https://api.github.com",
},
},
},