From 567f62bad544adc9c16f86a0d9185bf8b3bfc0ce Mon Sep 17 00:00:00 2001 From: OG T Date: Sun, 7 Jun 2026 16:18:32 +0800 Subject: [PATCH] feat: add SCOUT_ENABLED flag to disable scout bot safely --- apps/scout-bot/src/index.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/scout-bot/src/index.ts b/apps/scout-bot/src/index.ts index 8abc854..177ce9d 100644 --- a/apps/scout-bot/src/index.ts +++ b/apps/scout-bot/src/index.ts @@ -10,6 +10,7 @@ const SCOUT_API_KEY = process.env.SCOUT_API_KEY; const SCOUT_AGENT_ID = process.env.SCOUT_AGENT_ID || "scout_official_1"; const SCOUT_CRON_EXPRESSION = process.env.SCOUT_CRON_EXPRESSION || "*/3 * * * *"; const SCOUT_ISSUE_LABELS_RAW = process.env.SCOUT_ISSUE_LABELS || process.env.SCOUT_ISSUE_LABEL || ""; +const SCOUT_ENABLED = (process.env.SCOUT_ENABLED || "true").toLowerCase() !== "false"; const SCOUT_TARGET_REPOS_RAW = process.env.SCOUT_TARGET_REPOS || "open-webui/open-webui,microsoft/vscode,vercel/next.js,langchain-ai/langgraph,facebook/react,microsoft/TypeScript,openai/openai-cookbook,astral-sh/ruff,sequelize/sequelize,pnpm/pnpm,prisma/prisma"; @@ -334,6 +335,11 @@ async function scanRepositories() { } async function bootstrap() { + if (!SCOUT_ENABLED) { + console.log("SCOUT_ENABLED is false. Scout bot is disabled."); + return; + } + // Delay first scan a bit so main web API is ready after startup. await wait(10); await scanRepositories(); @@ -341,10 +347,14 @@ async function bootstrap() { bootstrap(); -// Default: every 1 minute for phase-1 high-velocity inbound traffic -cron.schedule(SCOUT_CRON_EXPRESSION, () => { - console.log(`Running scheduled GitHub scan (${SCOUT_CRON_EXPRESSION})...`); - scanRepositories(); -}); +if (SCOUT_ENABLED) { + // Default: every 1 minute for phase-1 high-velocity inbound traffic + cron.schedule(SCOUT_CRON_EXPRESSION, () => { + console.log(`Running scheduled GitHub scan (${SCOUT_CRON_EXPRESSION})...`); + scanRepositories(); + }); +} else { + console.log("Cron schedule is disabled because SCOUT_ENABLED=false."); +} console.log("VibeWork Scout Bot started and scheduled.");