From 4d12ecb31b51ee624d7164caefb03d6e31fa597a Mon Sep 17 00:00:00 2001 From: Zbigniew Sobiecki Date: Thu, 12 Feb 2026 16:36:18 +0000 Subject: [PATCH] fix(router): pass GITHUB_REVIEWER_TOKEN to worker containers The review agent's separate reviewer identity (added in #154) requires GITHUB_REVIEWER_TOKEN in the worker environment. Without it, the agent falls back to the main GITHUB_TOKEN, authenticates as the PR author, and GitHub rejects REQUEST_CHANGES with 422 ("can not request changes on your own pull request"). Add the token to router secrets, worker container env, and local Docker runs so the reviewer identity works end-to-end. Co-Authored-By: Claude Opus 4.6 --- src/router/config.ts | 2 ++ src/router/worker-manager.ts | 1 + tools/run-local.ts | 3 +++ 3 files changed, 6 insertions(+) diff --git a/src/router/config.ts b/src/router/config.ts index 7114581a..80a5b05f 100644 --- a/src/router/config.ts +++ b/src/router/config.ts @@ -38,6 +38,7 @@ export interface RouterConfig { anthropicApiKey?: string; openaiApiKey?: string; openrouterApiKey?: string; + githubReviewerToken?: string; }; } @@ -71,5 +72,6 @@ export const routerConfig: RouterConfig = { anthropicApiKey: process.env.ANTHROPIC_API_KEY, openaiApiKey: process.env.OPENAI_API_KEY, openrouterApiKey: process.env.OPENROUTER_API_KEY, + githubReviewerToken: process.env.GITHUB_REVIEWER_TOKEN, }, }; diff --git a/src/router/worker-manager.ts b/src/router/worker-manager.ts index fbdaeba1..e806d634 100644 --- a/src/router/worker-manager.ts +++ b/src/router/worker-manager.ts @@ -41,6 +41,7 @@ function buildWorkerEnv(job: Job): string[] { if (secrets.anthropicApiKey) env.push(`ANTHROPIC_API_KEY=${secrets.anthropicApiKey}`); if (secrets.openaiApiKey) env.push(`OPENAI_API_KEY=${secrets.openaiApiKey}`); if (secrets.openrouterApiKey) env.push(`OPENROUTER_API_KEY=${secrets.openrouterApiKey}`); + if (secrets.githubReviewerToken) env.push(`GITHUB_REVIEWER_TOKEN=${secrets.githubReviewerToken}`); return env; } diff --git a/tools/run-local.ts b/tools/run-local.ts index 55e20b6c..51249647 100644 --- a/tools/run-local.ts +++ b/tools/run-local.ts @@ -180,6 +180,9 @@ function runAgentInDocker( ...(process.env.OPENROUTER_API_KEY ? ['-e', `OPENROUTER_API_KEY=${process.env.OPENROUTER_API_KEY}`] : []), + ...(process.env.GITHUB_REVIEWER_TOKEN + ? ['-e', `GITHUB_REVIEWER_TOKEN=${process.env.GITHUB_REVIEWER_TOKEN}`] + : []), // Image IMAGE_NAME, // Command: run the entrypoint script with tsx