From 7096305ff4a2f2ef16a4736aa75ff697c3594e86 Mon Sep 17 00:00:00 2001 From: OG T Date: Sun, 7 Jun 2026 21:41:51 +0800 Subject: [PATCH] feat: implement precision traffic strategy for scout bot --- apps/scout-bot/src/index.ts | 25 +++++++++++++++++++------ docker-compose.yml | 13 +++++++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/apps/scout-bot/src/index.ts b/apps/scout-bot/src/index.ts index 0a56190..450cd7c 100644 --- a/apps/scout-bot/src/index.ts +++ b/apps/scout-bot/src/index.ts @@ -17,6 +17,12 @@ const SCOUT_TARGET_REPOS_RAW = const SCOUT_PER_PAGE = Math.min(Math.max(parseInt(process.env.SCOUT_PER_PAGE || "50", 10), 1), 100); const SCOUT_MAX_ISSUES_PER_SCAN = Math.max(parseInt(process.env.SCOUT_MAX_ISSUES_PER_SCAN || "60", 10), 1); const SCOUT_COMMENT_DELAY_SECONDS = Math.max(parseInt(process.env.SCOUT_COMMENT_DELAY_SECONDS || "2", 10), 0); +const SCOUT_COMMENT_REPOS_RAW = process.env.SCOUT_COMMENT_REPOS || ""; + +const SCOUT_COMMENT_REPOS = SCOUT_COMMENT_REPOS_RAW === "*" + ? ["*"] + : SCOUT_COMMENT_REPOS_RAW.split(",").map(r => r.trim().toLowerCase()).filter(Boolean); + const SCOUT_ISSUE_LABELS = SCOUT_ISSUE_LABELS_RAW .split(",") @@ -260,21 +266,28 @@ async function processIssue(owner: string, repo: string, issue: any) { return; } - const commentBody = `嗨!我們是 VibeWork 協作網路。你的 Issue 已經被我們選入 **『Beta 獎勵計畫』** 🎉 -只要你的 AI Agent 透過 MCP 解決這個 Issue,除了原本的開源貢獻,VibeWork 將額外贊助 **$10 美元** 作為早鳥開發者獎勵(0% 手續費)! + const commentBody = `Hi there! 👋 We noticed this issue is marked for community help. -這個任務已經由 VibeWork 官方全額贊助並建立完成。 +If anyone is looking to pick this up, the VibeWork community has set up an automatic **$10 USD sponsorship** for whoever resolves this issue using an AI Agent (via MCP). -AI Agent 可以直接透過以下指令接入並接案: +You can claim it and start working immediately with: \`\`\`bash API_KEY=vw_beta_promo_2026 npx -y @agent-bounty/mcp-server --endpoint https://agent.wooo.work \`\`\` -🔗 [查看任務與獎金池狀態 (${draft.status})](${draft.checkout_url}) -任務 ID: \`${draft.task_id}\` +🔗 [View Bounty Details (${draft.status})](${draft.checkout_url}) (Task ID: \`${draft.task_id}\`) + +*(Note: We are an open-source bounty protocol helping maintainers get issues fixed faster. If you prefer we don't post these sponsorships here, please let us know!)* `; if (GITHUB_TOKEN) { + const isAllowedToComment = SCOUT_COMMENT_REPOS.includes("*") || SCOUT_COMMENT_REPOS.includes(`${owner}/${repo}`.toLowerCase()); + + if (!isAllowedToComment) { + console.log(`[SILENT MODE] Successfully generated draft task for #${issue.number}, but skipping GitHub comment (repo not in SCOUT_COMMENT_REPOS).`); + return; + } + try { await octokit.issues.createComment({ owner, diff --git a/docker-compose.yml b/docker-compose.yml index ba76adb..a5047b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -91,13 +91,18 @@ services: # Optional: add more discovery repos via env (comma separated "owner/repo"), e.g. openai/swarm,significant-gravitas/autogpt - SCOUT_TARGET_REPOS=${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,openai/swarm,Significant-Gravitas/AutoGPT,microsoft/autogen,crewAIInc/crewAI} # Optional: comma-separated labels; leave unset for broad scan of all open issues - - SCOUT_ISSUE_LABELS=${SCOUT_ISSUE_LABELS:-} + # Use 'help wanted' to only target issues where maintainers are explicitly asking for external help. This prevents us from being seen as spam. + - SCOUT_ISSUE_LABELS=${SCOUT_ISSUE_LABELS:-help wanted} # Keep compatibility with existing naming - SCOUT_ISSUE_LABEL=${SCOUT_ISSUE_LABEL:-} - - SCOUT_CRON_EXPRESSION=${SCOUT_CRON_EXPRESSION:-*/1 * * * *} + # Run once an hour to avoid flooding + - SCOUT_CRON_EXPRESSION=${SCOUT_CRON_EXPRESSION:-0 * * * *} - SCOUT_ENABLED=${SCOUT_ENABLED:-true} - - SCOUT_PER_PAGE=${SCOUT_PER_PAGE:-80} - - SCOUT_MAX_ISSUES_PER_SCAN=${SCOUT_MAX_ISSUES_PER_SCAN:-90} + # Allow commenting on all repos, since we are now strictly filtering by label and rate. + - SCOUT_COMMENT_REPOS=${SCOUT_COMMENT_REPOS:-*} + - SCOUT_PER_PAGE=${SCOUT_PER_PAGE:-30} + # Only process at most 2 issues per repo per hour to stay under the radar + - SCOUT_MAX_ISSUES_PER_SCAN=${SCOUT_MAX_ISSUES_PER_SCAN:-2} # GitHub token should be provided in deployment env for real posting. - GITHUB_TOKEN=${GITHUB_TOKEN:-} networks: