测试:钉死静态委派返工深度与澄清轮次的链上推断语义

反转 clarification_continuation_chain_supports_multiple_rounds 的第 3 轮断言:
D2 -> D3 从"必须被拒绝"改为"必须成功",并断言 D3 的澄清轮次推导为 2——这是
WP1 把返工深度与澄清轮次拆成两个独立链上推断维度后的有意行为变更,不是回归。

新增 7 条用例,全部走真实 observe_agent_runtime_agent_delegate 生产路径:
- 澄清轮次上限边界(第 4 轮必须被拒绝,且文案是澄清轮次专用文案,不串扰返工深度门)
- 交替链钉子测试:返工(depth=1) -> 澄清(depth 仍为 1, round=1) -> 再返工必须被拒绝,
  同时证伪"R1 误清零 depth"和"R2 漏加 1"两种失误
- 返工重置澄清轮次预算,重置后 3 轮澄清全部放行
- 验证澄清 continuation 校验器(要求携带匹配的澄清字段)本身就保证了同一原始
  delivery 不存在"既澄清又质量返工"的可达状态,并证明澄清跳不会连带占用它
  产出的下一节点自己的返工配额
- 历史记录分类:手工构造 #165 之前风格的旧 delivery,验证链上推断把它正确
  分类为非澄清、返工正确计入深度
- 跨 run 隔离:换 parent_run_id 引用旧链节点的返工请求必须被拒绝
- source 区分:game-chat source 下澄清上限为 1,非 game-chat 上限为 3

delegation.rs 仅放宽三个既有私有函数(static_delegate_lineage_counters /
list_static_delegate_deliveries_at / write_static_delegate_delivery_at)为
pub(crate),供测试直接断言链上推导出的 (depth, round) 数值;不改变任何行为、
不新增持久字段。

回归防线复核:project_supervisor_static_delegate_repair_is_single_bounded_wave
(含"返工的返工必须被拒绝")、project_supervisor_concurrent_repair_dispatch_
creates_exactly_one_delivery、claimed_needs_user_input_delivery_becomes_one_
supervisor_wait 及其邻近用例均保持通过。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 04:14:19 +00:00
parent 2f3dd86fb3
commit 13ee128114
2 changed files with 1493 additions and 35 deletions
@@ -1110,7 +1110,7 @@ fn static_delegate_original_is_awaiting_clarification(
/// 防环 / 防越界:反向重放阶段一旦遇到重复 id、缺失的上游节点,或跳数超出
/// STATIC_DELEGATE_LINEAGE_MAX_HOPS,立即 fail closed,返回 (u32::MAX, u32::MAX)
/// 使调用方的深度门 / 轮次门必然拒绝,而不是静默放行。
fn static_delegate_lineage_counters(
pub(crate) fn static_delegate_lineage_counters(
deliveries: &[StaticDelegateDeliveryRecord],
delegation_id: &str,
) -> (u32, u32) {
@@ -1669,7 +1669,7 @@ pub(crate) fn read_static_delegate_delivery_at(
Ok(Some(record))
}
fn list_static_delegate_deliveries_at(
pub(crate) fn list_static_delegate_deliveries_at(
root: &Path,
) -> Result<Vec<StaticDelegateDeliveryRecord>, String> {
let dir = resolve_local_project_path(root, STATIC_DELEGATE_DELIVERY_DIR)?;
@@ -1766,7 +1766,7 @@ fn list_static_delegate_claims_at(root: &Path) -> Result<Vec<StaticDelegateClaim
Ok(claims)
}
fn write_static_delegate_delivery_at(
pub(crate) fn write_static_delegate_delivery_at(
root: &Path,
record: &StaticDelegateDeliveryRecord,
) -> Result<(), String> {
File diff suppressed because it is too large Load Diff