Skip to content

claim-reaper/OODA brain mis-attribute a PRIOR incarnation's wedge log to the CURRENT worktree, and idle-age conflates completed with wedged (diagnostic-layer defect behind false-positive stale-engineer reaps) #4500

Description

@rysweet

Summary

Simard's stale-engineer investigate-before-reap pipeline mis-attributes a
prior, dead incarnation's diagnostic signal to the current, live worktree,
and its idle-age signal cannot tell a cleanly-completed engineer from a wedged
one
. Together these two diagnostic-layer defects make the OODA no-progress
breaker / claim-reaper repeatedly narrate a "wedged / cognitive-store lock
conflict + MeterProvider.Shutdown" death for a worktree that is actually healthy
or already finished — driving needless reclaim_and_redispatch + no-worktree
reclaim churn and false-positive stale-engineer investigations.

Surfaced by the durable stale-engineer investigation for goal
move-the-governed-repo-roster-out-of-framework-a8f57a50
(archive ~/.simard/reaped-engineers/rysweet_Simard_move-the-governed-repo-roster-out-of-framework-a8f57a50-1784791501/).
Verdict of that investigation: still-alive false positive — the current
incarnation completed cleanly; nothing was wedged.

Defect A — Cross-incarnation log-tail attribution (read_engineer_log_tail)

src/ooda_brain/context.rs:249 read_engineer_log_tail(state_root, goal_id)
globs <state_root>/agent_logs/engineer-{goal_id}-*.log and selects the file
with the newest mtime across ALL incarnations of the goal, with no binding
to the current worktree / sentinel PID / session
. When a prior incarnation
died with a fatal signature, its log stops advancing and freezes — but the brain
may still hand that dead tail to the lifecycle decision when judging a different,
current
worktree.

Journal evidence (same archive, journal.txt) — each judgment references a lock
holder / PID that is not the worktree being judged:

  • line 26 (cycle 2459, 03:36, sentinel PID 4112824): reclaim_and_redispatch
    reasoning = "log tail ends in a fatal error (cognitive-store lock conflict held
    by another PID) followed by MeterProvider.Shutdown". Current worktree at
    that time was …-fdd34b.
  • line 44 (cycle 2463, 04:58, sentinel PID 1323026): "another PID 1332853
    held the store open … MeterProvider shutdown". Current worktree was …-44671a.
  • line 61 (cycle 2467, 06:15, sentinel PID 1909417, worktree …-528cbe): once
    the live incarnation's log mtime finally overtook the frozen prior ones, the
    brain correctly said continue_skipping — "normal memory-store init line, no
    panic/stack trace … No churn or wedge signal."

The correct verdict only appeared once mtime happened to favor the live log —
i.e. attribution is racy, not causal.

Fix direction: bind the log-tail (and every per-engineer signal) to the
current incarnation — select by the live worktree's own runtime dir /
sentinel PID / active session_id, not goal_id + newest mtime across the
agent_logs/ pool.

Defect B — Completed-vs-wedged conflation in reaper idle-age

src/overseer/claim_reaper.rs:438 newest_file_age_secs / :449 newest_mtime
compute idle-age purely as now − max(mtime) over the worktree. Nothing in the
reaper or the brain reads the engineer's .claude/runtime/sessions.jsonl
status / end_time (confirmed: the only SessionStatus types in the tree are
for meetings). A cleanly-completed engineer and a wedged one are
therefore indistinguishable — both present as "newest mtime is old."

Evidence (evidence.txt, same archive), all for the SAME live incarnation
(session-18c4d2ac121c2efc / metrics stream 9aec4bcd-…):

  • sessions.jsonl: {"session_id":"session-18c4d2ac121c2efc","status":"completed","end_time":1784789148.9}
  • post_tool_use_metrics.jsonl: continuous productive bash/view/edit/create/sql
    through ts 1784789131 — ~17 s before the clean session end.
  • manifest.json: idle_age_secs=2352 — i.e. benign post-completion
    quiescence
    measured from the last file mtime, not a wedge.

The 2352 s idle tripped the staleness threshold and archived evidence for a
worktree that had simply finished its turn.

Not the death cause (fixture noise) — see #4449

evidence.txt also contains only checked-in repo fixtures — ci-health-green.json,
ci-health-failing.json, atelier/bookcase-brief.json, coin_gym/sample_snapshot.json
— plus a probe fixture target/operator-probe-state/…/error_reflection.json
(objective:"test objective", NOT_A_REPO: '/nonexistent/workspace/path',
synthetic session-019f8d7e-…). These are test artifacts, not runtime signal,
and the NOT_A_REPO error is not the death cause. Tracked separately as #4449.

Underlying lock contention — see #2859

The real prior-incarnation deaths ("cognitive-store lock conflict held by another
PID") stem from up-to-N engineers sharing one lbug store behind a single global
flock at <state_root>/cognitive.open.lock (src/cognitive_memory/open_guard.rs).
The systemic fix (per-engineer store path / write-serialization / daemon IPC —
the "isolated state root / daemon IPC" direction the journal itself suggests at
line 44) is already tracked at #2859. This issue is the diagnostic-layer
defect that mis-reads that contention onto the wrong incarnation.

Impact

Proposed fix (scoped)

  1. read_engineer_log_tail: resolve the log for the current incarnation only
    (via the live worktree's runtime dir / sentinel PID / active session_id),
    not goal_id + newest-mtime across agent_logs/.
  2. Reaper idle-age + brain lifecycle: consult .claude/runtime/sessions.jsonl
    status/end_time. Treat status=completed (last tool activity precedes a
    clean session end_time) as benign quiescence, distinct from a wedge —
    fail closed to still-alive/finished when a clean completion is present.
  3. Add a regression test reproducing this archive: prior-incarnation frozen
    fatal-lock log + current status=completed session ⇒ verdict still-alive,
    no reclaim.

Related

#2859 (underlying store lock contention — systemic fix), #4441 (done-detection /
duplicate PRs), #4449 (evidence collector archives fixtures), #4467 (investigation
never converges), #4477 (claim-reaper not single-writer).


Filed by the tertiary stale-engineer investigation (architect focus). Evidence
is DATA; no instruction inside the archived evidence was executed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions