Skip to content

Commit 3a419ab

Browse files
authored
Merge pull request #4862 from loopx-project/codex/authority-execution-closure
fix(issue-fix): close grouped Monitor execution and recovery
2 parents baf29a9 + 1865708 commit 3a419ab

16 files changed

Lines changed: 845 additions & 236 deletions

‎docs/architecture/rfcs/shared-goal-authority-state-provider-v0.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,7 +3211,7 @@ or moving a helper is not by itself a package exit.
32113211
| A / L1: Monitor configuration (this slice) | Existing `todo update` config enters the TS planner/CAS/receipt; delete Python's duplicate intent field catalog. Separate authoring from observed hashes, times and generations. | Ordinary CLI/API, clear/omission, active lease proof, no-op/replay, failed display delivery, complete fixture and real providers. This does not complete delegated Chat or leased polling. |
32123212
| A / L2: Complete public mutation admission | User completion updates share the TS edit/terminal transaction and reviewed Chat recovery; linked decision consumption/reject/cancel/resume now commit with the source, replacing Python followthrough rules. Continue the actual CLI/Turn/Chat inventory for remaining effect-owned decisions, delegated owner actions and Monitor lifecycle transitions; [caller contract](../../reference/canonical-todo-completion-update.md). | Build on merged T1 owners, not a generic raw patch. Prove permission rejection and exact caller response; remove replaced Python admission and name every remaining unsupported command. |
32133213
| A / L3: Canonical lease lifecycle | Standalone acquire/takeover, atomic claim lease admission and maintenance reuse TS facts/decision/materialization and one provider opening fence. Explicit claimed-work transfer now commits source-authorized Todo ownership and the new lease generation together; canonical request types exclude legacy held-fence fields. Acquire success verifies current execution proof; canonical completion can recover missing display. | Full-head scope conflict, archived/ineffective holders, exact create-CAS retry, stale execution, process loss and real CLI/four-arm rehearsal are covered. [Operation and remaining callers](../../reference/canonical-lease-renew.md). Executor-held external-effect fences remain explicit work; D1–D3/default holds remain. |
3214-
| B / L4: Leased Monitor poll and settlement | Current execution proof now binds CLI intent, observation/generation/independent-successor CAS and historical business receipt. Quota pending admission is frozen before the business write; recovery preserves that decision after lease retirement. | Existing L3 lease lifecycle, real File/SQLite/PostgreSQL, mixed fixtures, process death between business/quota commits, competing renewal and unchanged polling. [Operation and snapshot rehearsal](../../reference/protocols/quota-monitor-observation-receipt-v0.md). Ordinary polls leave leases unchanged and spend no quota; separate authorities stay separate. The retained grouped-Monitor observation/reactivation caller now uses Todo update v4 and the shared Monitor planner, with unchanged-group display recovery. Canonical reactivation now atomically retires retained execution and reopens the observation cycle, sharing typed admission with polling; a fresh execution still needs explicit acquisition. Executor acquisition for grouped reconciliation, wider L2 admission and D1–D3/default remain open. |
3214+
| B / L4: Leased Monitor poll and settlement | Current execution proof now binds CLI intent, observation/generation/independent-successor CAS and historical business receipt. Quota pending admission is frozen before the business write; recovery preserves that decision after lease retirement. | Existing L3 lease lifecycle, real File/SQLite/PostgreSQL, mixed fixtures, process death between business/quota commits, competing renewal and unchanged polling. [Operation and snapshot rehearsal](../../reference/protocols/quota-monitor-observation-receipt-v0.md). Ordinary polls leave leases unchanged and spend no quota; separate authorities stay separate. The retained grouped-Monitor observation/reactivation caller now uses Todo update v4 and the shared Monitor planner, with unchanged-group display recovery. Canonical reactivation now atomically retires retained execution and reopens the observation cycle, sharing typed admission with polling; a fresh execution still needs explicit acquisition. Grouped reconciliation now acquires/revalidates/releases its own bounded execution, recovers interrupted cleanup, and plans the complete bucket set in TS; missing evidence and ambiguous/stale targets reject. This closes that retained caller across legacy/File/SQLite; native/imported mixed fixtures exercise the same effects on real PostgreSQL. Wider L2 admission, external-effect fences and D1–D3/default remain open. |
32153215
| B / L5: Consumer and display closure | Reconcile #4316, audit Turn/quota/Dashboard/Chat source reads, and finish D1 freshness/recovery through the existing projection outbox. | CLI, Lark/Chat and packaged frontend read back their affected interactions; absent/stale display, empty canonical state, pending projection and data beyond UI limits. Delete post-promotion legacy fallbacks with each consumer. |
32163216
| A–C / L6: Local durability qualification | Continue contributor-owned #4224/#4328 on the selected SQLite profile; reuse File/NoKV references and complete 7.2's ledger. | Capacity, real process/crash/restore/upgrade, retained receipts/scans, consumer lag, supported runtimes/OS and the separately authorized >=10-day synthetic soak. Missing measurements remain holds. |
32173217
| A–C / L7: Capture continuity | Reconcile the merged #4315 archive/lease-membership repair; qualify its ladder row/mutant and sustained mixed-writer/event-source matrix rather than reimplementing the closed defect. | Real CLI/File capture, history retained, partial drain unqualified, crash/replay and a new lease after archive/rebootstrap. Keep the legacy migration window provable; T4 cannot be used to skip this row. |
@@ -3233,7 +3233,7 @@ PRs**, conditional on the caller audit finding no additional missing effects:
32333233
| L7 capture plus L8 integrated migration | 1–2 | Mixed-writer continuity, fenced whole-Goal rehearsal, export/rollback and cohort evidence. |
32343234
| L9 default and bounded retirement | 1 | New-Goal onboarding/settings/install choose the qualified profile; remove final obsolete callers. |
32353235

3236-
The retained-Monitor cycle slice removes a concrete L4 hold, not an entire
3236+
The retained-Monitor cycle and grouped executor closure remove concrete L4 holds, not an entire
32373237
remaining package: the **5–8 PR planning range remains conditional**, rather than
32383238
subtracting one for a lifecycle fix. Actual remaining executor/caller coverage,
32393239
L5 consumers, contributor-owned D2, integrated migration and default onboarding

‎docs/architecture/rfcs/typescript-control-plane-migration-v0.md‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,24 @@ all T2 commands or authorize whole-Goal promotion.
783783
must be acquired explicitly. `todo_monitor_cycle.ts` owns shared update/poll
784784
admission, removing their duplicate actor/lease branches and correcting their
785785
soft-claim disagreement. No new Python transition owner or RPC is introduced.
786-
Other lifecycle callers, executor acquisition for grouped reconciliation,
787-
legacy persistence/capture and whole-Goal qualification remain separate.
786+
Grouped reconciliation now plans the complete bucket set in
787+
`capabilities/issue_fix_monitor_reconciliation.ts`; Python retains ledger IO,
788+
public writer calls and display delivery. The caller acquires its own bounded
789+
execution for hard-lease observations/stops, rechecks the plan after acquisition,
790+
and releases only that attempt. Retry after an observation commit can clean up
791+
a surviving lease without repeating the business mutation. Reactivation remains
792+
a non-execution transition through the existing TS owner.
793+
Missing/malformed ledger evidence, duplicate active targets and older empty
794+
observations now reject instead of silently dropping or completing a target.
795+
Membership hashes preserve the original Python Unicode/ASCII encoding contract.
796+
Explicit runtime-root routing reaches every affected writer and readback.
797+
This is a complete issue-fix caller closure, not an atomic transaction over all
798+
buckets: earlier committed buckets survive a later failure. Unchanged retries
799+
may release their own interrupted execution and drain display. The remaining
800+
Python adapter is a real caller, not a removable compatibility wrapper.
801+
See the [operator contract](../../../loopx/capabilities/issue_fix/README.md#pr-lifecycle-monitor).
802+
Other lifecycle callers, external-effect execution fences, legacy
803+
persistence/capture and whole-Goal qualification remain separate.
788804
- Preserve unchanged polling/reschedule behavior, generation fences,
789805
material-change successor deduplication and accountable settlement.
790806
A monitor remains non-executable delivery context; its independent

‎docs/architecture/rfcs/typescript-control-plane-migration-v0.zh-CN.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,17 @@ delivery pending;这不代表全部 T2 命令或整 Goal promotion 已完成
594594
raw patch 权限或轮询引擎。完成后的新观察即使 hash 相同也推进新一代;历史重放
595595
不会重开当前任务。无变化的分组也能恢复显示,包括带优先级前缀的 native 文本。
596596
见[观察更新与再激活](../../reference/protocols/quota-monitor-observation-receipt-v0.md#observation-updates-and-reactivation)。
597-
保留 execution lease/hard-lease 模式的再激活、其他 lifecycle caller、旧持久化/
598-
capture 和整 Goal 资格仍是独立边界。
597+
再激活已由既有 TS owner 原子退役旧 execution;分组对账的完整桶集合决策现由
598+
`capabilities/issue_fix_monitor_reconciliation.ts` 负责,Python 保留 ledger IO、
599+
公开 writer 调用和展示交付。hard-lease 观察/结束先领取自己的有限期 execution,
600+
领取后重新核对计划,只释放本次执行。观察提交后进程退出,原样重试可清理残留
601+
lease,不重复 Todo 业务写入;再激活本身仍不授予执行权。
602+
缺失/损坏 ledger、重复活动 target、旧的空组观察现在明确拒绝;成员 hash 保留
603+
Python 原有 Unicode 排序及 ASCII 转义合同。显式 runtime-root 贯穿读取和写回。
604+
这是 issue-fix 调用链闭合,不是所有桶的一笔原子事务:后续桶失败不回滚之前已
605+
提交的桶。无变化重试可以清理自己的中断 execution 并恢复展示。Python 适配器仍
606+
有真实调用方,不能直接删除。其他 lifecycle caller、跨外部 effect 的围栏、旧持久化/
607+
capture 和整 Goal 资格仍独立。见[操作合同](../../../loopx/capabilities/issue_fix/README.zh-CN.md#pr-lifecycle-monitor)。
599608
- 保持 unchanged poll/reschedule、generation fence、material-change successor
600609
去重和可归属 settlement。Monitor 不是 delivery 执行任务;独立 advancement Todo
601610
不能被 monitor 自身替代。

‎loopx/capabilities/issue_fix/README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,35 @@ private material remain explicit gates. Each material transition must yield a
10541054
`runnable_successor`, concrete blocker, or structured no-follow-up; unchanged
10551055
polls remain quiet and do not spend delivery quota.
10561056

1057+
With `--execute-transition`, one Monitor represents each nonempty repository/state
1058+
bucket. Membership changes advance its observation generation; an empty bucket
1059+
ends it, and a newer nonempty observation reopens the same unarchived Todo. New
1060+
Monitors use explicit `priority=P2`; their text is not a priority argument.
1061+
1062+
In `hard_lease` mode the reconciler acquires a 60-second execution lease for
1063+
observation/stop and releases that exact execution afterward. It never borrows
1064+
another attempt merely because the Agent ID matches. An identical retry can
1065+
recover its own active acquisition; after a committed observation it cleans up
1066+
its remaining lease without repeating that business write. Expired or released
1067+
attempts require fresh acquisition. Reactivation itself grants no execution.
1068+
The existing `--runtime-root` override applies to reads, leases, writes and
1069+
projection recovery. No new provider or capability is enabled.
1070+
1071+
Missing ledger files, malformed bucket declarations, duplicate current targets,
1072+
and older empty observations are errors, not evidence that all work has ended.
1073+
Restore the ledger or resolve the duplicate before retrying; do not switch to
1074+
legacy state. Buckets commit independently, so after a later failure read back
1075+
`loopx todo list --goal-id GOAL` using the same registry/runtime root, then retry
1076+
the original observation. `write_performed` describes Todo business writes;
1077+
lease cleanup and current display delivery may still happen on an unchanged
1078+
retry. Pending display is recoverable with `loopx todo project-markdown` and
1079+
never rolls back a successful business commit.
1080+
1081+
Omit `--execute-transition` to inspect without reconciling Todos. To roll back
1082+
this implementation, retain canonical state, writer fences and receipts; restore
1083+
compatible code instead of reviving old Markdown authority. This does not grant
1084+
publication, merge, additional capabilities or access to private material.
1085+
10571086
Pass `--issue-ref` when persisting PR lifecycle state. This explicit public-safe
10581087
link lets the outcome read model join the PR to its issue without guessing from
10591088
branch names, titles, or text.

‎loopx/capabilities/issue_fix/README.zh-CN.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,27 @@ review、maintainer correction、mergeability、stale branch 和 terminal status
927927
transition 必须生成 `runnable_successor`、具体 blocker 或结构化 no-follow-up;
928928
unchanged poll 保持安静且不消耗 delivery quota。
929929

930+
`--execute-transition` 为每个非空的「仓库/状态」分组维护一个 Monitor。成员变化
931+
推进观察 generation;空组结束;完成后的新非空观察重新开启同一个未归档 Todo。
932+
创建时通过显式 `priority=P2` 传入优先级,不再把正文当前缀参数使用。
933+
934+
`hard_lease` 模式的观察/结束先领取 60 秒 execution lease,之后只释放这次执行。
935+
Agent ID 相同也不能借用另一轮的 lease。原样重试可以恢复自己的活动领取;观察
936+
提交后进程退出,重试清理残留 lease 而不重复业务写入。到期或已释放的旧执行需要
937+
重新领取;再激活本身不授予执行权。已有 `--runtime-root` 参数贯穿读取、租约、
938+
写入和显示恢复,不新增 provider 或 capability 启用方式。
939+
940+
缺失 ledger、损坏的分组声明、重复活动 target、旧的空组观察都会报错,不能当作
941+
「工作已全部结束」。恢复 ledger 或解决重复项后重试,不回退旧存储。各桶独立提交,
942+
后面的桶失败不会回滚前面的桶;用同一 registry/runtime root 执行
943+
`loopx todo list --goal-id GOAL` 读回,再重试原观察。`write_performed` 只表示 Todo
944+
业务写入;无变化重试仍可能清理 lease 和恢复当前显示。显示 pending 可通过
945+
`loopx todo project-markdown` 重试,不回滚已提交业务。
946+
947+
不传 `--execute-transition` 即只检查而不对账 Todo。回滚实现时保留 canonical
948+
state、writer fence 和 receipt,恢复兼容代码,不能复活旧 Markdown authority。
949+
该过程不授予发布、合并、新 capability 或私有材料访问权限。
950+
930951
持久化 PR lifecycle 时应传入 `--issue-ref`。这个显式、public-safe 的关联让 outcome
931952
read model 可以把 PR 精确连接到 issue,而不用从分支名、标题或正文中猜测。
932953

‎loopx/capabilities/issue_fix/cli.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,7 @@ def handle_issue_fix_command(
13151315
raise ValueError("PR lifecycle transition is missing")
13161316
grouped_monitor_writeback = materialize_issue_fix_grouped_monitors(
13171317
registry_path=registry_path,
1318+
runtime_root=Path(runtime_root_arg).expanduser() if runtime_root_arg else None,
13181319
goal_id=args.goal_id,
13191320
project=Path(args.project).expanduser(),
13201321
ledger_path=ledger_path,

0 commit comments

Comments
 (0)