implement-authoritative-lifecycle

Implement authoritative lifecycle transition core

Metadata

Statusdone
Assignedagent-881
Agent identity6841f97a7a8e6cbc213051ce0ffb3c85c92c80cb61fd699428ab3fed6cb6ba94
Created2026-07-26T10:24:07.428041195+00:00
Started2026-07-26T11:47:11.917397659+00:00
Completed2026-07-26T13:34:40.666796400+00:00
Tokens61895672 in / 77951 out

Description

Objective

Implement the first production phase of the ratified simplified lifecycle design: one authoritative transition API/event path, explicit actor/reason metadata, and invariant enforcement. Follow the design's staged migration; do not attempt an unreviewed flag-day rewrite. This task owns the shared lifecycle/coordinator transition seams before the serialized admission and lazy-evaluation tasks modify those seams.

Required outcomes

  • Centralize status/attempt transitions behind the designed authority and migrate the highest-risk writers first: dispatcher/reconciler, message handling, spawn/admission breaker, worker completion, retry/reset/recover, and evaluation handoff.
  • Ordinary messages never mutate task state, liveness, or eligibility; explicit wait-on-message remains supported.
  • Separate admission deferral, process/attempt failure, source completion, evaluator evidence, and worktree merge state.
  • Enforce idempotency/fencing under duplicate events, daemon restart, stale worker exit, and concurrent commands.
  • Add transition audit diagnostics and preserve backward-compatible graph replay/migration.

Validation

  • Failing model-based tests are written first from the design matrix (including named cases for irrelevant-message delivery, stale exits, duplicate completion, admission deferral, and evaluation handoff) and fail against the pre-change implementation.
  • Implementation makes the RED transition suite pass.
  • A disposable credential-free live human flow starts the real daemon, drives CLI/terminal task and message actions, and proves irrelevant message delivery cannot reopen/resume/keep alive a task; it is not a library-only substitute.
  • Crash/restart, stale worker, retry, admission, evaluation, and merge scenarios are deterministic and idempotent.
  • Existing graph fixtures migrate without silent status changes.
  • Permanent smoke scenarios cover the real daemon/CLI flow and are registered with this task in tests/smoke/manifest.toml owners.
  • cargo fmt --check, cargo clippy, focused suites, cargo build, and cargo test pass with no regressions.

Depends on

Required by

Messages 7 messages (7 unread)

  1. #1user2026-07-26T11:06:11.546799979+00:00delivered
    Permanent RED scenario required from lambda01 trace: fail -> late done -> low evaluation -> pending message -> reopen -> stale Done-attempt worktree -> five spawn failures -> breaker -> manual done -> same message reopen -> reset Ready/spawned=0. New core must make that sequence impossible and assert ordinary terminal-task messages cannot change state.
  2. #2design-simplified-authoritative2026-07-26T11:32:16.299929079+00:00delivered
    Ratified lifecycle design is ready at docs/design-simplified-task-lifecycle.md. Core implementation contract: one LifecycleKernel::transition + append-only ledger; terminal generations never reopen; attempt/fence CAS; worktree lease epochs; breaker-neutral ReconciliationIssue; staged migration in §17 and permanent tests in §18.
  3. #3implement-authoritative-lifecycle2026-07-26T11:47:36.037711543+00:00read
    Acknowledged both queued requirements — I will implement the ratified LifecycleKernel path and add a permanent daemon/CLI regression covering the lambda01 late-done/message/retry sequence, with ordinary terminal-task messages proven state-neutral.
  4. #4user2026-07-26T11:51:16.457706280+00:00read
    URGENT current live reproduction at 11:47: messages sent after deep-survey-of completed caused coordinator to auto-create and spawn `.respond-to-deep-survey-of`; I killed/abandoned agent-882. Prioritize a first isolated patch/commit/install that removes BOTH terminal-source reopen and automatic `.respond-*` child creation from pending messages. Only explicit live Waiting(Message)+matching epoch may resume. Land and validate this emergency invariant before broader kernel work; coordinate so `stop-messages-from` can become independent verification rather than conflicting implementation.
  5. #5implement-authoritative-lifecycle2026-07-26T12:17:52.553087372+00:00read
    Acknowledged urgent live incident. The working patch already deletes both Done→Open and  creation; I am now splitting that invariant into the requested first isolated coordinator commit, running its focused test, installing the binary, then continuing the kernel.
  6. #6implement-authoritative-lifecycle2026-07-26T12:17:59.159863573+00:00read
    Correction: the isolated emergency commit removes both terminal-source reopen and automatic .respond-* child creation.
  7. #7implement-authoritative-lifecycle2026-07-26T12:24:01.855790059+00:00read
    Emergency patch landed: c29ed648 pushed and exact commit installed globally. Focused terminal-message and no-child tests pass. Continuing authoritative kernel now.

Log