Persist attempt ids and verify products on interrupted recovery (Q1 WP3) #24

Merged
weichen merged 1 commits from feature/agent-stack-q1 into main 2026-10-07 09:19:16 +00:00
Owner

Q1 增量二:attempt id 落盘与中断恢复产物校验(WP3)

按 Documents 提案 2026-10-07-agent-stack-n1q1i1-plans.md §3.2 落地 Q1 WP3。

改动

  • StepSpec.AttemptID:进入 running 时落盘 runID/stepID/N(N=Attempts),作为 ExecRequest.ExecutionID(替换原 runID-stepID 拼接)——执行事件、产物与副作用记录都有了稳定的尝试标识;瞬态重试共享同一 AttemptID(循环内不增 Attempts)。
  • recoverInterrupted(HitlAuto)产物校验:步骤在 running 崩溃时先看交付物——全部落盘 = 副作用实际发生过,按该 attempt 判定完成(合并产物、发事件注记),不再重新执行;缺失才走原有「pending 一次重试」。Attempts≥2 的 twice 语义不变。

验证(Q1 验收第一条的实证形态)

  • 全套件绿,含三个新测:
    • TestAttemptIDFormat:每步 runID/stepID/1 落盘;
    • TestKilledAtSuperstepBoundarySideEffectsOnce:完整跑通后把第二步翻回 running(产物在盘),第二引擎 Resume——所有步骤执行次数与杀进程前逐一相等(已完成步骤零重跑、running 步骤按 attempt 判定完成不 rerun);
    • TestInterruptedMissingProductsRetries:删掉 running 步骤的交付物 → auto 一次重试(次数=2),不会无限重放。

主任务:Dev 仓 feature/agent-stack-q1。

# Q1 增量二:attempt id 落盘与中断恢复产物校验(WP3) 按 Documents 提案 `2026-10-07-agent-stack-n1q1i1-plans.md` §3.2 落地 Q1 WP3。 ## 改动 - **`StepSpec.AttemptID`**:进入 running 时落盘 `runID/stepID/N`(N=Attempts),作为 `ExecRequest.ExecutionID`(替换原 runID-stepID 拼接)——执行事件、产物与副作用记录都有了稳定的尝试标识;**瞬态重试共享同一 AttemptID**(循环内不增 Attempts)。 - **`recoverInterrupted`(HitlAuto)产物校验**:步骤在 running 崩溃时先看交付物——**全部落盘 = 副作用实际发生过,按该 attempt 判定完成**(合并产物、发事件注记),不再重新执行;缺失才走原有「pending 一次重试」。Attempts≥2 的 twice 语义不变。 ## 验证(Q1 验收第一条的实证形态) - 全套件绿,含三个新测: - `TestAttemptIDFormat`:每步 `runID/stepID/1` 落盘; - **`TestKilledAtSuperstepBoundarySideEffectsOnce`**:完整跑通后把第二步翻回 running(产物在盘),第二引擎 Resume——**所有步骤执行次数与杀进程前逐一相等**(已完成步骤零重跑、running 步骤按 attempt 判定完成不 rerun); - `TestInterruptedMissingProductsRetries`:删掉 running 步骤的交付物 → auto 一次重试(次数=2),不会无限重放。 主任务:Dev 仓 `feature/agent-stack-q1`。
weichen added 1 commit 2026-10-07 09:18:30 +00:00
Persist attempt ids and verify products on interrupted recovery
ci / vet-and-test (pull_request) Successful in 24s
ci / docker-checkout-hostgateway (pull_request) Successful in 0s
96d1e0e49c
Why: Q1 WP3 - each step execution carries a stable attempt id
(runID/stepID/N) for audit and idempotency, and auto-mode
interrupted recovery must not re-execute a step whose products all
landed before the crash (side effects exactly once).

Evidence: go vet clean; full squad suite ok, including the new
kill-at-superstep-boundary test (completed steps never re-execute,
running-with-products judged complete by attempt) and
missing-product retry tests.

Impact: StepSpec gains AttemptID set when entering running and used
as the execution id; recoverInterrupted (HitlAuto) checks the
step's targets first - all present means completed with artifact
merge, otherwise the legacy pending retry. Transient retries share
the same AttemptID.

Refs: Documents proposal 2026-10-07-agent-stack-n1q1i1-plans.md Q1 WP3
weichen merged commit b34d6ed187 into main 2026-10-07 09:19:16 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-Squad#24