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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: clarify forge claim evidence and remove stale retry assumptions (#13226)
Adam Eivy5a81dc5bc256
diff --git a/server/services/cosTaskPrompts.js b/server/services/cosTaskPrompts.jsindex 9ffeb389d1..0699d0b92d 100644--- a/server/services/cosTaskPrompts.js+++ b/server/services/cosTaskPrompts.js@@ -23,9 +23,12 @@ export function normalizeWorkItemRef(ref) {const forgeIssueConstraint = (forge, claimantGuard = () => '') => (ref, excludeLabelsBlock) => {const labels = excludeLabelsBlock || '`in-progress`, `blocked`, `needs-input`';+ const changeEvidence = forge === 'GitHub'+ ? 'an open PR whose body closes/fixes the issue or whose head commits reference it'+ : 'an open MR on its claim branch';return `## Target Issue Constraint-The user explicitly selected ${forge} issue #${ref}. Override Phase 1 ("Pick the target issue"): do NOT pick a different issue and do NOT scan for the next eligible one — claim exactly #${ref}, ignore the author filter above. An explicit selection does not override existing claim ownership: any assignee (including this login), an in-progress marker, or an open PR/MR covering the issue means another run is in flight unless this run proves it created the matching claim branch.${claimantGuard(ref)} Still honor the safety checks: if #${ref} is already closed, already carries any of ${labels}, is already on a \`claim/issue-${ref}\` (or \`cos/.../issue-${ref}/...\`) branch, or is stale (Phase 3), exit cleanly rather than forcing it. A continuation of this same run may resume its own recorded branch and PR after verifying the run ownership; matching the GitHub login or merely finding a branch is never proof. **If #${ref} is a tracking epic, do NOT exit** — run Phase 1b against it: claim the next eligible issue already linked from it, or, when it has none, decompose it into per-slice issues first and then claim the first slice. That is the one case where this run legitimately ships an issue other than #${ref}. Otherwise run Phases 2–7 against #${ref}.`;+The user explicitly selected ${forge} issue #${ref}. Override Phase 1 ("Pick the target issue"): do NOT pick a different issue and do NOT scan for the next eligible one — claim exactly #${ref}, ignore the author filter above. An explicit selection does not override existing claim ownership: any assignee (including this login), an in-progress marker, or ${changeEvidence} means another run is in flight unless this run proves it created the matching claim branch.${claimantGuard(ref)} Still honor the safety checks: if #${ref} is already closed, already carries any of ${labels}, is already on a \`claim/issue-${ref}\` (or \`cos/.../issue-${ref}/...\`) branch, or is stale (Phase 3), exit cleanly rather than forcing it. A continuation of this same run may resume its own recorded branch and PR after verifying the run ownership; matching the forge login or merely finding a branch is never proof. **If #${ref} is a tracking epic, do NOT exit** — run Phase 1b against it: claim the next eligible issue already linked from it, or, when it has none, decompose it into per-slice issues first and then claim the first slice. That is the one case where this run legitimately ships an issue other than #${ref}. Otherwise run Phases 2–7 against #${ref}.`;};const githubClaimantGuard = (ref) => ` **It does not override a contributor's clear claim comment:** before any worktree or marker, first resolve \`REPO\` and \`GH_HOST\` exactly as Phase 1 steps 1–2 do, set \`CANDIDATE="${ref}"\`, and then run Phase 1 step 5's untrusted-comment check. When it finds a clear active claimant, assign that contributor, verify the readback, and exit without claiming the issue yourself. If the comment lookup or claimant handoff still fails after step 5's prescribed retry, exit without autonomous work; because this target is pinned, do not scan for a different candidate.`;diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.jsindex 40011a543c..2b8b0e0711 100644--- a/server/services/perpetualWork.js+++ b/server/services/perpetualWork.js@@ -27,7 +27,7 @@ import { runCliBounded } from '../lib/runCliBounded.js';import { readFile } from 'fs/promises';import { join } from 'path';import { emitLog } from './cosEvents.js';-import { parsePlanItems, extractAllIds, findInProgressIds, pickFirstAvailable, extractSlugFromRef } from '../lib/planIds.js';+import { parsePlanItems, extractAllIds, findInProgressIds, pickFirstAvailable } from '../lib/planIds.js';import { readOriginRemoteUrl } from '../lib/gitRemote.js';import { withGlabJson } from '../lib/glabArgs.js';import { githubApiHost, hostFromOriginUrl } from '../lib/workTracker.js';@@ -108,7 +108,7 @@ function runCli(cmd, args, cwd, env) {* Extract a GitHub issue number from a git ref ONLY when it matches a documented* claim pattern (`claim/issue-<num>`, `cos/<task>/issue-<num>/<agent>`, or the* slashdo `/do:next` branch `next/issue-<num>`, #8161).- * Reuses extractSlugFromRef so the ref-matching rules stay in one place.+ * Shares claimIssueNumber with the manual claim gate and PR evidence parser.*/export function issueNumberFromRef(ref) {return claimIssueNumber(ref);diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.jsindex dc94202acf..8637f4dcf4 100644--- a/server/services/perpetualWork.test.js+++ b/server/services/perpetualWork.test.js@@ -128,12 +128,6 @@ describe('perpetualWork', () => {expect(isActionableIssue({ ...base, assignees: [{ login: 'someone' }] })).toBe(false);});- it('rejects same-login assignment because a login does not establish run ownership', () => {- expect(isActionableIssue({ ...base, assignees: [{ login: 'Alice' }] }, new Set(), null, 'alice')).toBe(false);- expect(isActionableIssue({ ...base, assignees: [{ username: 'ALICE' }] }, new Set(), null, 'alice')).toBe(false);- expect(isActionableIssue({ ...base, assignees: [{ login: 'bob' }] }, new Set(), null, 'alice')).toBe(false);- });-it('rejects an in-flight issue number', () => {expect(isActionableIssue(base, new Set([7]))).toBe(false);});