[E2E-TEST] PR Review 验证 (webhook fixed) #30

Closed
pangtong-fujunshi wants to merge 67 commits from test/e2e-pr-1781107530 into main
Member

验证 pull_request + pull_request_review webhook。

⚠️ E2E 测试。

验证 pull_request + pull_request_review webhook。 ⚠️ E2E 测试。
pangtong-fujunshi added 67 commits 2026-06-10 16:05:33 +00:00
auto-sync: 2026-06-09 11:57:58
CI / lint (push) Failing after 8s
CI / test (push) Has been skipped
CI / lint (pull_request) Failing after 6s
CI / notify-on-failure (push) Successful in 0s
CI / test (pull_request) Has been skipped
CI / notify-on-failure (pull_request) Successful in 3s
8085a71d9f
1. 触发器:去掉 push,只保留 pull_request(opened, synchronize)
   - 每次 push 到 PR 分支不再跑 2 次 CI
2. notify-on-failure:只有明确的 failure 状态才发通知
   - 之前:空状态/unknown/pending 都触发通知(误报根因)
   - 现在:只有 STATUS=failure 才发通知
3. venv 路径:统一用 /tmp/ci-venv-lint 和 /tmp/ci-venv-test
   - 避免 host 模式下与开发目录 .venv 冲突
根因:notify-on-failure job 通过 commit status API 查询结果时,
自身的 pending status 会污染查询结果(竞态条件):
1. lint/test 都 success
2. notify 开始运行,自身状态 pending 写入 commit status
3. notify 查询 commit status → 看到 pending(自己的)≠ success
4. 误发 [CI] 失败 评论 + webhook 触发 Mail 通知

修复方案:
- 不再查询 commit status API
- 直接用 needs.lint.result 和 needs.test.result 判断
- 只有明确的 failure 才发通知
- 同时去掉 push 触发避免双倍运行
- crashed outcome cooldown 60s(vs 其他 300s)
- import init_db
- whitespace/lint fixes
All changes reviewed and APPROVED in PR #12 (Review ID: 40):
- toolchain_routes: webhook repo/org format compat, content dedup (sha256), closed issue filter
- dispatcher: inform mail crash 误标 done 修复
- ticker: cleanup and improvements
- healthz endpoint
- conftest: integration/e2e deselect markers
- docs: design docs, test-guide updates
- various lint/whitespace fixes across 30 files
exit=0 means process exited normally. Trust the exit code regardless
of stdout/JSON output or task_status. Old logic misclassified inform
Mail completions as agent_error, causing infinite retry loops.

Includes test update: test_task_status_pending expects completed.
Merge old A12/A13 into single A13 revised: trust exit_code=0
regardless of stdout/JSON output. Old logic caused inform Mail
infinite retry loop.
PR #14 从旧分支复制文件导致回退了 PR #10 的 lint 修复。
修复内容:
- autoflake 移除未使用导入/变量
- autopep8 修复缩进/空格
- 手动修复 F821(pathlib→Path), F541(f-string), F841(未使用变量)
- 所有修复均通过 flake8 --max-line-length=120 --extend-ignore=E501 检查 (0 errors)
仓库没有 requirements.txt,deploy workflow 每次 push 到 main 都报错。
改为与 ci.yml 一致的方式:/tmp/ci-venv + 直接 pip install 依赖。
deploy 时 TypeScript 编译报 TS2339: Property 'resumed_from' does not exist on type 'V2Task'。
DB 表有此字段但 TS interface 遗漏。
根因: test_e2e_v27.py 的 skipif 只标记了函数级别,pytest collection 阶段
仍会 import 该文件,触发 sys.path.insert 指向安装目录的 spawner.py。
如果安装目录有 merge conflict 残留,整个 test job crash。

修复: 将 skipif 加入 pytestmark 级别,collection 阶段即跳过。
TypeScript: resumed_from 是 string|null,StatusButtons 期望 string|undefined。
用 ?? undefined 转换。
§19 上下文四层改造方案(原独立文档 #19)合并到 #13 工具链设计文档末尾。
v3.1 → v3.3。两个专题本就是一个整体,分开维护增加认知负担。
- task_type_registry.py: TaskTypeHandler Protocol (10方法+2属性) + TaskTypeRegistry 注册表
- prompt_composer.py: PromptSection Protocol + PromptContext dataclass + PromptComposer 拼装器
- 零依赖,纯新增文件,不影响现有功能
- base_task_handler.py: 基类统一4步流程(crash→verify→mark→notify)
- task_handler.py: 5 PromptSections + 三信号验证 + review流程
- mail_handler.py: 3 PromptSections + inform/request区分 + 基类统一流程
- toolchain_handler.py: 3 PromptSections + 模板引擎渲染 + Mail API通知
- 背靠背设计-编码一致性检查通过(4严重已修/6轻微保留)
引擎接入(dispatcher/spawner/ticker → handler 统一路由):
- dispatcher: guardrail/on_checks_passed/on_complete → handler 查询
- spawner: _build_prompt/_build_api_section → handler.build_prompt
- ticker: 虚拟项目扫描/assignee/claimed/review/幻觉门控 → handler 判断

Handler 缺陷修复:
- H1: _mark_task_status 加 3 次重试(防 DB 锁)
- H2: review @mention 加 comment_type='review'
- H3: review 非 approved 保持 review 状态(不标 working)
- S3: 通知链接改 Gitea(PR/Issue/Commit)

审计修复:
- D1: pre_spawn 返回值未检查 → 加 if not 抛 RuntimeError
- D2: PromptContext 缺 from_agent/mail_type → 从 must_haves 解析
- D5: _check_reply 查错表 → 恢复查 tasks 表找 in_reply_to

旧方法保留未删(deprecated),确认稳定后再清理。
- S1: vp_name 硬编码字典 → handler.display_name 属性
- S2: ticker/spawner 中 TaskTypeRegistry 局部 import → 移文件顶部
- W1: TaskHandler executor verify 失败不调 on_failure 加注释说明
基于庞统+司马懿背靠背 review,修复 6 个问题:

P0 致命:
- A1: _legacy_on_complete 补回 review verdict 处理(approved→done,非 approved→@mention assignee)
- A2: 添加 TaskTypeRegistry.register() 启动初始化(注册 Task/Mail/Toolchain handler)

P1 中等:
- B11-1: RoleSkillSection 从索引提示改为全文注入(对齐设计 §2.3 + BootstrapBuilder 行为)
- A8: retry prompt is_mail 硬编码改走 TaskTypeRegistry handler 判断

P2 低:
- _mail_* 4 个方法添加 DEPRECATED 注释
- ticker.py handler check_completion 代码块缩进对齐(28→24 空格)

测试:394 passed, 0 failed
Review reports: docs/design/review-v3-vs-head-{pangtong,simayi}.md
get_connection 已在文件顶部 L22 import(from src.blackboard.db),
闭包内 L258 错误地 from src.daemon.db import(模块不存在),
会触发 ImportError 被 try/except 吞掉导致 review verdict 逻辑不生效。

司马懿 review 发现。
与 bootstrap.py 保持一致,支持 MOZI_SKILL_PATH 环境变量覆盖。
默认值不变。
[E2E-TEST] PR opened webhook 验证
CI / test (pull_request) Has been skipped
CI / lint (pull_request) Failing after 7s
CI / notify-on-failure (pull_request) Successful in 1s
d41b27c91d

[CI] 失败

分支: 30
触发 commit: d41b27c91d1915e5a1180af5548ef3dd1f468a30
失败 Job: lint
请检查 CI 日志并修复。

[CI] 失败 分支: 30 触发 commit: `d41b27c91d1915e5a1180af5548ef3dd1f468a30` 失败 Job: lint 请检查 CI 日志并修复。

[CI] 失败

分支: 30
触发 commit: d41b27c91d1915e5a1180af5548ef3dd1f468a30
失败 Job: lint
请检查 CI 日志并修复。

[CI] 失败 分支: 30 触发 commit: `d41b27c91d1915e5a1180af5548ef3dd1f468a30` 失败 Job: lint 请检查 CI 日志并修复。
simayi-challenger reviewed 2026-06-10 16:06:57 +00:00
simayi-challenger left a comment
Member

E2E 验证确认

此 PR 为 E2E 测试(验证 PR Review webhook 链路),非功能性代码变更。

链路验证结果

  • PR opened → toolchain webhook 触发
  • toolchain 发 Mail Review 请求给 simayi-challenger
  • simayi 收到 Mail 并响应
  • simayi 提交 Gitea Review(你正在看这条)

结论:Webhook 链路端到端验证通过。

⚠️ 此 PR 不应合并到 main(内容为 main 的镜像复制,用于触发 E2E 测试)。请关闭 PR。

— 司马懿

## E2E 验证确认 此 PR 为 E2E 测试(验证 PR Review webhook 链路),非功能性代码变更。 **链路验证结果**: - ✅ PR opened → toolchain webhook 触发 - ✅ toolchain 发 Mail Review 请求给 simayi-challenger - ✅ simayi 收到 Mail 并响应 - ✅ simayi 提交 Gitea Review(你正在看这条) **结论**:Webhook 链路端到端验证通过。 ⚠️ 此 PR 不应合并到 main(内容为 main 的镜像复制,用于触发 E2E 测试)。请关闭 PR。 — 司马懿
simayi-challenger approved these changes 2026-06-10 16:07:27 +00:00
simayi-challenger left a comment
Member

E2E 验证:APPROVED review 提交测试。

— 司马懿

E2E 验证:APPROVED review 提交测试。 — 司马懿
Some required checks failed
CI / test (pull_request) Has been skipped
CI / lint (pull_request) Failing after 7s
Required
Details
CI / notify-on-failure (pull_request) Successful in 1s

Pull request closed

Sign in to join this conversation.