Skip to content

finals: multi-agent rework mechanism, DB migration verification gate (LOCAL_REAL_SQL), RAG eval loop, reliability comparison [draft] - #230

Merged
nghqqa merged 35 commits into
mainfrom
feat/finals-organizer-response
Sep 16, 2026
Merged

nghqqa merged 35 commits into
mainfrom
feat/finals-organizer-response

Conversation

@nghqqa

@nghqqa nghqqa commented Sep 15, 2026

Copy link
Copy Markdown
Owner

决赛优化:多 Agent 返工机制、数据库迁移验证闭环、RAG 评估闭环、可靠性对照(草稿)

状态:Draft。合并前审查(六项)仍在进行,后续发现将以追加提交推到本分支。本 PR 声称“全部测试通过”或“完整真实链路已完成”——每一项都标注证据等级。

变更概览(15 个提交,基线 origin/main@db5944a

方向 内容 证据等级
数据库迁移安全 m9 迁移:data_baselines / migration_candidates / migration_verifications / approval_verification_bindings 4 张不可变子表,mv_* 幂等登记/回写函数,l2_bind_verificationdb_release_gate(11 项检查,每次重算),l2_claim_ticket 6 参签名在授权执行点强制过闸(绑定票据缺目标数据摘要 → 拒绝;登记过迁移候选却未绑定 → 拒绝;STALE / 摘要变化 / 未批准 / 过期 → 拒绝且票据不进入 EXECUTING)。tools/dbverify/ 纵向环路 runner + 规范数据摘要 data_digest.py;网关 gateway.py 透传 release_data_digest(不进 args_hash)并把 DB 侧拒绝映射为 DENY DB_RELEASE_GATE_REFUSED;迁移方案包 release/migration-plans/orders-schema-change/candidate-a.rev2/ LOCAL_REAL_SQL —— 在独立 PostgreSQL 16 克隆库上真实执行(evidence/FINALS-DB-MIGRATION-LOOP-20260914:20 步 / 27/27 负向 / 闸门时间线 8 步 / 签名 0689f544… 两次一致)。不是 Agentic Database / PolarDB 验证
多 Agent 返工 tools/agentteams/rework_loop_harness.py:真实 Workflow Controller + PG 状态机 + 真实验收测试;VERDICT 由测试结果决定,FAIL → 控制器退回 Fixer(outbox 事件)→ 修复后重验;连续 3 次 FAIL → HOLD 转人工 CONTROL_PLANE_MECHANISM —— Agent 输出受控(非真实 LLM);evidence/FINALS-REWORK-LOOP-20260914:34 事件 / 23 检查。Element 上的真实交接与真实模型输出尚未执行(授权清单见 docs/决赛优化/03
RAG 评估闭环 观测(tool-span)→ 标注 18 语义族 54 查询 → 按族切分调优/held-out → v1→v2(bigram-idf-hash4096)→ 单次回测;v2 设为演示默认,RAG_STRATEGY 可回切 REAL_EXECUTED(SYNTHETIC 语料、小样本):held-out hit@1 75.0% → 91.7%,MRR 0.861 → 0.958,退化 1 条如实列出
可靠性对照 benchmark/reliability/:长/跨文件、小上下文、对抗注入、干净长 diff、伪造审批 5 个夹具的确定性层对照 REAL_EXECUTED(SYNTHETIC 夹具):5/5 决策、0 误报 0 漏报、人工介入 0.8;模型轴 NOT_EXECUTED(付费调用未授权)
演示平台 /rework 页、/pr4 真实 SQL 证据回放 + 版本绑定人工门(旧版本再批准 → 409 STALE_VERSION)、/rag 390px 溢出修复;selftest 54 → 61 PR#4 三候选对照为 SYNTHETIC(REPLAY overlay,NO RUNTIME WRITE)
文档 docs/决赛优化/00–05:事实核验表、评委意见响应(含三轮收口)、PPT 压缩指引、Element 真实交接授权清单、Agentic Database 资源确认单、工作区只读盘点 文档

明确未执行 / 未完成

  • Element/Matrix 上同一 PR 的真实 Reviewer→Fixer→Verifier 交接:未执行(需启动 AgentTeams 栈 + 逐项授权)。
  • 真实 LLM 驱动的返工与模型轴对照:未执行(付费调用未授权)。
  • PolarDB Agentic Database 分支验证 / 生产受控执行:未执行(NOT CONNECTED;资源确认单 docs/决赛优化/04)。
  • PR#4 三候选对照:合成回放,不是真实运行。

测试实况(HEAD 2c579fc,Windows 宿主)

套件 解释器 结果
tests/dbverify tests/isolated_live tests/release_delivery tests/gh_app tests/agentteams tests/reliability tests/rag(同一进程组合运行) Python 3.9.25 1815 通过 / 3 失败 / 15 跳过(在 3714c2e 运行;此后仅改动可靠性夹具 token 与证据)
tests/dbverify tests/agentteams tests/isolated_live tests/release_delivery(真实 mcp 导入,gateway_wrapper_mode=MODULE_IMPORT conda goai Python 3.10.21 / mcp 1.28.1 949 通过 / 0 失败 / 9 跳过
tests/reliability tests/skills(夹具改动后复跑) Python 3.9.25 83 通过
demo-platform npm run selftest Node 61 通过 / 0 失败

跳过项均为显式前置条件(EPHEMERAL_PG_VERIFYM8A2D_DRILL、tomllib 3.11+、Linux 防火墙命名空间、Python 3.9 下 mcp 缺失时的网关包装单测)。

3 个失败的基线证据(宿主环境,非本分支引入)

tests/gh_app/test_e2e_cli_wiring.py::TestStatusStopCleanupWiring::{test_status_routes_e2e_session, test_stop_routes_e2e_session, test_cleanup_routes_e2e_session_report_only} 返回 rc=3:

{"command": "status", "status": "failed", "code": 3,
 "error_code": "DISTRO_NOT_REGISTERED",
 "error_detail": "MergePilot-Test is not in `wsl -l -v` (set MERGEPILOT_WSL_DISTRO to a registered distro)"}
  • 本机 wsl -l -v 仅有 docker-desktopUbuntu-22.04MergePilot-Test 发行版已在 PHASE14 退役(已归档),本 PR 不恢复它。
  • 本分支对 tools/cli/mergepilot.py 的唯一改动是把 m9_migration_verification.sql 加入 AUDIT_DB_MIGRATION_CHAIN(5 行);tests/gh_app/test_e2e_cli_wiring.pytools/cli/e2e_lifecycle.pyorigin/main 完全相同。
  • 这三个用例 mock 了 docker 层(discover_stack 等)但没有 mock WSL 层的 wake_if_dormant 前置检查;其定性(宿主集成测试 vs 隔离不完整的单测)与处理在审查中,不会通过无条件跳过或放宽断言解决。

本分支修复的既有测试问题(根因修复,非改断言)

  • 3 个 compose digest 断言:测试现在编码 f167762 之后的真实策略(pgvector 以可离线加载 TAG 运行,注册表 digest 通过 MERGEPILOT_DECLARED_PG_IMAGE 声明并由 preflight 闸门校验,release/images/image-set.json 为唯一真值)。
  • 同一解释器组合运行的隔离问题:run_migration_loop 不再泄漏 sys.path/POLICY_FILEtest_m8a2a 的 mcp 桩改为模块级 setUp/tearDown;test_phase1d 自带 mcp.types 替身。
  • 可靠性对抗夹具中的合成 Slack token 触发 GitHub Push Protection(形似真实 token):改为仓库既有测试惯例 xoxb- + 24 字母,仍命中 SECRET_SLACK_TOKEN 规则;证据重新生成,确定性层结果逐项不变。

合并前审查(已完成,结论见 tools/dbverify/README.md「合并前审查结论」)

问题 结论
1. 绕过闸门(不绑定验证) 登记过迁移候选的 run,其票据未绑定验证 → claim 拒绝(MIGRATION_VERIFICATION_REQUIRED);普通 PR 行为不变。残余边界如实记录:候选登记是流水线责任,未登记的 DB 变更仅受 risk_classify L2 人工门约束
2. 摘要缺省/伪造/过期 缺省 → TARGET_DATA_DIGEST_REQUIRED;伪造(不等于基线)→ TARGET_DATA_DIGEST_MISMATCH;过期票据 → TICKET_EXPIRED;三者均拒绝且票据不进 EXECUTING
3. 可信测量与目标绑定 摘要由可信执行方在目标库现算(与基线同算法);数据库只能比对、不能证明测自目标库——该信任边界写进方案包 README,不为此新增 DB 机制;preflight 基线画像为目标库的内容级佐证
4. claim→执行版本变化 数据侧:迁移前再算摘要(漂移即停)。版本侧(本轮新增负向):db_release_gate 接受 EXECUTING,迁移前重跑闸门 → claim 后新提交 STALE_SUPERSEDED_BY_NEW_REVISION
5. 签名/重载/权限 m9 DROP 旧 5 参 + 6 参(第 6 参 DEFAULT NULL)+ 自检“恰好一个”。修复tools/m3b-b4-create-roles.sh 旧签名授权升级后必失败 → 双签名 allowlist + to_regprocedure 存在性判断
6. 新装 vs 升级 新增 PG-gated 对等测试:001-init.sql 全量 vs「12 个 m9 前文件+旧式授权+独立 m9」→ m9 面函数定义/owner/ACL/表结构完全一致;网关角色可 claim、approver 被拒(对旧角色脚本该测试失败)

测试实况更新(HEAD d27a2bc

  • Python 3.9 组合运行(dbverify + isolated_live + release_delivery + gh_app + agentteams + reliability + rag):1822 通过 / 0 失败 / 15 跳过 —— 原 3 个 DISTRO_NOT_REGISTERED 失败定性为隔离不完整的单测_entry_wake 文档明确替身应无 wake 方法,同文件 6 处已 mock WslDocker,这 3 处遗漏),已补替身,断言零改动。
  • DB 闭环证据重生成(带标签临时 PG,运行后清理):20 步 / 28/28 负向 / 闸门时间线 10 步,签名 b60b328c… 两次一致,网关 MODULE_IMPORT(goai / mcp 1.28.1)。

m4b–m7 里程碑套件核验(2026-09-15 补充,HEAD f0424c6

在本机与 origin/main 干净工作树各跑一遍 tests/{m4b,m4c,m4d,m4e,m4f1,m5_0,m5_0c,m5_0d,m7_rag_benchmark,rag,skills}--import-mode=importlib)对照:

  • 分支 989 通过 / 43 失败 / 4 跳过;origin/main 同机 988 通过 / 44 失败 / 4 跳过
  • 43 个失败与 main 的失败同名同数(m5_0c bash 解析器夹具 ×38、m4c runner profile ×3、m4e ×1、m4f1 ×1)——本机环境既有,非本分支引入。
  • 本分支修复了其中 1 个 main 也有的失败(m4b 夹具被 autocrlf 检出改成 CRLF:.gitattributes 新增 tests/**/fixtures/** -text 并恢复 11 个文件),并修复了本分支曾引入的 4 个交付清单失败(test_m9_upgrade_parity_pg.py 未登记进 m5_0b_delivery_required.txt,面数 132→133)。

数字联动(供答辩口径)

审计域表 29 → 33;迁移文件 13 → 14;selftest 54 → 61;RAG 嵌入 hash-bow-256 → v2-bigram-idf-hash4096

…vertical loop (finals D2)

- tools/audit-db/m9_migration_verification.sql: 4 immutable child tables on revision_bindings/approvals
  (data_baselines, migration_candidates, migration_verifications, approval_verification_bindings),
  mv_register_*/mv_record_verification (idempotent callbacks), l2_bind_verification, db_release_gate
  (recomputed on every call; stale on new revision / target data digest mismatch)
- offline db-init 001-init.sql + CLI AUDIT_DB_MIGRATION_CHAIN carry m9 (fresh bootstrap: 33 tables)
- tools/dbverify: orders-schema-change case + run_migration_loop.py (code tests PASS -> migration FAIL 23502
  on historical data -> context fetch -> candidate rev2 PASS 11/11 -> version-bound approval -> STALE after
  follow-up commit; 15 negative tests) on an ISOLATED_POSTGRES clone; not an Agentic Database branch
- release/migration-plans: plan package generated from the verified candidate (preflight/migrate/postcheck/rollback)
- tests/dbverify: SQL contract, helper mirrors, PG-gated full loop
- evidence/FINALS-DB-MIGRATION-LOOP-20260914 (SHA256SUMS)
Real controller.process_event + real PostgreSQL + real acceptance tests decide every VERDICT:
review -> fix#1 -> verify FAIL -> send back to Fixer -> fix#2 -> verify PASS; retry cap HOLD;
BLOCKED escalation; invalid inputs. Agent semantic output is controlled input (no LLM, no Matrix/Element).
Evidence: evidence/FINALS-REWORK-LOOP-20260914 (patches, test logs, stage_events chain).
…te strategy v2 (finals D3)

rag.mjs: pure buildIndex/scoreChunks with parameterised strategies (v1 kept byte-identical).
experiments/rag-loop: 18 intent families / 54 labelled queries split by family; tuning-only grid;
single held-out backtest (hit@1 75.0% -> 91.7%, MRR 0.861 -> 0.958, 1 regression) -> v2-bigram-idf-hash4096.
Evidence: evidence/FINALS-RAG-LOOP-20260914 (report.json byte-reproducible).
… context, adversarial, clean, fake approval)

Deterministic layer (diff_parse/risk_classify/sast_scan) executed: 5/5 decisions, 0 FP/FN, protections OK.
Model layer NOT_EXECUTED (paid API calls need authorization); runner records the reproduce command.
…te; /rework page; selftest 61

- GET /api/pr4 side-effect free (simulated comparison computed once); real_sql_loop, gate, runtime_metadata
- POST /api/pr4/approval|followup|reset: REPLAY overlay bound to (verification_id, head_sha), 409 on stale/rejected
- GET /api/rework-loop, GET /api/finals/evidence, health.finals (evidence tiers + SHA256 integrity)
- frontend: Pr4Page restructured, new ReworkPage (/rework), mobile wrap fixes; dist rebuilt
- data-contract v1.1 (3 cases, critical, CWE-78, finals endpoints) + drift-check selftest
- .gitignore: demo-platform/frontend/node_modules
…ivery-surface registration

- docs/决赛优化: fact table, judge-feedback response (implementation/evidence/boundary/open items), PPT guidance
- README: HiClaw wording, RAG strategy v2, ISOLATED_POSTGRES row, finals loops table, selftest 61
- tests/demo_console: README test-count assertion aligned with the documented command (1490)
- tests/m5_0: finals formal files registered in the M5-0B delivery surface (95 -> 130), manifest regenerated
…an-out keeps the PG-gated test out of release/

- run_reliability.py wrote CRLF via write_text on Windows, breaking sha256sum -c on its own SHA256SUMS
- run_migration_loop.py gains --plan-out; test_migration_loop_pg.py writes its plan package to a temp dir
…gateway pass-through; 8 more claim-path negatives

- m9 §5.7: l2_claim_ticket replaced by a 6-parameter version (p_target_data_digest DEFAULT NULL). Tickets bound to a
  migration verification consult db_release_gate() at claim time; invalid → RAISE P0001 DB_RELEASE_GATE_REFUSED before
  the APPROVED→EXECUTING update (no state change, no execution_id, no upstream write). Unbound tickets unchanged.
  Least privilege for the SECURITY DEFINER owner mergepilot_l2_owner: SELECT on approval_verification_bindings +
  EXECUTE on db_release_gate (both surfaced by a real-PG permission error). Offline 001-init.sql refreshed.
- gateway.py: release_data_digest is a gateway verification parameter (excluded from args_hash, never forwarded
  upstream, 64-hex validated); claim wrapper classifies the DB-side refusal as GATE_REFUSED → DENY DB_RELEASE_GATE_REFUSED.
- run_migration_loop.py S12: stale head / target digest change / not approved / expired ticket / concurrent claim
  (exactly one EXECUTING) / re-claim on EXECUTING (0 rows) / unbound ticket unchanged / gateway wrapper mapping —
  driven through the real gateway module when importable (conda goai, mcp==1.28.1) else ast-extracted (recorded).
- tests/dbverify: m9 contract for §5.7, PG-gated loop expectations (8 gate steps, 23 negatives), gateway wrapper
  classification test (importorskip mcp). Evidence regenerated; run-meta commands now repo-relative.
- Evidence tier: LOCAL_REAL_SQL on an isolated PostgreSQL clone — not an Agentic Database verification.
…e PPT structure, round-2 response + fact table

- RagPage: long status chips wrap and data tables scroll inside their panel below 720px (the two element classes
  that exceeded the viewport); copy and data unchanged; dist rebuilt. /rag, /pr4, /rework verified at 390 and 1440.
- docs/决赛优化: PPT compressed to three main pages with per-block evidence tags (REAL_EXECUTED / LOCAL_REAL_SQL /
  CONTROL_PLANE_MECHANISM / SYNTHETIC / NOT_EXECUTED / BLOCKED); response doc gains the round-2 closeout section and a
  final per-item status table; fact table records the claim-path numbers, conda goai, Docker engine restart observation.
- README finals row mentions claim-path enforcement.
…urce, compose digest-policy tests

- m9 §5.7: a ticket bound to a migration verification must present the target data digest at claim
  (TARGET_DATA_DIGEST_REQUIRED); a run that registered migration candidates cannot execute through an
  unbound ticket (MIGRATION_VERIFICATION_REQUIRED). Ordinary PRs without candidates are unchanged.
  mergepilot_l2_owner additionally needs SELECT on migration_candidates. Offline 001-init refreshed.
- tools/dbverify/data_digest.py: the one canonical digest algorithm (sorted tables, COPY … ORDER BY 1),
  shared by baseline registration and the release executor; CLI --expect exits 3 on mismatch.
  Runner S12 adds: digest-required refusal, unbound-migration-run refusal, plain-PR unchanged, and the
  claim→migrate window demo (recompute matches; one mutated row is detected). 27/27 negatives, signature stable.
- docker-compose.yml comment + 3 tests now encode the actual post-f167762 policy (pgvector runs as the
  offline-loadable TAG; the registry digest is DECLARED to preflight and gate-checked; image-set is the
  source of truth for both). The tests cross-check compose against release/images/image-set.json.
- Evidence tier unchanged: LOCAL_REAL_SQL on an isolated PostgreSQL clone; not Agentic Database.
…eakage from the dbverify gateway loader

- run_migration_loop.load_gateway_claim_wrapper: remove the injected
  tools/policy-gateway sys.path entry and restore POLICY_FILE afterwards;
  the leak made 'import healthcheck' resolve to the gateway's probe script
  for later tests in the same interpreter (5 phase1d healthcheck failures).
- test_m8a2a_pr_fixture: placeholder mcp/starlette/uvicorn modules now
  install in setUpModule and are removed in tearDownModule instead of
  leaking for the whole session, where a bare stub 'mcp' made
  'import mcp' succeed on Python 3.9 and defeat the MODULE_IMPORT
  probe in tests/dbverify/test_migration_loop_pg.py.
- test_phase1d_retry_v3_gaps: _load_upstream_stub installs its own
  mcp.types stand-in (Tool/TextContent twins) instead of relying on the
  m8a2a leak.
Combined-run verification (same interpreter):
  py3.9  dbverify+isolated_live+release_delivery+gh_app+agentteams+reliability+rag:
         1815 passed / 3 failed (pre-existing DISTRO_NOT_REGISTERED host env) / 15 skipped
  goai 3.10 (real mcp): dbverify+agentteams+isolated_live+release_delivery:
         949 passed / 0 failed / 9 skipped
The Windows rebuild inherited CRLF from the autocrlf-checked-out template
and git kept the mixed-EOL file verbatim; origin/main's copy is LF-only.
Content unchanged.
…atabase confirmation sheet, read-only workspace inventory; read-only Element preflight + message templates

- docs/决赛优化/03: exact authorizations needed for one real AgentTeams/Element
  rework run (A1 containers/team start order, A2 Matrix room, A3 model +
  cost cap, A4 test repo write scope, A5 optional PG-authoritative tier).
  Nothing is started or called until each item is confirmed.
- docs/决赛优化/04: PolarDB Agentic Database resource confirmation (D1-D7)
  kept separate from the LOCAL_REAL_SQL isolated-PostgreSQL evidence.
- docs/决赛优化/05: read-only inventory + purpose index of D:\goai (git
  worktrees, materials, runtime archives, secrets registered by path only,
  temp resources of this round); no path moved or deleted.
- tools/agentteams/element_preflight.py: inspects container/network/port
  state and env-var NAMES only; never starts anything.
- tools/agentteams/rework_case/element_messages.md: kickoff/reply templates
  carrying run_id / PR / head_sha / test report / evidence path.
Pre-merge review conclusions (mandatory verification binding, trusted
target-data-digest source with fail-closed default, claim->execute version
consistency), the root-caused compose-digest test fix, combined-run test
numbers incl. the 3 pre-existing DISTRO_NOT_REGISTERED host failures,
Element/AgenticDB authorization status, and the PPT draft decision.
…ture was reshaped

GitHub push protection flagged the injection fixture's placeholder token
(xoxb-<digits>-<digits>-<24 chars>) as a live Slack token. The fixture now
uses the repo's existing test convention (xoxb- + 24 letters), which still
matches the SECRET_SLACK_TOKEN rule (xox[baprs]-[A-Za-z0-9-]{20,}) but not a
real token shape. Deterministic layer results are unchanged (5/5 decisions,
0 FP / 0 FN, human-intervention 0.8); only dataset.fixtures_sha256.injection
and timestamps differ. Model layer remains NOT_EXECUTED.
…; post-claim gate re-check

Q5/Q6 (signature replacement, grants, fresh vs upgrade):
- tools/m3b-b4-create-roles.sh still revoked/granted on the OLD 5-parameter
  l2_claim_ticket; after m9 that signature no longer exists, so the login-role
  script failed on any upgraded deployment (regprocedure cast + GRANT error).
  Both signatures are now allow-listed and only the existing one is acted on
  (to_regprocedure IS NOT NULL), with a check that exactly one exists.
- tests/dbverify/test_m9_upgrade_parity_pg.py (PG-gated): builds a fresh DB
  from release/offline/db-init/001-init.sql and an upgraded DB from the 12
  pre-m9 chain files + legacy grant + standalone m9, then asserts identical
  function definitions/owners/ACLs, tables/constraints/triggers, a single
  6-parameter claim signature (5-argument callers still resolve), gateway role
  can execute and approver cannot. Fails with the original role script.

Q4 (claim -> execute window, version side):
- db_release_gate already accepts EXECUTING; the runner now re-runs it on the
  claimed ticket, pushes a new revision, and shows OK -> STALE_SUPERSEDED_BY_
  NEW_REVISION (post_claim_gate_recheck_detects_new_revision). The plan
  package README instructs the executor to re-run the gate as well as the
  digest before 02-migrate.sql and states what the DB cannot verify (the
  digest is measured by the trusted executor; preflight profile is the
  content-level target check).

Evidence regenerated on a labelled temp PostgreSQL (mp.task=finals-r4-review-
20260915): 20 steps / 28/28 negatives / 10 gate steps, signature b60b328c...
reproduced twice, gateway imported as a module (goai, mcp 1.28.1).
…s(finals): Element single-task rework case + one-shot A-E authorization request

The three TestStatusStopCleanupWiring tests mocked discover_stack /
run_e2e_* but constructed the real WslDocker, so _entry_wake ran
wake_if_dormant -> 'wsl -l -v' and failed with DISTRO_NOT_REGISTERED on any
host whose MergePilot-Test distro is retired (it is, since PHASE14). The
docstring of _entry_wake already defines the design: test doubles without
wake_if_dormant pass through. Six sibling tests in the same file already
patch mp.WslDocker; these three now do too. No assertion changed.

Combined run on Python 3.9 (dbverify + isolated_live + release_delivery +
gh_app + agentteams + reliability + rag): 1822 passed / 0 failed / 15 skipped
(skips remain explicit opt-in gates only).

docs/决赛优化/06: single-task-throughout Element rework case (refund
idempotency; fixed pre-committed acceptance tests; <=3 fix / <=3 verify;
HOLD escalation; labelled optional fault-injection scenario; correlation
fields; evidence in a NEW directory) and the consolidated A-E authorization
request (containers/start order, existing Matrix room, qwen/deepseek-chat
with token/request/wall-clock/cost caps, test-repo branch+PR scope, optional
PG-authoritative tier with labelled cleanup).
…sions, wiring-test classification, Element case status
…egister the m9 parity test in the m5_0b delivery manifest

Running the m4b..m7 milestone suites on this Windows host surfaced two
real issues, both verified against an origin/main worktree:

- tests/*/fixtures are hashed by their manifests, but .gitattributes did
  not mark them -text, so an autocrlf checkout silently converted
  binary.diff / malformed.diff / mode-change.diff etc. to CRLF and
  test_05_all_fixture_sha256_match_manifest failed although the blobs are
  byte-correct (this also fails on origin/main). Rule added; the 11
  damaged files restored byte-identical to their blobs; m4b now 96/96.
- the new tests/dbverify/test_m9_upgrade_parity_pg.py is part of the
  dbverify delivery surface but was not in m5_0b_delivery_required.txt,
  breaking the manifest==surface contract (4 branch-only failures).
  Registered; surface count 132 -> 133. tests/m5_0 now 184/184.

Remaining 43 failures in the m-suite run are byte-identical in name and
count to origin/main's 44 on this host (m5_0c bash-harness ×38, m4c runner
profile ×3, m4e ×1, m4f1 ×1) — pre-existing host-environment issues, not
introduced by this branch; m4b is the one that this branch fixes.
…orization list (READY_FOR_AUTHORIZATION, tier-1)

Read-only verified this round: branch/PR/CI state; the four CoPaw workers each
live in their OWN Matrix room and AGENTTEAMS_WORKER_ROLE=standalone for all
four (roles are assigned per-task by the Manager - corrects the shared-room
assumption in doc 06); authoritative rework chain = CoPaw TeamHarness
TaskResult(FAIL) -> Manager acceptance -> plan node 'revision'/'blocked'
(p12/agentteams-v123 design docs); test-repo branches (target renamed to the
precedented mergepilot-demo/* prefix, verified free); pre-start container
snapshot (11 exited, 0 running).

Open items that cannot be confirmed with the stack stopped are listed as
Phase-0 read-only checks AFTER start and BEFORE any kickoff (manager state
path, gateway usage source, per-room message export, one llm-preflight call
counted as request #1) with typed-failure abort paths. Budget: deepseek-chat,
first-reached stop among 300k tokens / 60 requests / 60 min / CNY 10, usage
aggregated across Manager + 4 workers, hard stop = docker stop
agentteams-manager. MergePilot PG controller stays OFF by default (observer
only, opt-in E2) so exactly one dispatcher owns the task.
…ified policy/resume/budget facts

v2 corrections per the five requested points, all verified read-only:
- tier separation: this run is REAL_EXECUTED-AgentTeams with the AgentTeams
  Manager (image 223ddc2 == source commit 223ddc2b) as the sole authority;
  the MergePilot PG rework mechanism stays a separate CONTROL_PLANE_MECHANISM
  with its own evidence; never claimed as one integrated pass. E2 stays OFF.
- branch prefix: no platform-level branch policy exists in the v1.2.3 source
  (copaw / agentscope_runtime / manager) - the real boundary is the task
  instruction + the ctrl GitHub token's repo scope, which cannot be verified
  without reading the secret (operator to confirm scope; honest labeling).
- startup: workers mirror files only (sync.py), no LLM on start; PHASE13.1
  restart evidence shows IDENTICAL state with no spontaneous task execution;
  Phase-0 gate added - abort (never clean queues) if state.json holds
  non-terminal historical tasks.
- budget honesty: image constants show per-worker concurrency 10 / QPM 600 /
  max_tokens default unlimited / no cross-process limiter / no budget endpoint
  - so the stack has NO native hard budget. Revised control: usage metering
  (gateway admin API preferred, else per-process logs; in-flight requests
  pre-counted), gateway quota if the admin API supports it (Phase-0 check),
  and an unconditional stop switch at the 80% soft threshold that stops ALL
  FIVE callers (manager + 4 workers), with in-flight margin reserved.
- push wrap-up: local == remote == 4564b6c (ls-remote + gh API), no retry
  loops left; this commit pushed with bounded retries (<=6).
…hree-layer GitHub permissions, reconcile-aware Phase-0

Read-only verification only (docker create+cp image inspection, source reading,
gh read-only API); nothing started, no paid calls, no messages, no repo writes,
no push (not authorized this round).

Budget: retract the '80% stop' hard-cap claim. Verified capability table:
manager deepseek-chat maxTokens=128000 (known-models.json); workers default
max_tokens=None (pending Phase-0 read of worker openclaw.json); per-worker
concurrency 10 / QPM 600 / retries 3; single choke point exists (Higress AI
route on ctrl:8080 with console /v1/consumers + /v1/ai/routes); in-flight
requests complete and bill after stop. Option A = gateway-enforced limits
(position: Higress route plugins; to-verify at Phase 0). Option B = soft
budget with explicit cannot-gantee wording including worst-case cost.

GitHub: measured - main has NO branch protection and zero rulesets, so repo
level nothing blocks main writes/merges; platform source has no branch policy;
the token's repo scope cannot be verified without reading it (user checklist
provided). Minimal-permission proposal: fine-grained PAT scoped to the test
repo (separate authorization), or current token + instruction boundary
(labeled as such), plus a zero-external-write local patch-file fallback.

Phase 0: source-verified WorkerSpec.DesiredState() defaults to Running, so
starting the ctrl alone may reconcile-start the whole team - full separation
of base services from callers is NOT possible. Revised layered-observational
Phase 0 with explicit abort conditions incl. any model call observed before
kickoff.

Scope unchanged: AgentTeams-native run, Manager is the authority, no merged
integration claims, E2 off, Scenario B off; 'rework verified' only on an
observed test FAIL -> revision -> re-dispatch chain.
…imal ISOLATED stack, two-phase plan, phase-1-only authorization text

(1) Embedded controller CR store = kine/SQLite persisted in the ctrl volume:
starting p14h2-wd-ctrl reconciles the FULL historical CR set (>=8 workers incl.
the openclaw comparison group + manager) and cannot be bounded without editing
CRs - existing stack fails the pre-start control requirement, dropped.
(2) The only verifiable total-budget mechanism is the provider-side prepaid
wallet (fresh DeepSeek key ~CNY 10: covers all callers, inputs/outputs/retries,
no period ambiguity, blocks on exhaustion); Higress token quota unverified;
10 req/min relabeled as rate only; worker maxTokens=8k settable on our own
stack; manager cap 128k already proven.
(3) Stop order per reconcile topology: DesiredState->Stopped, stop manager,
stop ctrl (reconciler dies), stop workers; reverse to recover; in-flight
requests partially bill.

Minimal isolated stack plan (label mp.task=elem-iso-20260915, fresh volumes =
zero inherited tasks/queues, zero external GitHub writes; read-only reuse of
images/case files/templates). Phase-1 acceptance table (expected/abort/
recovery per step, one stop-recovery rehearsal, exactly one model call).
Phase-2 real collaboration case requires separate approval. Local commit
only; push not authorized this round.
…t claim, retain environment after phase-1, declared-list abort conditions, image IDs and request-limit verification

Retractions and corrections per review: (1) a DeepSeek key shares the
ACCOUNT-level balance and may sit behind auto-topup, so prepaid CNY 10 is not
a hard cap unless a separate no-payment-bound prepaid account with auto-
recharge off is used (user-side checklist; cannot be verified read-only).
llm-preflight semantics pinned from source: exactly 1 POST per attempt,
max_tokens=1, ~20-token prompt, default 2 retries (transport only) -> worst
3 requests / ~70 tokens; phase-1 cost exposure is that alone. (2) phase-1
ends by STOPPING and RETAINING the isolated stack (CR DesiredState=Stopped ->
stop manager -> stop ctrl (reconciler dies) -> stop workers) for phase-2;
deletion becomes a separate future operation. (3) abort condition replaced:
compare actual resources against the pre-declared list (elemiso-* containers/
network/volume) - abort on any unknown task, caller, or extra resource
instead of any-auto-create. (4) image IDs recorded (embedded ae47995d209f,
manager cafca0c1dc16, copaw cdc8f8a4ab8d); step added to verify no inherited
credentials/tasks in the fresh volumes and to read back manager maxTokens
128000 and worker maxTokens 8000 as actually applied. Credential provisioning
via a local key file path, never through chat. Local commit only; no push.
…o cases + integration doc

- evidence/FINALS-ELEM-PR2-LIVE-20260916: real run-elem-fastapi-pr2-20260916-01
  (CoPaw Leader orchestration, elemiso isolated stack, P14 images 223ddc2;
  review HIGH/CWE-22 -> real human gate -> local patch -> independent
  verification VERDICT=VERIFIED first-pass; PR #2 stayed OPEN, zero GitHub
  writes; audit covers clock skew, gate-violation void, fixer self-start stop,
  manager heartbeat shutdown, usage 243 calls / ~9.2M input 96% cached)
- demo-platform: new case fastapi-pr2-live-20260916 (REAL_EXECUTED_LIVE level,
  default case) + fastapi-pr3-reject (REJECTED terminal, from rejectDemo pack)
- docs/决赛优化/09: integration inventory + unified entry + reproduction commands
… routes

- new case rag-retrieval-loop (REAL_OFFLINE_EXPERIMENT on SYNTHETIC corpus):
  5 steps = span audit -> family split (54q, 30/24) -> baseline+badcases ->
  12-candidate grid -> held-out once (MRR 0.8611->0.9583, PROMOTE)
- add explicit /demo routes for the 4 new cases (pr2-live, pr2-historic,
  pr3-reject, rag-loop); unknown ids still fall through to the selector
- fix GuidedDemoPage hardcoded rework chain: use the case's own chain
- register finalsRagLoop evidence dir; doc 09 updated
…CTED) + demo case upgrade

- evidence/FINALS-ELEM-PR3-LIVE-20260916: run-elem-fastapi-pr3-20260916-01
  (review HIGH/CWE-78 unauth RCE with real root-level repro in reviewer's
  own container -> operator REJECTED at the gate -> leader marked fix
  [-] rejected / verify [!] locked / project blocked; fixer+verifier never
  dispatched; 52 calls, 1.82M input 98.7% cached, ~¥0.4; PR #3 OPEN,
  head ad267a6e verified unchanged)
- demo caseE upgraded: live rejection evidence primary + 20260830 run as
  historical comparison; gate-discipline contrast with the PR#2 run recorded
- doc 09 case list updated
…er) + case-manifest template

- roles are a one-time design, not per-PR authored: extract the common
  protocol from both live runs into ROLE-*.md (incl. leader gate discipline
  with the pr2-jump/pr3-hold precedent) + CASE-MANIFEST.template.md as the
  only per-case artifact (SHA/targets/tasks/acceptance)
- demo: both live cases now render the four contract files as evidence items
  (strengthens the conclusions-not-planted argument)
- doc 09 limitation #0 records the retroactive freeze honestly
…tates

P0 bugs fixed:
- LevelChip now accepts string|array (was concatenating array children with
  no separator: HISTORICAL_REPLAYREAL_EXECUTED_AGENTTEAMS) and renders one
  chip per level with Chinese labels; LEVEL_ZH extended with the three new
  levels (live run / agentteams / offline experiment)
- guided page progress chip was hardcoded '5/5' — now stepIdx/total
- stale copy: selector '两个演示案例'->'选择案例', '五步引导'->dynamic,
  footer data-source labels now include the new levels

IA rework (shell pages were still two-cases-era):
- overview = hero (main case + value prop + 3 actions) + full portfolio grid
  (portfolio_role chips, purpose, relation note explaining the PR#2
  live-vs-historical card pair) + integrity line now covering 5 dirs incl.
  both live evidence packs (badge 5/5)
- selector cards fully clickable (role=link, keyboard Enter) with purpose +
  execution-nature lines
- evidence library: dynamic per-case evidence index (drawer-backed, works
  for all 5 cases) alongside the rework/db deep sections; live dirs listed
- guided page: ?ev=<id> deep link opens the drawer

main case restructured to 6 steps: PR发起 -> 风险审查 -> 人工安全门(真实批准)
-> 修复diff -> 独立验证 -> Leader最终验收
…r case.*

- drawer now reads run_id/PR/SHA/证据目录/生成时间 from d.case (was reading
  d.run_id etc. -> undefined -> rendered 未提供 even when data existed)
- SHA256 row now honest per source type: per-file hash vs dir SUMS
  (通过/未通过/未命中) or 不适用(仓库只读引用) instead of generic 未提供
- new-case honesty objects (pr2-live/pr3-reject/rag) used wrong keys
  (honesty_real/limits/exclude strings) -> 诚实性标注 rendered all '—';
  converted to the canonical real/controlled/not_executed array contract
  shared with HonestTriple and case-level NOT_EXECUTED notes
- LEVEL_ZH: REAL_EXECUTED_AGENTTEAMS now reads 真实执行 · AgentTeams(历史
  2026-08-29) so drawer/level chips can't be mistaken for the live run
- historical case gets an amber banner pointing to the 20260916 live case
  as the primary evidence; guided pages now render c.banner (was unused)
…acks + demo

Audit findings applied:
- A1: retract 'post-gate Leader re-delegation' — the referenced event was the
  voided one (Matrix txn-id idempotency); no new delegation event after the
  gate; fixer was driven by the operator's SPEC-B instruction (protocol
  deviation disclosed); fixer meta provenance conflict preserved
- A2: retract 'container clock skew ~6.4h' (host-side evidence disproves it);
  wall clock was ~7.6h including ~6.3h operator absence during the blocked
  gate decision — exceeds the 120-min budget clock, disclosed
- B2: usage decomposition corrected (Manager 18/0.56M; prior-session copaw
  53/1.14M; 17:15 25/449k previously unaccounted; leader idle heartbeats
  ~70/3.97M — largest single cost, now disclosed); 'fixer self-start 69'
  -> 34 requests responding to the voided delegation
- B3/B4: reviewer-independence scope downgraded (repro+rating independent;
  category/target files pointed by instructions); PR3 gate-discipline claim
  qualified with confounders (hardened kickoff + pre-announced reject title)
- B5: role-contract evidence items downgraded to POST_RUN_DESIGN level
- B7: PR3 52 requests/49 usage-bearing; RAG-LOOP +2 and RELIABILITY +1 files
  into SHA256SUMS (timings stays excluded per its own note); probe legit file
  welcome.txt -> ok.txt (actual); deepseek-flash response-model note
- PR3 state evidence re-collected from the running stack MinIO (original
  capture failed after container removal; failure now disclosed in-file)

Standing conclusions (audit-confirmed): patch efficacy independently
reproduced, PR3 blocked/zero-dispatch, zero GitHub writes, totals & SHA locks.
…on) + B6 resolved (p14h2 start user-confirmed manual)
- FINALS-ELEM-PR2-LIVE-20260916-R2: run-elem-pr2r2-20260916-01 — the clean
  chain R1 lacked: non-prescriptive SPEC -> reviewer independently confirmed
  HIGH/CWE-22 -> operator approved live at the gate -> Leader issued a NEW
  delegation event ($uZ4Rj1SI, txn-collision closed) -> fixer executed with
  zero operator touch -> verifier VERIFIED PASS first try; 16 min attended,
  88 calls / 4.65M input 98.9% cached (~¥1.1-2.5)
- demo: caseG R2 as default main case (6 steps incl. dedicated gate step);
  R1 demoted to audited-comparison role with relation note
- selftest 61/61; verified in browser at 1440px
- new section: three real runs (R2 main case VERIFIED PASS / PR3 real
  rejection zero-dispatch / R1 audited-and-corrected) with evidence links
- role contract v1.0 link in Agent 协同设计; 6-case quickstart note
- audit_readme.py: image references OK
@nghqqa
nghqqa merged commit ad271cd into main Sep 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant