Repository navigation
feat(bot): gateway + CPA dual-channel GitHub AI review/scan/fix bot - #16
Conversation
Dual-provider llm_client (self-hosted gateway free models + CPA responses, xhigh/high mapping, verbatim thinking passthrough, response_id session echo, secret redaction); triage/review/explain/ scan/fix-plan pipelines with role-separated primaries (triage gemini-3.8-flash-high, safety grok-4.6, api-compat claude-opus-4-6-thinking, docs muse-spark-1.3-contributor-free, explainer big-pickle, scanner grok-composer-2.5-fast) and cross-channel fallbacks; ai-review/ai-scan (weekly cron + fingerprint-dedupe auto-issue)/ai-fix (/fix plans, opt-in draft PRs only, auto-merge forbidden) workflows; 25 python tests; docs/AI_BOT.md.
Verdict matrix
Sensitive paths
Deterministic pre-checks
gateway_safetyVERDICT: NEEDS_CHANGES BLOCKING: SHOULD_FIX: NITS: The rest of the PR (workflows with redacted secrets, .gitignore updates, CI lint guard, docs, changelog, role prompts, llm_client scrubbing, session meta passthrough, etc.) fully respects every [provider] safety invariant: no secrets/values ever appear, auth discipline is untouched, tool-output logging is absent, wire shapes are not touched, config-matrix sync is not broken, log hygiene is metadata-only, and the bot routes exclusively through the existing [provider] (no new /health or auth changes). The only regression introduced by this PR is the self-flagging of its own committed config file. Fix the scan exclusion and the PR is safe to merge. api_compatAPI Compatibility ReviewThis PR adds a Python-based GitHub AI bot ( VERDICT: NEEDS_CHANGESBLOCKING:
SHOULD_FIX:
NITS:
Wire-shape impact assessment
Test gaps
Cross-protocol regressionsNone detected. This PR is additive (new Python bot + workflows + docs) and does not modify any TypeScript [provider] source, route handlers, converters, or wire-shape code. docs_configVERDICT: COMMENT SummaryNo [provider] runtime configuration settings were added or altered in this PR. The six-way configuration matrix ( BLOCKING
SHOULD_FIX
NITS
Files to update to close the gaps
FINAL_VERDICT: NEEDS_CHANGES Session: response_id=746a3025-3252-93d3-923c-68c02c4c300f,resp_req_vrtx_011CetNmMWoPbhytMLEP516S,resp_6Kuhapm7NKTcvr0Pg-LO0QI (chain via previous_response_id, 30min TTL). model=[model] provider=[provider]. |
Correct gateway notes/triage playbook: anonymous out-of-box quota, ephemeral in-job gateway viable, no login-state restore needed.
Each ai workflow starts its own localhost gateway (API_KEY empty = no auth, OPENCODE_PROXY_MANAGE_BACKEND=true, anonymous out-of-box quota) unless GATEWAY_BASE_URL secret overrides; CPA creds optional with warning. llm_client allows empty gateway key end-to-end (default selection, discovery, candidates, auth header omitted) while CPA still requires a key. 27 python tests.
feat(bot): gateway + CPA dual-channel GitHub AI review/scan/fix bot
需求對照
/explain(PR 白話解說;issue 轉調查)、thread-aware(已問不重問)/fix(恆回 fix plan;opt-in+git apply --check乾淨才開 draft PR,maxPrsPerRun: 1由單 issue run+concurrency group 保證)response_id供previous_response_id鏈接(30min TTL);thinking/signature 逐字透傳不偽造${VAR}+secrets 引用),filled-inLLM_config.jsongit-ignored+CI guard模型矩陣(primaries 最大分離,mains 互為 fallback;公開留言不出現)
gemini-3.8-flash-high(CPA/high)grok-4.6(CPA/high)claude-opus-4-6-thinking(CPA/high)muse-spark-1.3-contributor-free(gateway/xhigh,CPA 映射 high)big-pickle(gateway/high)grok-composer-2.5-fast(CPA/high)gemini-3.8-flash-high(CPA/high)各角色先試 primary,再走全域
fallbackModels鏈(三主力置頂互為備援)。免費額度免登入、首次啟動自動生成(匿名開箱即用),因此各 workflow 預設在 job 內起免鑑權 localhost gateway(API_KEY空+MANAGE_BACKEND=true);GATEWAY_BASE_URLsecret 有設才改用外部。測試證據
npx tsc --noEmit→ EXIT 0npm test -- --runInBand→ 22 suites / 347 tests 全綠PYTHONPATH=github_bot/src python3 -m unittest tests.test_ai_bot→ 27/27 OK(含空-key gateway 可用+省略 Auth header)GATEWAY_*/CPA_*在.env.example/config.json.example/Dockerfile/compose/index.ts/docs/configuration.md皆零命中(bot Secrets 不進矩陣)LLM_config.json未追蹤+check-ignore 命中;三 workflow YAML 可解析+run 區塊 bash -n 全過流程
開分支 → 4 位 subagents 分頭調查 → 分階段實作(Phase 1 LLM 層、Phase 2 Bot Actions)→ 每階段 review subagents+fix 循環 → 最終 3 位全面 review(需求/安全/CI文件)→ commit+push+開 PR → 補 in-job gateway delta(review+push)。
後續操作(合併後,預設零 secrets 即可跑)
GATEWAY_BASE_URL(+GATEWAY_API_KEY,空即免鑑權)則跳過 in-job 啟動;CPA fallback:設CPA_BASE_URL+CPA_API_KEY,缺則 warning 跑 gateway-only。security僅建議):bug, documentation, enhancement, question, needs-info, needs-triage, api-compat, config, tool-safety, support, duplicate, invalid, wontfix, good first issue, help wanted。ai-scan先用workflow_dispatch(dry_run:true)觀察 in-job gateway 啟動+fingerprint 去重。