loopx icon indicating copy to clipboard operation
loopx copied to clipboard

[Task]: Add the source-session Goal lifetime transaction

Open Duang777 opened this issue 2 months ago • 0 comments

Task ID or area

Goal instance identity M2

Technical direction

Core control-plane hardening

Goal and acceptance gap

Goal/source: the Goal instance identity and orphan recovery RFC merged in #4914, with M1 characterization implemented by #4930.

Current gap: M1 classifies exact Goal references but remains observe-only. Project session bindings and Goal recreation still use the reusable goal_id alias, so a process that captured lifetime A can resume after same-alias recreation and bind lifetime B.

Accepted outcome: one opt-in, fresh-project-only v2 profile publishes immutable Goal instance identity before the registry is exposed; source Goal lifecycle and project session binding share an alias-scoped commit guard; exact receipts make bind, unbind, and recreation replayable; stale A produces no B binding or ownership change.

Proposed scope

In scope / owner:

  • Extend the existing project-registry codec with the incompatible loopx_project_registry_envelope_v2 / goal_instance_v2 format.
  • Add the code-owned source_session_v1 profile for fresh project registration only. It has no global route and no host/runtime execution authority.
  • Reuse M1 GoalRef parsing and add typed bind, unbind, recreation, replay, capacity, and profile-denial decisions.
  • Add one alias-scoped cross-runtime lifetime guard with the lock order lifetime guard → project registry transaction.
  • Stamp project session bindings and immutable operation receipts with exact GoalRef.
  • Reserve replacement instance B before one registry publication replaces A; replay returns B and competing operations cannot mint C.
  • Add bounded receipt capacities with fail-closed new operations and replay at capacity.

Existing related work / dependencies:

  • #4914 is the normative design source.
  • #4930 is the stacked M1 base and remains behavior-preserving.
  • The project-registry transaction and I/O census from #4917 remain the only codec and atomic write path.

Out of scope:

  • activating or migrating an existing project registry;
  • global projection, host execution, Turn, quota, Todo/lease, handoff, channel, heartbeat, or automation qualification;
  • orphan discovery or provider-state adoption;
  • treating project resolution as execution authority;
  • changing the four-phase Turn settlement order.

Staged remainder: M3 qualifies every supported effect owner before ordinary activation or global routing can open. M4 owns orphan recovery.

Intended base branch

codex/goal-instance-m1 until #4930 lands; then retarget to main.

Relevant files or commands

  • docs/architecture/rfcs/goal-instance-identity-and-orphan-recovery-v0.md
  • loopx/control_plane/goals/goal_instance_identity.ts
  • loopx/control_plane/projects/registry_codec.py
  • loopx/control_plane/projects/registry.py
  • loopx/cli_commands/project.py
  • loopx/semantics/goal_instance_binding_inventory_v1.json
  • loopx project register
  • loopx project bind-session
  • loopx project unbind-session
  • loopx project resolve

Validation plan

Accepted result and independent oracle:

  • a fresh real CLI registration creates one v2 source-only registry with one immutable instance A and no global route;
  • legacy object and strict-envelope-v1 commands retain exact behavior and registry bytes;
  • M1 rejects v2, while every unqualified M2 read-to-effect route rejects before business state or receipts change;
  • a real bind subprocess captures A and pauses, a real lifecycle subprocess recreates B, and resumed A writes no B binding, receipt, or ownership change;
  • same-operation replay returns the original A or B; conflicting operation-key reuse and capacity exhaustion fail before mutation;
  • process-kill and write/readback fault matrices prove pre-publication no authority and post-publication forward-only recovery.

Actual entrypoint / safe command:

loopx --registry <fixture> --format json project <register|bind-session|unbind-session|recreate-goal|resolve> ...

Negative or recovery case:

Pause bind(A) after exact-reference capture, recreate B under the same alias, resume bind(A), and compare the complete v2 registry preimage/postimage.

Frontend / Lark / CLI impact:

CLI-only opt-in profile and additive JSON fields. Existing commands and Markdown remain unchanged for legacy/v1 projects. Frontend and Lark are explicitly unqualified and reject this profile.

Public/private boundary

  • This issue contains only public repository paths and synthetic identifiers.
  • It contains no credentials, private traces, raw sessions, or internal links.
  • No maintainer-owned benchmark or paid workload is requested.

Duang777 avatar Sep 23 '26 08:09 Duang777