Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: reconcile stale blocked issue labels during claims

[._.]/ Adam Eivy90f8d60d2ec4
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 263a0b3295..e053fd3dbb 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -10,8 +10,8 @@
"better-test-quality": "ab53a477cd194a5c4fbda09d901a3775",
"branch-cleanup": "8fdeb4acc2749816a47ca318b6602721",
"branch-reconcile": "45feea1d5ccd456bb0bec5d12c373a64",
- "claim-issue": "8afa24181b8923cfd35b5cd8e95b5bb5",
- "claim-issue-gitlab": "1c96d48a5dd85d3e9d5f442e73e3290d",
+ "claim-issue": "d735d14f7936ada5621b8e96b53549cc",
+ "claim-issue-gitlab": "cc66fbe92da7f2ecdcdaeb5b374b010a",
"claim-issue-jira": "d50f6fc210461108ea2eb24692da0a06",
"code-quality": "6762542233cdffb86d4e2244945bf52b",
"code-reviewer-implement": "2e10cac7c1e1cd021d06bfddb5c1eaf2",
@@ -64,8 +64,8 @@
"better-structural-drift": 1,
"better-test-quality": 1,
"branch-reconcile": 6,
- "claim-issue": 30,
- "claim-issue-gitlab": 27,
+ "claim-issue": 31,
+ "claim-issue-gitlab": 28,
"claim-issue-jira": 18,
"code-quality": 4,
"code-reviewer-a": 1,
@@ -153,7 +153,8 @@
"c57f3f92044bd53763d57db35fb77483",
"3138a2057377f1596f46bd64541e1100",
"5586ecf0fd11dc078c6b5a94714b72ad",
- "729e4c7e0d25f8c9e668727658bcb5b0"
+ "729e4c7e0d25f8c9e668727658bcb5b0",
+ "8afa24181b8923cfd35b5cd8e95b5bb5"
],
"claim-issue-gitlab": [
"fae92c45c89c65455930b4b06a1b88c4",
@@ -181,7 +182,8 @@
"7c9e23ed8b4ad76658a4333c02598c12",
"707bd0ad55e25d1b24726f837b93bf87",
"21b987fcc27f3fce711d481eb09f40b3",
- "749049f3c7e214379d516ed002a71e04"
+ "749049f3c7e214379d516ed002a71e04",
+ "1c96d48a5dd85d3e9d5f442e73e3290d"
],
"claim-issue-jira": [
"496638ec099de9d57686a61a015a3c03",
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index d00706cb66..3223ace7ce 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -50,6 +50,17 @@ const CONTRIBUTOR_RELEASE_GLAB = formatContributorLabelReleaseCommands('"${NUM}"
// `${CANDIDATE}` is likewise literal shell text set by the agent's own script.
const VOLUNTEER_CLAIM_GH = formatVolunteerClaimCommands('"${CANDIDATE}"').join('\n ');
+const ISSUE_BLOCKER_RECONCILIATION_GH = `**Reconcile stale \`blocked\` labels before selecting work.** For every open issue that
+has the \`blocked\` label, inspect its referenced blockers in the body, comments,
+and native blocked-by relationships. Re-read each blocker live; a blocker is
+satisfied only when it is closed (or its linked PR/MR is merged). If every
+referenced blocker is satisfied, remove the stale label and verify the readback
+(\`gh issue edit "<num>" --remove-label blocked\`), then treat the issue as
+eligible in this same run. If a blocker is still open, leave the label in place.
+If dependency lookup fails, preserve the label and report the uncertainty; never
+fail open. Apply the same reconciliation to GitLab with \`glab issue update
+"<iid>" --unlabel blocked\`.`;
+
const LINKED_ISSUE_INTENT_EVIDENCE = `Each PR carries a \`linkedIssues\` array — the number, title, and description of
every open issue it links, as the server read and screened them. That text is the
requirement this change is measured against; the PR's own title and description
@@ -2090,6 +2101,8 @@ Run steps 1–6 in order.
gh pr list --state open --json headRefName -q '.[].headRefName' 2>/dev/null
\`\`\`
For each ref (after stripping any leading \`origin/\` / \`upstream/\` prefix), extract the issue number **only when the ref matches** \`claim/issue-<num>\` (number after \`claim/issue-\`) or \`cos/<task>/issue-<num>/<agent>\` (the \`issue-<num>\` third segment). Do NOT flag an issue just because its bare number appears elsewhere in a ref.
+${ISSUE_BLOCKER_RECONCILIATION_GH}
+
4. **Build the target order:** walk the candidate list oldest-first in TWO passes. First pass, consider only NON-epic issues that satisfy every rule below — atomic work always outranks an epic, whatever their relative age. Only if that pass finds nothing do you make a second pass for an undecomposed epic (same rules), and an epic you eventually pick goes to **Phase 1b**, not Phase 2. A single oldest-first pass would enter a decomposition the moment an epic happened to be older than claimable work, which is exactly backwards. The rules:
- Its number is NOT in the in-flight set.
- It has no assignees, or at least one assignee's login matches \`$ME\` (an issue assigned only to another account is already claimed). If \`$ME\` is empty, skip every assigned issue.
@@ -2347,6 +2360,8 @@ Run steps 1–5 in order.
glab mr list --per-page 100 --output json # read each MR's source_branch
\`\`\`
For each ref (after stripping any leading \`origin/\` prefix), extract the issue number **only when the ref matches** \`claim/issue-<num>\` (number after \`claim/issue-\`) or \`cos/<task>/issue-<num>/<agent>\` (the \`issue-<num>\` third segment). Do NOT flag an issue just because its bare number appears elsewhere in a ref.
+${ISSUE_BLOCKER_RECONCILIATION_GH}
+
4. **Pick the target issue:** walk the candidate list oldest-first in TWO passes. First pass, consider only NON-epic issues and take the first that satisfies every rule below — atomic work always outranks an epic, whatever their relative age. Only if that pass finds nothing do you make a second pass for an undecomposed epic (same rules), and an epic you pick goes to **Phase 1b**, not Phase 2. A single oldest-first pass would enter a decomposition the moment an epic happened to be older than claimable work, which is exactly backwards. The rules:
- Its number (\`iid\`) is NOT in the in-flight set.
- It has no assignees, or at least one assignee's username matches \`$ME\` (an issue assigned only to another account is already claimed). If \`$ME\` is empty, skip every assigned issue.
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index 95d3a19782..7032d8a9d6 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -86,6 +86,10 @@ export const PROMPT_VERSIONS = {
'jira-status-report': 1,
};
+// Claim prompts now reconcile stale blocked labels whose blockers are closed.
+PROMPT_VERSIONS['claim-issue'] = 31;
+PROMPT_VERSIONS['claim-issue-gitlab'] = 28;
+
// Audit anchor for reference-watch's read/write coupling.
// The reference-watch schedule default (`taskMetadata.readOnly` in DEFAULT_TASK_INTERVALS)
// is derived from what the active prompt VERSION does: v3's prompt records proposals in the