跳转至

Context Router Stale Policy Eval:stale_index 风险分级策略

数据分类:synthetic_internal_demo。实验使用合成组织拓扑和合成 adapter state,验证 Context Router 能否按任务风险处理 stale_index=true 的候选上下文库。

实验定位

上一轮已经让 SearchConnector Tool Gateway 在 rank_log.stale_index=true 时默认阻断检索 hits,并记录 high severity reindex/gap receipt。

这一轮把策略上移到 Context Router:在候选上下文库进入 prompt 之前,Router 读取 projection_states,根据任务风险输出可审计 action,并决定 stale 上下文是否能进入 selected_context_libraries

策略表

任务风险 Action 是否进入 selected context 用法
low allow_with_notice yes 低风险说明性任务可继续使用,但 trace 必须标记 stale
medium require_human_confirmation no 中风险任务需要人工确认后再披露
high wait_for_reindex no 高风险任务等待 reindex/fresh projection
critical block_and_report_gap no 关键风险任务阻断,并进入 gap/reindex 流程

汇总结果

  • Case 数:4
  • 通过数:4
  • 失败数:0
  • 通过率:100%
  • 覆盖 action:allow_with_noticerequire_human_confirmationwait_for_reindexblock_and_report_gap
  • 被阻断 stale case:3
  • 泄漏标记数:0

Case 明细

Case 风险 预期 action 实际 action 选择上下文库 结果
low-risk-allow-with-notice low allow_with_notice allow_with_notice project_orgreorg_knowledge, org_directory pass
medium-risk-human-confirmation medium require_human_confirmation require_human_confirmation org_directory pass
high-risk-wait-for-reindex high wait_for_reindex wait_for_reindex org_directory pass
critical-risk-block-and-gap critical block_and_report_gap block_and_report_gap org_directory pass

当前结论

  1. stale_index=true 不再只有 Tool Gateway 的统一阻断策略;Context Router 已能按任务风险做分级处理。
  2. 低风险任务可以 allow_with_notice,继续选入上下文,但 trace 会保留 stale action。
  3. 中风险任务会 require_human_confirmation,默认不把 stale 上下文直接选入 Agent prompt。
  4. 高风险任务会 wait_for_reindex,关键风险任务会 block_and_report_gap
  5. safe trace 只暴露 adapter id、generation、action 和计数,不暴露 source URI、owner 或内容 marker。

代码入口

  • 实现:framework/context/domain_router.py
  • 实验:framework/evals/context_router_stale_policy_eval.py
  • 测试:tests/test_context_router_stale_policy_eval.py
  • 运行:python scripts/context_router_stale_policy_eval.py --write-report
  • 输出:vault/50-outputs/context-router-stale-policy-analysis.md

下一步

  1. 把真实 adapter 的 stale state 接入 Context Router 的 projection_states,替换当前合成状态。
  2. block_and_report_gap 生成的 Projection Remediation item 接到真实 reindex worker,并让 SearchConnector high severity gap receipt 复用同一个 item id。
  3. 用真实团队任务标注 task risk,校准 low / medium / high / critical 的默认策略。