Repository navigation
fix(goal): cancel pending reviews before session deletion - #42
Conversation
Add two ignored red regressions for K-GOAL-DELETE-RACE. Running them with --ignored reproduced the bug: session deletion leaves a pending reviewer request open, and a goal driver registers behind an active delete fence. The fix follows in this branch. Fmt, clippy, guards, and matrix passed. Workspace tests stop on the known macOS cgroup and /proc assumptions.
Track reviewer JoinHandles so abort and delete cancel pending model calls. Serialize reviewer and driver registration with the session delete fence, and cap pending reviews at 128 to keep the task registry bounded. Covers K-GOAL-DELETE-RACE and K-GOAL-REVIEW-BOUND; names D-GOAL-REVIEW-CAP. Focused goal tests, clippy, formatting, guards, and matrix pass. Workspace tests remain blocked by pre-existing macOS cgroup and /proc assumptions (8 failures).
Amendment to the contributor's branch (credited @jrzmurray), from the review. * spawn_wake_public called check_v1_session_admission -> session_exists while holding the parking_lot v2_drain_tasks mutex: a synchronous SQLite query under a lock on an async worker (both halves are separately banned; F1 class). The check is now in-memory only. The durable goal row already implies the session, and a session deleted in the gap is caught by the turn itself, which 404s. * A review deferred at the 128-entry cap was dropped: its only retrigger was the next human turn, so an overnight goal stopped silently. One retry owner now backs off 2-60 s over 6 attempts, counts review_deferred, and PAUSES the goal with an operator-visible reason if capacity never frees. All three post-turn call sites route through it. * goal_is_active reads the goal row, so it moved to run_blocking. Docs: D-GOAL-REVIEW-CAP rewritten to describe the retry; D-V2-DRAIN-CAP states that it is a COUNT bound and gives the real worst case; TESTING/TRACEABILITY rows added. Verified: 932 workspace tests, clippy -D under CARGO_BUILD_WARNINGS=deny, guards, matrix. Negative control: return after the first failed attempt and the goal stays active at rounds=0 until the 90 s timeout.
|
Thanks — the delete/review race is real and the fence is the right mechanism. Approved the workflows and pushed two commits onto your branch; I can split them into a separate PR if you prefer. The two things I changed
Evidence
932 workspace tests, clippy One note on scope: your |
Kept both sides: the permission and drain/delete rows from main, the goal-review cancellation row and the new deferred-retry row from this branch.
The Reliary#41 branch made check_v1_session_admission async; main's Reliary#42 branch added a call site that was written against the sync signature. Caught by check-matrix (workspace must build before the test-existence check runs), which is exactly what that fail-closed behaviour is for.
Summary
Dependency
This is stacked on PR #41, which adds the shared session delete fence and drain cancellation. Please review this after #41; the first commit in this branch is the #41 change.
Validation
cargo fmt --all -- --check— passedcargo clippy --workspace -- -D warnings— passedgoal_e2e— 13 passedscripts/check-guards.sh— passedscripts/check-matrix.sh— passedcargo test --workspace— 88 passed, 8 failed, 1 ignored. The failures are existing host assumptions for Linux cgroups and/procthat are unavailable in this macOS environment (uid-unknown, RSS probe); focused goal tests pass.