fix(daemon): a claim's stall finding goes to its owner first, then once to its orchestrator #4144
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4144"
general
weight: 0.35
mvschwarz
A stuck-sweep finding about a claimed row (stalled after its claim, or past its close-by time) went to the owner's orchestrator first. The pickup module's own contract says "routed to the claimant first, then its orchestrator", and only the owner can say whether its work is moving, so the orchestrator was left to investigate a row it didn't hold. Once filed, a finding was only refreshed: one that nobody answered never moved on. And working activity held a claim off
stalled-after-claimwith no limit, so "busy" could hide a stopped claim indefinitely.The change
Owner first. A finding about a claim goes to the row's owner, with the evidence #3999 added (the held-message count and a dated context sample). Its text now says:
Straight to the orchestrator when the owner can't act on it:
The existing no-wake re-routes (no wake route, a terminal seat) are unchanged.
Once, when unanswered. An owner's finding that's still unclaimed after the wake ladder's suppression window (30 min by default; no new setting), on a row that's still stuck, is handed to the owner's orchestrator: its
delegates_toparent, or itsescalates_toroute (the moved finding then carries the one-hop tag). An owner's finding also moves at once if the owner starts waiting on input, goes missing or is stopped. The moved finding is addressed to the orchestrator, so it never moves again. With no orchestrator, it stays with the owner."Busy" has a ceiling. Working activity holds a claim off
stalled-after-claimfor up to 4 hours (WORKING_ACTIVITY_CEILING_MINUTES, the workflow deadline's fallback for a step with noclosure_required_at). It's counted from the claim's last meaningful queue change, as the background-shell grace is. Past it, the stall is read and its finding goes to the owner first, so a false positive costs a busy owner one message, and any note on the row answers it. An explicitclosure_required_atstays the claim's deadline (overdue-claim, unchanged). Callers without a timestamp keep their count rule.What doesn't change
Downstream effect (the queue artery)
docs/reference/edge-types.mdanddocs/as-built/architecture/coordination-primitive.mdsay where a claim's finding goes.Tests
queue-stuck-sweep-owner-first.test.ts(15 cases): owner first with the held count and the dated sample; the one move after the bound, and none after it; an answer on the row; picking the finding up; no orchestrator; an owner waiting on input, from the start and later; a missing owner and a missing orchestrator; a stopped owner, from the start and later; an overdue claim; a folded row; and the working ceiling, in the sweep and inderivePickup. On main (aa40675d), 13 fail; the 2 that pass pin behaviour main already has (waiting on input goes to the orchestrator; callers without a timestamp).-
queue-stuck-sweep.test.ts, "#2758 new recovery uses the current source scope after the sweep awaits another row's wake": it used the orchestrator resolver as its listing-time probe, and owner first no longer asks it at listing, so the probe reads the row's firstgetByIdinstead.-
quiet-waiting.test.ts, "a failed notice escalates once within pickup grace plus sweep…": the blocker's own stall finding now goes to its owner first and, unanswered, moves once to the orchestrator 40 min later. That move is the one new send it now asserts; the waiter's notice still doesn't re-send.- the new file: 15/15 on
aa40675dwith this change, and 13 red without it;- the 43 daemon test files that touch the sweep or the pickup rule (1162 tests), green with the two updates above, on
e85e704cbefore #4133 and before the stopped-seat case;-
tsc --noEmitfor the daemon, clean onaa40675dwith this change;- the full daemon suite on
aa40675dwith this change is running; its result follows as a comment.6e6ae7b2; the two commits afteraa40675d(#4118 and #4138) touch none of these files.Refs #331
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Stuck-claim findings go to the task owner first, with immediate routing to an orchestrator when the owner is missing, stopped, or waiting for input.
Unanswered findings are handed off once after an answer window of at least 30 minutes, or twice the queue wake retry interval if longer. Meaningful task changes restart the window; notes do not change an accepted closure deadline.
Working activity delays stalled-claim findings only up to a ceiling measured from the last meaningful task change. A task note can answer a finding while work remains active.
Repeated detections reuse the existing finding without rerouting it.
Documentation
* Clarified claim routing, escalation timing, and fallback routes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->