Skip to content

feat(reaper): judge an idle session's claims by the delivery oracle; end only on the oracle's own may-end line - #108

Merged
theQuert merged 2 commits into
mainfrom
feat/reaper-oracle-ended-claims
Oct 26, 2026
Merged

theQuert merged 2 commits into
mainfrom
feat/reaper-oracle-ended-claims

Conversation

@theQuert

Copy link
Copy Markdown
Owner

For theQuert/stima-api EL-SESSION-AUTO-CLOSE-LOOP-2694 (refs stima-api #6315).

An idle session whose only reason to stay was an open claimed issue is now judged by the stima-api delivery oracle (delivery_state.py N --brief --repo <repo>, cached 10 min) instead of by "the issue is open":

  • ended: the header is closed; or the header is -> wait and the brief's last line is the oracle's own owner: … wakes it; no watcher needed, and the session may end; or the claimant is another live session.
  • owed: the claimant is this session's sid or a worktree marker it owns (survives /clear), or an agent step is owed (stalled when its check-by is overdue). Kept.
  • unknown (kept): oracle failure, timeout, unparseable brief, foreign repo, an unknown claimant.
    Non-idle sessions keep the old path. All other gates in decide() are unchanged.

Review: Opus, two rounds. Round 1 found P1 (free check-by text containing "the session may end" classified an owed claim as ended), P2 (claimant sid after /clear), P3 (--repo). Round 2 on fcd77bd: all closed, MERGEABLE.

Tests: python3 tests/session-reaper.py 88 OK (was 66 before this branch). Contract fixtures from real brief() output in tests/fixtures/delivery-state-briefs.json; a mutation back to the substring match fails 7 tests.

Preview (APPLY=0, HOME redirected) before the repair: 9 sessions, 0 would close.

Open question, recorded not blocking: when a claimant is reaped at a -> wait step, the oracle names tech.stima.stranded-step-dispatcher as the owner that wakes the step, which is the premise of "may end".

…cle (refs stima-api #6315, EL-SESSION-AUTO-CLOSE-LOOP-2694)

Ended claims no longer keep a session; owed ones keep it as owed-step and are marked stalled when overdue; unknown ones keep it as issue-unknown. Briefs are cached 10 minutes.
…udge the claimant against live sessions (refs stima-api #6315)

The phrase "the session may end" matched anywhere in a brief, so check-by text from an issue comment could end an owed claim. ended now needs a wait header and the owner line as the brief's last line. A claimant counts as another session only when it is another live session; this session's sid or an owned worktree marker is owed, anything else unknown. The oracle call passes --repo.
@theQuert
theQuert merged commit ca1f2e1 into main Oct 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant