Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ advancement work remains active.
remains selected. A material observation may create its independently routed
successor through the existing monitor contract, but it still does not
replace the Turn's settlement identity.
- An executed turn-scoped poll returns `turn_continuation`. An exact match
between `settlement_todo_id` and the observed `todo_id` closes the no-spend
monitor Turn and requires a fresh `--turn-instance-id`. A different admitted
monitor Todo is auxiliary: it records the observation but leaves the original
advancement Turn open for its durable writeback and single spend. Without an
exact or typed auxiliary binding the response fails closed from claiming the
Turn settled.

### Acceptance

Expand Down Expand Up @@ -184,6 +191,12 @@ using a complete read-only snapshot with disposable File/SQLite/PostgreSQL arms.
替换为本 Turn 的结算 Todo;多个辅助回执也绝不改变既有结算身份。
- 辅助观察无变化后,原 advancement Todo 继续保持选中;若观察发生重大变化,
可按既有 monitor 契约创建独立路由的 successor,但仍不替换本 Turn 的结算身份。
- 执行成功的 turn-scoped poll 会返回 `turn_continuation`。仅当
`settlement_todo_id` 与被观察的 `todo_id` 精确一致时,才完成该 monitor Turn 的
不计费结算,并要求后续使用新的 `--turn-instance-id`。不同但已准入的 monitor
Todo 属于辅助观察:只写观察回执,原 advancement Turn 仍需完成 durable
writeback 与唯一一次 spend。既非精确匹配、也无 typed auxiliary binding 时,响应
必须失败关闭,不能宣称 Turn 已结算。

### 验收

Expand Down
25 changes: 22 additions & 3 deletions docs/reference/protocols/turn-envelope-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,25 @@ settlement-identity conflict. The full quota response preserves the TypeScript
`action_selection_qualification_v0` result and returns
`quota_action_selection_deferred` or `quota_action_selection_rejected`, including
the exact current preemption or eligibility reason. An existing identity-less
receipt is replayed without mutation; a first-call rejection reports
receipt appends an identity-less `pending_action_selection` revision when an
otherwise eligible explicit choice is deferred. That revision is not delivery
or settlement authority: it preserves the explicit choice only so a no-argument
same-Turn reentry cannot replace it with the current recommendation. An
ineligible/rejected choice still replays the receipt without mutation; a
first-call rejection reports
`heartbeat_receipt.status=not_committed` and writes no receipt event. The agent
receives `recovery_action=reenter_guard_without_selection` and one executable
same-Turn guard in the full decision's `cli_channel.next_cli_actions`; the compact
envelope preserves the recovery in its action and writeback preview. The failed
selection exposes no settlement plan, spend command, or unadmitted replan action
packet. Execute that guard without
a Todo/replan argument before following the resulting binding or portfolio. A receipt already bound to a different Todo or autonomous
replan obligation remains a hard `heartbeat_receipt_identity_conflict`.
a Todo/replan argument before following the resulting binding or portfolio. A
receipt already bound to a different Todo or autonomous replan obligation
remains a hard `heartbeat_receipt_identity_conflict`. On reentry, an identical
projected Todo may bind normally. If a hard autonomous replan owns the current
lane, the replan receives the Turn's settlement identity and the retained Todo
is reported as `deferred_to_fresh_turn`; a different recommended Todo never
inherits the retained choice or its authority.
When a due monitor is visible only as auxiliary context for an advancement lane,
the typed reason is
`auxiliary_monitor_not_selectable_in_advancement_lane`. The agent selects a
Expand All @@ -98,6 +108,15 @@ worktree recovery instruction. Moving to an independent worktree and rerunning
the guard with the same Turn id resumes the selected Todo; the wrapper must not
rewrite this recoverable state as a settlement-identity conflict.

An executed, turn-scoped `quota monitor-poll` is a no-spend closeout only when
its observed Todo exactly matches the Turn's `settlement_todo_id`. That response
includes `turn_continuation.next_turn_required=true` and requires a fresh Turn
before unrelated work. An admitted auxiliary monitor uses its own observed Todo
while retaining the advancement Todo as `settlement_todo_id`; its continuation
keeps `current_turn_settled=false` and `next_turn_required=false` so the original
writeback and spend can finish. A missing exact or typed auxiliary binding never
claims settlement.

Portfolio v2 preserves v1's selection policy, candidate ordering, and
settlement rules, and adds an optional `continuation_hint` to each suggested
action. The default quota producer and Turn controller now require v2. The
Expand Down
Loading
Loading