ASTER CODE / 内核原理
任务完成判定
完成门禁的真实顺序、修改摘要、验证合同、豁免、资源结清与目标完成。
最终答复要接受代码中的检查
模型给出最终答复后,Core 核对该次运行的依据。 检查结果决定运行是否支持结束。 文字中的“测试通过”不能生成通过报告。 旧报告也不能自动覆盖后来的修改。
- 01先处理结果不明的操作
副作用、外部观察和子任务分别检查。最终答复不会消除未决事项。
harness_loop.rsL1591 ↗ - 02确认观察覆盖全部修改
部分文件列表不能代表完整的修改摘要。
- 03再绑定验证依据
有修改时,报告或豁免必须匹配当前摘要。无修改也要先通过前置检查。
harness_loop.rsL1591 ↗
真实判断顺序决定哪些捷径无效
| 次序 | 检查对象 | 未满足时的结果 |
|---|---|---|
| 1 | 未解决的工具效果 | Incomplete |
| 2 | 仍阻止成功的外部观察 | Continue 或 Incomplete |
| 3 | 未观察的工作区子任务 | Incomplete |
| 4 | 修改观察是否完整 | Incomplete |
| 5 | 是否存在工作区修改 | 无修改时支持 Narrative |
| 6 | 当前摘要是否有宿主豁免 | 匹配时支持 Waived |
| 7 | 当前摘要是否有通过报告 | 匹配时支持 Verified |
| 8 | 仍缺少依据 | Incomplete,并说明下一步 |
前四项发生在无修改判断之前。 无修改的运行也必须清除前置缺口。 一个结果不明的外部操作仍可能阻止完成。
源码漫游
完成门禁源码漫游
按真实判断顺序阅读。每一项都可能阻止结束。
if let Some(error) = ToolEffectUnresolved::from_ledger(ledger) {return CompletionGate::Incomplete {message: error.to_string(),};}let open = crate::external_observation::still_open(observations, waivers, ledger.digest());if crate::external_observation::blocks_success(&open) {let digest = open.iter().map(|observation| observation.digest.as_str()).collect::<Vec<_>>().join(",");let message = format!("completion gate: external observation {digest} still requires a workspace change. A final answer does not clear it. Bind a newer observation of the same subject or a host waiver for the observation digest.");return if allow_continuation {CompletionGate::Continue { message }} else {CompletionGate::Incomplete { message }};
if ledger.has_open_children() {let ids = ledger.open_children.iter().map(|child| child.task_id.as_str()).collect::<Vec<_>>().join(",");let message = format!("completion gate: background workspace task {ids} has not been observed. A final answer does not observe its writes.");return CompletionGate::Incomplete { message };}if ledger.observation_incomplete() {return CompletionGate::Incomplete {message: "completion gate: workspace observation is incomplete, so this digest is not the effect. A final answer, a waiver, or a verification of a partial list does not close it.".to_string(),};}if ledger.is_empty() {return CompletionGate::Allow(CompletionTerminal::Narrative);}let digest = ledger.digest().to_string();if waivers.iter().any(|waiver| waiver.effect_digest == digest) {return CompletionGate::Allow(CompletionTerminal::Waived {effect_digest: digest,
if ledger.is_empty() {return CompletionGate::Allow(CompletionTerminal::Narrative);}let digest = ledger.digest().to_string();if waivers.iter().any(|waiver| waiver.effect_digest == digest) {return CompletionGate::Allow(CompletionTerminal::Waived {effect_digest: digest,});}if reports.iter().any(|report| report_binds_pass(report, &digest)){return CompletionGate::Allow(CompletionTerminal::Verified {effect_digest: digest,});}let paths = mutation_paths_for_gate(ledger);let next = if contracts.is_empty() {unbound_mutation_next_step(ledger)} else {host_contract_next_step(ledger, contracts)};let message = format!("{UNBOUND_MUTATION_GATE}{digest}{paths} has no bound Passed verification and no host waiver. Assistant text does not count. Bind a verification_report.effect_digest to this digest with required checks Passed, or obtain a host waiver for this digest.{next}");// A host waiver is not model-grantable, and editor-authored reports are// rejected. Built-in bash may bind a digest only when an existence check// matches a mutated path *and* on-disk content matches the ledger digest.// The optional verifier turn already ran or was skipped before this
let paths = mutation_paths_for_gate(ledger);let next = if contracts.is_empty() {unbound_mutation_next_step(ledger)} else {host_contract_next_step(ledger, contracts)};let message = format!("{UNBOUND_MUTATION_GATE}{digest}{paths} has no bound Passed verification and no host waiver. Assistant text does not count. Bind a verification_report.effect_digest to this digest with required checks Passed, or obtain a host waiver for this digest.{next}");// A host waiver is not model-grantable, and editor-authored reports are// rejected. Built-in bash may bind a digest only when an existence check// matches a mutated path *and* on-disk content matches the ledger digest.// The optional verifier turn already ran or was skipped before this// decision. Spending the one continuation here cannot close the gate; it// only invites another tool call. An open external observation still// continues, because a workspace write can satisfy that subject.CompletionGate::Incomplete { message }}const UNBOUND_MUTATION_GATE: &str = "completion gate: workspace mutation ";fn host_contract_next_step(ledger: &MutationLedger,contracts: &[crate::verification::VerificationContractV1],
源码与本文版本一致,保留原始行号。
修改摘要为什么必须精确绑定
修改账本保存该次运行观察到的工作区影响。 摘要代表当前这组影响。 验证报告需要绑定这份摘要。 模型继续修改文件后,应重新核对报告绑定。
例如,日期函数已通过跨月测试。 模型随后又修改格式化逻辑。 旧报告证明旧状态通过检查。 新的内容需要对应的新依据。
验证合同、报告和豁免是不同对象
| 对象 | 谁提供 | 含义 |
|---|---|---|
| Verification contract | 宿主准入 | 声明检查命令和覆盖范围 |
| Verification report | 受控检查路径 | 记录本次检查及所绑定摘要 |
| Completion waiver | 宿主或用户明确接受 | 对指定摘要接受验证缺口 |
合同声明“应该运行什么”。 报告说明“本次实际检查了什么”。 豁免说明“接受哪一份尚未验证的修改”。 模型无法仅凭生成一段文本创建有效豁免。
四个终态应怎样显示
| 状态 | 准确含义 | 容易造成的误解 |
|---|---|---|
| Narrative | 无修改,且前置缺口已清除 | 不是“代码通过了测试” |
| Verified | 当前摘要有匹配的通过依据 | 不代表所有可能缺陷都已排除 |
| Waived | 当前摘要得到明确豁免 | 不代表验证通过 |
| Incomplete | 仍有明确缺口 | 不等同于用户暂停 |
宿主应显示具体缺口。 只显示“失败”会丢失后续处理所需的信息。
完成判定与资源结清怎样配合
完成门禁检查任务证据。 资源作用域管理该次运行所属的进程、工具和资源。 宿主还要等待所属资源完成收尾。 模型文本、门禁结果和资源终态分别记录。
这一区分在取消时尤其重要。 停止生成后,工具可能仍在协作退出。 界面应保留取消中的状态,直到原资源结清。 资源设计见验证与资源寿命。
长期目标还有额外的完成条件
一次 Run 的 Verified 只说明该次修改的检查依据。
目标还要接受每个计划步骤。
最后一步还要覆盖目标自身的接受条件。
全部等待与全部切片也要结清。
实现:目标完成条件 L34 ↗。
面向宿主的排查顺序
- 读取原始完成门禁消息。
- 核对未决效果与外部观察。
- 检查子任务的工作区影响。
- 核对修改观察是否完整。
- 对照当前修改摘要。
- 检查报告或豁免的绑定。
- 核对资源结清状态。
- 读取目标的当前完成条件。
完整依据来自原始运行记录。 界面文案应忠实反映该次结果。