fix-attempt-runtime-state-namespace

Namespace attempt runtime state by authoritative task identity

Metadata

Statusdone
Assignedagent-932
Modelpi:openai-codex:gpt-5.6-sol
Created2026-07-28T13:42:44.737359417+00:00
Started2026-07-28T16:28:22.031250707+00:00
Completed2026-07-28T17:07:06.099569377+00:00
Tokens15396824 in / 30960 out

Description

Objective

Eliminate cross-task collisions in .wg/attempts/attempt-G-N: attempt IDs are task-local, but observer/Pi runtime storage is globally keyed only by the bare attempt ID. After service restart, flip-first-required-gate began at attempt-0-1 while historical attempts 1–27 already existed; every spawn preparation hit observer source tuple mismatch, rolled back, and incremented until an unused number. No worker launched, but the coordinator produced a reservation storm and wg show projected unrelated stale Pi state.

Requirements

  • Key all attempt runtime state by authoritative (task_id, generation, attempt_id, fence, lease) or a content-addressed namespace; bare attempt ID must never identify storage globally.
  • Preserve and resolve historical flat attempt directories read-only; migrate/lazily index without deleting or relabeling evidence.
  • Preparation must detect an occupied foreign tuple before creating/removing worktrees, perform at most one breaker-neutral reconciliation, and either use the correct namespace or stop with one actionable diagnostic—never reservation-loop through IDs.
  • Watchdog/show/finalizer/observer must never read another task’s state, even during rollback/restart.
  • Preserve exact-session, candidate, process epoch, monotonic reservation and first-terminal fencing.

Validation

  • Two tasks both use attempt-0-1 concurrently/repeatedly with distinct observer/Pi/finalizer state and no collision.
  • Replay the 1–27 historical-directory shape; the next task launches once without source tuple mismatch or reservation storm.
  • Foreign stale state cannot appear in wg show for a new task.
  • Crash/restart at preparation and rollback is idempotent and breaker-neutral.
  • Historical evidence remains byte-identical and readable.
  • Existing spawn preparation, watchdog, observer and finalization smokes pass; fmt/clippy/tests/smoke, commit/push, wg done.

Depends on

Required by

Log