Repository navigation
feat: implement @botmux-ai/plugin-github PR watcher and automated review group plugin - #1
Conversation
…iew group plugin - Add self-contained esbuild ESM build pipeline (Node 22+ and standalone Bun binary compatible, zero runtime dependencies, atomic dist swap + dist/botmux-build/stamp) - Implement dormant-by-default background service with PAT, GitHub App RS256 JWT (GHES-ready), and in-memory gh auth token fallback, ETag 304 zero-quota polling, per-resource core/search <10% throttling, 429/403 1m->1h monotonic backoff, fail-closed proxy + HTTP CONNECT TLS tunneling, and dual-layer secret redaction - Implement dual-source event ingestion (authoritative poller with first-run baseline snapshot + optional 127.0.0.1 HMAC-SHA256 webhook receiver) feeding a shared FIFO per-PR serial queue - Implement anti-injection <untrusted_pr_metadata> XML escaping with isFork/maintainerCanModify flags and Feishu <at>/@ALL neutralization - Implement crash-safe dual-core HostBridge (node:http loopback IPC bypassing Bun $http_proxy 403, creating lock, anchored GET /api/groups dedup, POST /api/groups/create with current-core/CLI fallbacks, kickoff readback verification, dual-path Feishu/Lark top-notice, idempotent PR share-link comment, onNewCommit/onPrClosed notifications) - Add Dashboard UI (#/plugins/github using api.react + api.listBots + dual-path serviceFetch/getSettings), write-only 0600 server/settings.js adapter, 4 CLI commands (github:status, github:sync, github:open-pr, github:test-auth), docs/plugin-market-entry.json, bilingual README, and 34 unit/integration/packaging tests Co-Authored-By: Claude Code <[email protected]>
独立复审结论:不可合(head
|
- [P1 #1] Defer webhook knownPrs commits until after action succeeds; refuse committing knownPrs on synchronize when it would mask undiscovered PRs, draft->ready, closed->open, or incomplete groups, and invalidate repo ETag for poll recovery - [P1 #2] Add cross-process per-PR exclusive lockfile around HostBridge group orchestration, persist createAttempt.outcomeUnknown so dropped IPC responses fail closed rather than switching to CLI fallback, and gate CLI/settings in-process fallback strictly on ECONNREFUSED/unreachable (never ECONNRESET on POST mutations) - [P2 #3] Align dist/webhooks/index.json with deepcoldy/botmux#3830 (mount-relative path "/events" -> endpoint "/webhooks/github", maxBodyBytes 1048576) and enforce isolated BOTMUX_PLUGIN_WEBHOOK_TOKEN Bearer auth - [P2 #4] Prevent ETag advancement on single-PR close lookup failures, validate multi-page (>100 PR) repositories across all pages with per-page ETags and legacy cold-restart page-count inference, and invalidate repo ETag on webhook/openPr mutations - [P2 #5] Implement explicit reopen lifecycle transitions with lifecycleGeneration-scoped dedup keys and idempotent closed state landing across poll and webhook paths (including onPrClosed=false and creating groups) - [P2 #6] Keep PR groups in creating state until kickoff readback verification, top-notice pinning, and optional share-link posting complete, allowing poll and manual openPr to resume only unfinished steps - [P2 #7] Add generation counter + AbortSignal propagation across active->dormant hot-reloads and per-PR handlers so stale polls/webhooks immediately halt without further pagination or state writes - [P2 #8] Bound DeliveryDedupCache in-flight count/TTL and PerPrSerialQueue global pending cap with cancellable per-task timeouts, synchronously returning retryable HTTP 429/503 instead of fake 202 - [P2 #9] Pre-validate candidate clients in reloadConfig before mutating state/timers, commit config/hash in runner.ts only after reload succeeds, return HTTP 500 ok:false on error, and preserve auto-retry - [P2 #10] Fold --repo access verification and slug validation into testAuth top-level ok and CLI exit code - [P2 #11] Enforce <=100 code-point bounded canonical group name prefixes for max-length owner/repo names while preserving anchored GET /api/groups deduplication - [P3 #12] Reject non-immediate ancestor symlinks below trusted OS roots in src/security/fs.ts (and recover empty/truncated lockfiles via staleMs), and restore deepcoldy/botmux links in README.md Co-Authored-By: Claude Code <[email protected]>
第二轮独立复审结论:不可合(head
|
| 上一轮场景 | 结论 | 本轮独立复验证据 |
|---|---|---|
| Webhook 游标提前提交 | 已闭合 | pre-lock 失败后不再写 knownPrs;下一次 poll 真实创建记录并持久化 chatId/kickoffMessageId。未知 PR 的 synchronize 后也能进入建群,不再被 poll 跳过。 |
| 建群互斥与 unknown outcome | 部分闭合 | 普通双实例并发现在 listCalls=1, createCalls=1,两个调用返回同一 chatId;daemon 离线恢复时 cliCalls=0。但“旧 create 仍在执行、GET 暂时看不到群”的变体仍会双建,见新 P1-1。 |
| #3830 webhook 契约 | 已闭合 | 实际 dist 经 #3830 真实 parser/matcher 得到 /events → /webhooks/github;缺/错 Bearer=401,正确 Bearer=200,webhook token 访问 /api/status=401;现行无 host token 的 Phase 1 ping=200,当前 scanner 对实际 dist 扫描通过。 |
| 单 PR 关闭失败与跨页 ETag | 已闭合 | 500 后 lastPollStatus=error,第二次仍重新查询(singlePrLookupCalls=2),不再 304 跳过;101 PR 场景中第二次实际读取 page 2,并发送 notify_pr_closed、持久化 pr_closed:g1、群转 closed。 |
| Reopen / 同 SHA 第二次 close | 已闭合 | poll reopen 返回 resume_group 并转 active;manual reactivate 后第二次 close 实际发送通知,最终 prGroups.status=closed 且 knownPrs.state=closed。 |
| 未验证 kickoff / 置顶失败后的 active | 已闭合 | readback 500 现在抛错,status=creating, kickoffVerified=false, topNoticeCalls=0;首次置顶失败返回 error,第二次 openPr() 为 resumed,topNoticeCalls=2,最终 active 且 topNoticeSet=true。 |
| Active→dormant 在途外呼 | 原场景已闭合 | 同一 page-1 阻塞探针现在 page2AfterReload=0,初始 dormant 仍为零外呼。active→active 的新丢失窗口见新 P2-7。 |
| Queue 无界与 fake 202 | 已闭合 | per-key 满载现在返回 429 {ok:false,error:"pr_queue_full"};全局 pending 配置 64 时 5000 个 key 仅积压 64;in-flight 到上限返回 overloaded,过期后可重新 acquire。 |
| Reload 假成功与不重试 | 已闭合 | 失败返回 500 {ok:false};恢复后自动 poll 从 1 次增至 2 次,watcher/disk 配置均为 61。 |
test-auth --repo 假成功 |
已闭合 | /user=200、repo=403 时真实 CLI handler 返回 exitCode=1, topLevelOk=false, repoAccess.ok=false。 |
| 长 repo 群名超限 | 已闭合 | 39 字 owner + 100 字 repo 的同一输入现在生成 84 code points;另一组 100+100 输入也为 84,均不超过 100。 |
| 祖先 symlink 与 README 链接 | 已闭合 | 同一 ancestor-symlink 探针现在 nonImmediateAncestorSymlinkRejected=true, writeTraversedAncestorSymlink=false;两处 README 均恢复可访问的 deepcoldy/botmux。 |
新增 P1 阻断
P1-1 — 旧 create 仍在执行时,空 GET 会清除 unknown outcome 并再次建群
位置:src/host/bridge.ts:892-981。
这是对上一轮 unknown-outcome 修复的对抗变体:第一次 IPC POST 已被 daemon 接受,但响应断开,真实核心不会在客户端断开时取消创建。若群在 700 ms 后才出现在 GET 列表,第二次调用会把暂时为空的列表当成“未创建”的证据,清除 createAttempt 并再次 POST。持久化的 idempotencyKey 没有发送给核心,当前核心也没有按它去重。
真实 HostBridge + StateStore + 延迟可见本地 daemon 的复跑结果:
{"createCalls":2,"createdChatIds":["oc_delayed_1","oc_delayed_2"],"errors":["socket hang up","socket hang up"]}因此上一轮 P1 不能完全判定关闭。需要核心的幂等 create/attempt-status 协议,或在原操作仍可能执行时保持 fail closed;空快照不足以证明安全。
P1-2 — --dry-run=true 反而关闭 dry-run,可发起真实 mutation
位置:src/cli/index.ts:44,313,333,397,428。该问题在旧 head 已存在,由本轮扩大覆盖发现。
通用 --name=value 解析把值保存为字符串 "true",而 sync/open-pr 只认 boolean true。真实 CLI 对本地 control-service 的观测:
[
{"command":"sync --dry-run=true","body":{"dryRun":false,"async":false}},
{"command":"sync --dry-run","body":{"dryRun":true,"async":false}},
{"command":"open-pr acme/reg#12 --dry-run=true","body":{"prNumber":12,"dryRun":false}}
]用户明确写了 dry-run 却可能真实 sync/建群。应显式解析布尔值,或拒绝 --dry-run=<value>,不能静默降级为真实执行。
P1-3 — 达到小时建群上限的 PR 永久不再重试
位置:src/engine/watcher.ts:765-770,1342-1369。旧 head 已存在。
cap=1、同时出现 PR1/PR2 时,PR1 建群,PR2 返回 skip_rate_limited;代码仍提交 PR2 游标与 ETag。假时钟前进一小时后:
{"afterHourConditional":[{"action":"skip_not_modified","reason":"etag_304"}],"afterHourForcedActions":[],"createdGroups":[1]}即使强制全量 fetch,PR2 也因已是 known cursor 而没有动作。cap-skip 必须保留 pending 状态,不能按成功处理推进游标/ETag。
P1-4 — 现有配置有一项无效时,保存无关设置会清空凭据和全部规则
位置:src/server/settings.ts:273-275,431-435。旧 head 已存在。
真实 saveSettings 探针在原配置含 PAT + 一条 enabled rule、仅 service.port=0 无效时,保存 poll interval 补丁仍返回 ok:true,并从 defaults 写回:
{"before":{"hasPat":true,"repoCount":1},"after":{"hasPat":false,"repoCount":0,"pollIntervalSec":120}}已有配置解析/校验失败必须 fail closed;只有文件确实不存在才能使用默认配置,不能用默认值覆盖损坏配置。
P1-5 — Dashboard 保存无关设置会丢失只存在于 proxy.url userinfo 的凭据
位置:src/config/schema.ts:553-599。旧 head 已存在。
原配置 http://alice:[email protected]:8080 经 Dashboard 回传为去凭据 URL、空 username、password omitted 时,真实保存结果为:
{"before":{"hasProxyAuth":true},"saved":{"proxy":{"url":"http://proxy.example:8080"},"hasProxyAuth":false}}unrelated save 后代理认证被静默移除。应在应用 redacted patch 前迁移/保留当前 URL userinfo,除非用户明确清除或更改代理目标。
新增 P2 阻断
P2-1 — 损坏的 state.json 被当作空状态并覆盖
位置:src/state/store.ts:152-182。旧 head 已存在。
写入 group oc_original 和 dedup 记录后破坏 JSON,再 load()/update(),实测:
{"loadAfterCorruption":{"groupCount":0,"dedupCount":0},"persistedAfterUpdate":{"chatId":"oc_replacement","originalChatStillKnown":false,"dedupCount":0}}该行为会销毁用于防重映射与事件去重的最后一份状态。应在解析失败时 fail closed 或隔离原文件,只有 ENOENT 才返回空状态。
P2-2 — manual sync 等待旧 poll 后,仍使用禁用前的 stale rule 建群
位置:src/engine/watcher.ts:999-1011,1402-1425。旧 head 已存在;新 generation guard 未覆盖该入口。
旧 poll 阻塞时启动 manual sync,再禁用仓库并 reload。实测 reload 后 mode=dormant, enabled=false,旧 poll 无动作,但等待中的 manual sync 仍在新 generation 下发起第三次列表请求并返回:
{"mode":"dormant","actions":[{"prNumber":9,"action":"create_group","chatId":"oc_fake_9"}]}等待后及多 repo 每项执行前都应重新解析当前 rule/enabled,而不是复用等待前快照。
P2-3 — 分享链接幂等只检查前 100 条 issue comments
位置:src/github/client.ts:632-658、src/host/bridge.ts:748-755。旧 head 已存在。
将既有 marker 放在 comment 101/page 2,连续两次恢复调用真实 GitHubClient + HostBridge:
{"getPages":[1,1],"duplicatePosts":2}page 2 从未读取,两次 POST 都带同一 marker。需跟随分页直到找到 marker/遍历完毕,或持久化并核验 comment ID。
P2-4 — Dashboard 将 owner/repo#12junk 当作 PR12 执行非 dry-run 打开
位置:src/dashboard/index.ts:764-782。旧 head 已存在。
使用真实 Dashboard 组件的 stateful hook harness,输入 malformed spec 并点击真实 Open Review Group 控件,捕获到:
{"path":"/api/open-pr","method":"POST","body":{"repo":"owner/repo","prNumber":12,"dryRun":false}}应像 CLI 一样要求完整 /^\d+$/,不能 parseInt 接受数字前缀。
P2-5 — 新增 per-PR lock 会在 live owner 仍执行时因年龄过期
位置:src/host/bridge.ts:775-788、src/security/fs.ts:444-456。由本次修复增量引入。
锁使用 staleMs=90s,底层 dead || ageMs > staleMs 即使 PID 存活也删除锁。真实文件锁探针得到 firstPidAlive=true, secondAcquiredWhileFirstHeld=true;进一步用真实 HostBridge 将首个调用阻塞在消息扫描、假时钟前进 90.1 秒:
{"createCalls":1,"listCalls":2,"secondCompletedWhileFirstBlocked":true,"firstChatId":"oc_live_lock","secondChatId":"oc_live_lock"}第二个调用在第一个仍处于“互斥区”时完成全部剩余步骤,可能并发执行置顶、分享链接和状态更新。live-PID 锁不应只因年龄过期;需要 liveness + heartbeat/lease renewal 或 fencing。
P2-6 — 明确的 CLI 预创建失败会永久阻止后续 CLI 重试
位置:src/host/bridge.ts:725-729,900-910,1065-1075。由本次修复增量引入。
第一次 fake CLI 明确返回“working-dir 无效、chat.create 未调用”且无 chatId;第二次配置为可成功。实际却发生:
{"cliCalls":1,"errors":["...working-dir path does not exist; chat.create not called","Prior cli group creation attempt ... unknown outcome ... refusing ... retry create"]}createAttempt.outcomeUnknown 在 CLI 调用前写入,确定性的预创建错误没有清除它。fail-closed 的方向合理,但需要核心 CLI 提供结构化 definitelyNotCreated 结果,仅对这类结果清除 marker;不能把所有 nonzero/no-chat 都贸然视为未创建。
P2-7 — Active→active reload 会静默丢弃已经 202 接收的 queued webhook
位置:src/engine/watcher.ts:290-294,426-454、src/service/runner.ts:335-353。由本次修复增量引入。
将有效签名的 closed webhook 排在同 key blocker 后,HTTP 已回 202;仅把 poll interval 从 60 改为 61 并 reload。释放 blocker 后观测:
{"webhookStatus":202,"reloadOutcome":{"ok":true,"mode":"active"},"cursor":null,"persistedDelivery":null,"dedupInFlight":0,"webhookErrors":0,"queueAfter":{"active":0,"pending":0}}generation 使 queued action 中止,rejection handler 又故意不记错误/恢复。若该过渡后来已不能由 poll 看到,就会永久丢失。reload 应只取消需要失效的工作;已接收队列项需迁移/重放或返回可重试响应,不能先 202 再无声丢弃。
新增 P3
恰好整百 PR 的仓库会持续请求空终止页
位置:src/github/client.ts:521-596。
100 个 PR、page 1 无 rel=next、page 2 为空的稳定仓库,三次 poll 观测 page1Calls=3, page2Calls=3,后两次即使 notModified=true 仍请求 page 2,且 pageCount 永远为 2。未观测事件丢失,但这是持续额外请求和限流暴露。空终止页不应计入持久化 pageCount。
构建、运行时与卫生
npm run typecheck:通过。npm run build && npm run validate:通过。npm run test:unit:26/26;npm run test:integration:18/18。- 指定 head 的 GitHub Actions
test成功。 - 现行 core 环境服务 smoke:health 200、未鉴权 401、control token/HMAC 200、reload 200、正常关闭。
- 纯 dist runner 在 Node 24 与 Bun 1.4.4 均正常 dormant 启动、健康检查、0600 token 和退出。
- npm dry-run:12 个文件、185965 bytes;无 runtime dependencies、无 symlink、无
.nodeaddon。 - 文件 diff 与 dist 未检出真实 token、内部域名、真实员工姓名、内部群/用户 ID 或本机路径;命中凭据均为测试占位值。
请优先修复 P1-1 的幂等创建协议、dry-run 和配置/状态数据保护,再为上述新增时序补独立回归测试。当前测试全绿仍不足以判定可合。
- [P1-1] Keep createAttempt.outcomeUnknown fail-closed across empty GET /api/groups responses until unknownOutcomeSettleMs elapses (while immediately adopting delayed chats once visible), fail closed on malformed GET /api/groups or invalid/future startedAt, and forward idempotencyKey on create - [P1-2] Explicitly parse boolean CLI flags (--dry-run=true/false/1/0, --json) and reject invalid boolean values, unknown flags, and unexpected positional arguments with exit code 1 - [P1-3] Defer knownPrs cursor and ETag advancement whenever a PR hits skip_rate_limited (hourly creation cap on poll or opened/ready_for_review/reopened webhook) so deferred PRs automatically retry after cap expiry - [P1-4] Fail closed in loadExistingConfigStrict() and normalizeAndValidateConfig() on corrupt, non-object, wrong-typed, or symlinked config.json instead of overwriting PATs and rules with defaults - [P1-5] Preserve and migrate credentials stored only in proxy.url userinfo across redacted Dashboard saves while allowing explicit clearPassword, password rotation, and username edits - [P2-1] Fail closed with StateCorruptError on corrupt or wrong-typed state.json (returning empty state only on ENOENT) without overwriting the original file - [P2-2] Re-resolve live rule/enabled after waiting on in-flight polls (using a while loop) and before each repo in sync() - [P2-3] Paginate all issue comment pages with early-stop marker matching and persisted shareLinkCommentId verification for postShareLinkToPr idempotency - [P2-4] Validate PR numbers with strict /^\d+$/ + Number.isSafeInteger and valid owner/repo slugs across Dashboard, CLI parsePrSpec, watcher.openPr, and runner /api/open-pr - [P2-5] Prevent live-PID per-PR locks from expiring by wall-clock age alone; keep the exclusive FileHandle open for inode-verified in-place utimes() lease renewal serialized with release() plus pre-create fencing - [P2-6] Clear createAttempt.outcomeUnknown only for deterministic pre-create CLI validation failures (structured chatCreated:false/definitelyNotCreated, ENOENT/EACCES, or anchored pre-create errors with zero chatId in stdout/stderr and non-killed exit), keeping ambiguous CLI failures fail-closed - [P2-7] Preserve already-202-accepted queued webhooks across active->active reloads using live repo rules while still aborting cleanly on active->dormant or repo disable - [P3] Do not count empty terminal pages in persisted pageCount and accurately mark per-page hasNonEmptyNextPage so exact-100/200-PR repos stop polling empty trailing pages Co-Authored-By: Claude Code <[email protected]>
第三轮独立复审结论:不可合(head
|
- [P1 #1] Strictly validate all existing config and incoming patch field types (especially repo rule boolean/array/enum/number fields, nested objects, null scalars, and secret patches) before normalization so wrong-typed configs/patches fail closed without overwriting stored settings - [P1 #2] Distinguish maxPages-capped pagination ('unknown_capped') from verified terminal pages ('verified_terminal') using explicit 1-based page numbers, separate skipCacheWrite (dryRun only) from bypassEtag, sync persistedEtag/previousTruncated, and handle single-page 304 Link transitions so 304 never flips truncated true->false - [P2 #3] Align CLI pre-create error classifier with real Botmux core production stderr formats (EN & ZH --working-dir, --bot, --chat-mode, --kickoff-bot 与/未匹配到/匹配到多个, and assertTurnTransportOrExit) and test against real production strings - [P2 #4] Fail closed with StateCorruptError on non-string values inside processedEvents/processedDeliveries as well as invalid schemaVersion, repos/prGroups entries, and wrong-typed service.* fields - [P2 #5] Record and verify durable process-start + Linux boot_id identity (including PID 1 in containers, zombie/dead state detection, and transient probe safety) in lockfile payloads so PID-reused orphan locks are reclaimed while genuine live owners remain protected - [P2 #6] Add per-repo lifecycle epochs incremented on disable/removal/re-enable (and preserved across active->active reloads and rolled back on reload failure) to prevent pre-disable queued webhooks from running after disable -> re-enable Co-Authored-By: Claude Code <[email protected]>
第四轮独立复审结论:不可合(head
|
| 上一轮问题 | 独立复验结果 |
|---|---|
| P1:repo 字段 wrong-type fail-closed | 原配置含 enabled:"true"、memberBotAppIds:"cli_reviewer2"、triggerOn:"opened" 时,真实 saveSettings() 现在返回 {ok:false}、replaceCalls=0,三个原始字段和 pollIntervalSec=60 均保持不变,不再规范化覆盖。 |
| P1:maxPages 截断分页 | 300 个 open PR、maxPages=2,首轮为 truncated:true;第二轮 page 2 返回 304 且无 Link 后仍为 truncated:true、pulls=200,不再翻转成完整扫描。 |
| P2:真实核心 CLI 预创建错误 | 将生产格式 --working-dir Directory does not exist: ... 送入真实 HostBridge,第一次错误被识别为确定性预创建失败;第二次实际执行 CLI(cliCalls=2),清除 createAttempt 并进入 active,不再永久锁死。 |
| P2:dedup map 非字符串值 | 数值型 processedEvents/processedDeliveries 现在使 load 和 update 均抛 StateCorruptError,原始文件字节完全不变,不再擦除后持久化。 |
| P2:PID 复用与 live owner | 用无关 live child PID 构造十分钟前孤儿锁,现在在 500ms 内成功回收;对照真实 live owner 时第二把锁仍失败、nonce 不变,owner release 后正常删除。50 轮 renewal/release/handoff 也通过。 |
| P2:disable→re-enable 重放 | 原 queued closed webhook 场景现在 closeMessages=0、群保持 active、cursor 保持 open,旧 delivery 不提交;active→active 对照仍正常写入 closed cursor 和 processedDelivery。 |
相邻回归检查
- 扩展分页模型通过:empty、exact-100、100→101、exact-200、200→199、exact-300、缩页、终止页删除与后续 304 均符合预期。
- 锁的 inode fencing、 renewal/release、新 holder 保护通过;live owner 不会因 wall-clock age 被抢锁。
- #3830 master
ea051dc634的真实 parser/matcher 继续将/events正确映射到/webhooks/github;缺失/错误 Bearer=401,正确=200,webhook token 访问控制 API=401,Phase 1 无 host token 场景保持兼容。
新增 P1 — Page-1 304 的 terminal-Link 转换会吞掉旧后续页的关闭 reconcile
位置:src/github/client.ts:523-527,592-598;watcher 的提前返回位于 src/engine/watcher.ts:1199-1214。
此前非截断的两页仓库中,anyPageModified 只在 previously capped 时强制为 true。若 page 1 从缓存的 rel="next" 在 304 中转为明确 terminal Link,新 hasMore 会直接跳过 page 2,返回 notModified=true, pulls=[]。真实 GitHubClient + loopback fake 的场景:
- 首次:page 1 为 100 PR 且带
rel="next",page 2 有 PR101,pageCount=2, truncated=false。 - 第二次:page 1 返回相同 ETag 的 304,但 Link 改为
rel="first";旧 page 2 应为空。 - 实测:
notModified=true, pulls=[], pageCount=1,且page2Calls停在首次的 1,没有再次检查/淘汰旧 page 2。
{"second":{"notModified":true,"pulls":[],"truncated":false,"pageCount":1},"page2Calls":1}watcher 因 notModified 提前返回,旧 page 2 消失的 PR 不会被关闭或 reconcile;后续 page-1 304 可让状态持续卡住。此前版本的对应分支会重新验证 page 2,因此这是本次分页修复的增量回归。应把任何 cached has_next/unknown_capped → explicit-terminal 转换视为修改,返回可重建的 page-1 数据并处理/淘汰旧后续页,而不是直接 notModified 返回。
构建、打包与卫生
npm run typecheck:通过。npm run build && npm run validate:通过。npm run test:unit:26/26;npm run test:integration:36/36,合计 62/62。- 本轮 6 项 boundary 回归文件额外连续运行 5 轮,全部通过。
- 纯 dist runner 在 Node 24 与 Bun 1.4.4 均正常 dormant 启动、健康检查 200、0600 token 和正常退出。
- npm dry-run:12 个文件、205902 bytes;无 runtime dependencies、无 symlink、无
.nodeaddon。 - 文件 diff 与 dist 未检出真实 token、内部域名、真实员工姓名、内部群/用户 ID 或本机路径;命中的凭据均为测试占位值。
- 两个受保护主目录与复审 worktree 均保持 clean;未合码、未发 npm、未部署。
本轮使用真实组件与本地假服务验证,没有执行真实 GitHub/飞书线上建群。六项上一轮问题虽已闭合,但上述 P1 会造成持久状态漏更新;请先修复并补充分页 Link-transition 回归测试,再评估合并与灰度。
…tion as modified and evict stale trailing pages - Treat any cached has_next / unknown_capped / multi-page / trailing-cache -> explicit terminal Link transition on 304 (for both page 1 and page 2+) as anyPageModified=true so watcher reconciles and closes disappeared trailing-page PRs instead of returning notModified:true early - Evict all stale cached pages beyond terminal pageCount on shrinks (2->1, 3->2, 3->1) so subsequent steady-state 304 polls cleanly return notModified:true without hitting dead pages - Add end-to-end regressions covering 2->1 watcher close reconcile + steady-state 304, 3->2 via page-2 304 terminal Link, 3->1 via page-1 304 terminal Link, and maxPages=1 capped->terminal->steady-state 304 Co-Authored-By: Claude Code <[email protected]>
第五轮聚焦终核结论:可合(head
|
Summary
Implements the official
@botmux-ai/plugin-githubplugin for Botmux: GitHub PR event monitoring and crash-safe automated Botmux review group creation (Feishu / Lark), ready to run on current Botmux core (Phase 1 zero-core-change) and automatically forward-compatible with upcoming Botmux core IPC/webhook/dashboard enhancements.Highlights
Node 22+& StandaloneBunBinary)package.json:@botmux-ai/plugin-github,botmux.schemaVersion: 1,id: "github",service.mode: "auto",files: ["dist/"],publishConfig.registry: "https://registry.npmjs.org/", zero runtimedependencies.esbuildESM bundles (dist/service/{index,runner}.js,dist/dashboard/index.jsusing hostapi.react,dist/server/settings.js,dist/cli/{index.js,commands.json},dist/webhooks/index.json,dist/package.json) with atomic directory swap anddist/botmux-build/stampwritten last.mode: "dormant") with zero GitHub API calls and zero Feishu/Lark calls until at least one repository watch rule is enabled; supports livedormant <-> activeconfig hot-reload without restart.node:cryptoRS256 JWT + customapiBaseUrlfor GHES), and in-memorygh auth tokenfallback with single 401 refresh retry.If-None-MatchETag 304 zero-quota polling (keyed byapiBaseUrl+ auth principal fingerprint), independentcore/search<10%throttling,429/403secondary rate-limit backoff (Retry-After-> coreX-RateLimit-Resetwhenremaining == 0->1m..1hmonotonic exponential backoff), fail-closed outbound proxy + HTTPCONNECTTLS tunneling, SSRF/redirect defense, and dual-layer secret redaction.github:open-pror Dashboard action only).127.0.0.1:<port>/webhooks/githuband/webhook/plugin/github/events) enforcing>=32Bhigh-entropy secrets,<=1 MiBstreaming body limits, raw-bytetimingSafeEqualX-Hub-Signature-256verification before JSON parsing, repo allowlist, and boundedX-GitHub-Deliverydeduplication — feeding into a shared FIFOPerPrSerialQueue.<at>/@all) and XML-escaped inside<untrusted_pr_metadata ...>with fail-closedis_forkandmaintainer_can_modifyflags, never interpolated into shell argv.node:http127.0.0.1loopback IPC (immune to Bunfetch$http_proxy403) with~/.botmux/.dashboard-secretHMAC auth.creatinglock -> anchoredGET /api/groupsduplicate prevention ->POST /api/groups/create(dual-core kickoff + immediatechatIdpersistence even on partial502+botmux create-groupCLI fallback) ->kickoffMessageIdreadback verification -> dual-path top-notice (POST /api/groups/:chatId/top-noticewith brand-awareopen.feishu.cn/open.larksuite.comOpen API fallback, neverlark-cli --as user) -> optional idempotent PR share-link comment &onNewCommit/onPrClosedupdates.#/plugins/github), Write-Only0600Settings & CLIapi.reactandapi.listBots(), supportsapi.serviceFetch/api.requestServicewith graceful fallback togetSettings/saveSettings, write-only secret handling, full rule CRUD, auth test, rate-limit health, and PR->group mappings.github:status,github:sync [--repo] [--dry-run],github:open-pr <owner/repo#N> [--dry-run],github:test-auth.docs/plugin-market-entry.json(matchingbotmux-ai/plugin-marketschema) and bilingual EN/ZHREADME.md.Test Plan
npm run typecheck(tsc --noEmit) — 0 errorsnpm run build && npm run validate— self-containeddist/verified with zero symlinks and standalone temp-dir import checksnpm run test:unit— 26/26 passed (ETag 304/bypass/pagination, rate-limit<10%&1m..1hbackoff, PAT/App/GHES/ghauth, real HTTPCONNECTTLS proxy & fail-closed 407, SSRF/redirects, webhook raw-byte HMAC/1 MiB/dedup/anti-CSRF, FIFO queue,<untrusted_pr_metadata>escaping, secret redaction,0600/O_NOFOLLOW/symlink fs checks)npm run test:integration— 8/8 passed (dormant default zero-request, first-run baseline zero-storm, draft->ready, webhook+poller serial queue,onNewCommit/onPrClosed, HostBridge dual-core/Feishu+Lark/502+crash resume/readback rejection/CLI fallback/idempotent PR comment, settings/dashboard/CLI end-to-end)npm pack165.2 kB ->npm install --ignore-scripts --omit=dev-> isolateddist/run under both Node v24.22.2 and Bun 1.4.4)parsePluginPackageManifestandscanPluginContributions🤖 Generated with Claude Code