Skip to content

Engineer claim not released on session completion → leaked claim + 'goal disappeared before effect dispatch' (DownstreamFailed) no-worktree churn #4464

Description

@rysweet

Summary

An engineer instance completed cleanly (status=completed, exit 0) but its engineer_claim was never released on completion, so the claim leaked and the worktree sat idle 7009s until the overseer stale-engineer reaper picked it up. The completion→claim-release path is compounded by an effect-dispatch race: require_goal_repository raises permanent("goal disappeared before effect dispatch") (src/ooda_actions/advance_goal/typed_goal_session.rs:460), surfaced as CycleErrorCode::DownstreamFailed (src/typed_ooda/executor.rs), which then drives repeated reason=no-worktree immediate-reclaims while the worktree is transiently absent/re-created.

This is a completion → claim-release / effect-dispatch race (finished-unreported leak). It is related to but distinct from:

Concrete occurrence (durable evidence)

Triangulated across three independent sources in the archive:

  1. sessions.jsonl tail (evidence.txt L2 → L9): initial status=active registration, terminal update {"session_id":"session-18c4a54eb48ffa36","status":"completed","end_time":1784737025.79} → completed. All nested --version sessions also completed (L6-8).
  2. manifest.json: idle_age_secs=7009, archived_unix_ts=1784744035. 1784744035 − 7009 = 1784737026 ≈ end_time 1784737025.79 → the newest-file idle age is exactly the elapsed time since the session completed (16:17:05 UTC). The worktree went quiet because the engineer finished, not because it hung.
  3. journal.txt: L27 terminal heartbeat COMMAND_EXIT_CODE="0" / Script done ... exit; evidence.txt L424 cargo ... command_complete exitCode 0 (305 passed; 0 failed). Then L28 & L34 claim-reaper: reclaimed ... reason=no-worktree, verdict=no-investigation; L30 typed goal-session effect incomplete (DownstreamFailed): goal disappeared before effect dispatch; L35 worktree re-created (native git hooks enrolled in engineer worktree).

Actual system state at investigation: pid 3246134 not alive; worktree still registered (git worktree list → branch engineer/...-3285bd); no hard-fault signature (0 matches for panic/OOM/E2BIG/exit-126/SIGKILL across journal+evidence).

Root cause (candidate paths)

  1. No completion→claim-release hook. When an engineer session transitions to status=completed, nothing releases its engineer_claim through the release_engineer_claim chokepoint; the claim survives until the idle-staleness reaper investigates it ~2h later.
  2. Effect-dispatch/goal-lifecycle race. require_goal_repository (typed_goal_session.rs:452-461) reads active_goals.active at dispatch time; if the goal is momentarily absent (re-orient / roll_to_new_cycle for this standing goal), it returns permanent("goal disappeared before effect dispatch")DownstreamFailed, and the reaper's NoWorktree path immediately reclaims the claim whose worktree is transiently gone, then a new worktree is re-created — churn.

Impact

  • Leaked engineer-claim consumes a cap-limited admission slot for up to the staleness window after the work already finished.
  • no-worktree reclaim ↔ worktree re-create churn on a standing goal; noise that masks genuine liveness/reap reasoning.

Suggested fix direction

  1. Release the engineer_claim on session completion (drive status=completed through release_engineer_claim) so a finished engineer never idles as a leaked claim.
  2. Make the completion→effect-dispatch path race-free: treat "goal absent from active_goals.active at dispatch" for a standing/re-orienting goal as a benign no-op (or re-resolve the goal) rather than a permanent DownstreamFailed, so it cannot trigger a spurious NoWorktree reclaim + worktree re-create.
  3. Regression test: a session that reaches status=completed releases its claim within one tick; a standing goal mid re-orient does not raise goal disappeared before effect dispatch.

Dedup

Dedup key: simard-claim-not-released-on-completion:effect-dispatch-race-downstreamfailed:continuously-research-and-improve-your-own-cogn-70ab8541. Searched open+closed issues for claim-release/finished-unreported/DownstreamFailed/effect-dispatch/no-worktree — closest are #4441 and #4462 (related, distinct as noted above); no issue tracks the completion→claim-release/effect-dispatch race. Filing as a new systemic defect.

Filed by the stale-engineer investigator (Overseer investigate-before-reap, prompt_assets/simard/overseer/investigate_stale_engineer.md). Verdict: dead / finished-unreported. Durable evidence archive preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingworkflow:defaultCreated by default-workflow recipe

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions