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
feat([issue-4645]): let claim-issue/claim-work skip user-configured labels
[._.]/ Adam Eivy00a3b5d39dbc
diff --git a/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx b/client/src/components/cos/tabs/schedule/AppOverrideRow.jsxindex faf6921c3d..5fc6ad0968 100644--- a/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx+++ b/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx@@ -4,6 +4,7 @@ import CronInput from '../../../CronInput';import { AGENT_OPTIONS, BRANCHES_PER_AGENT_DEFAULT, BRANCHES_PER_AGENT_OPTIONS, BRANCHES_PER_AGENT_TASK_TYPES, ISSUE_AUTHOR_FILTER_OPTIONS, ISSUE_AUTHOR_FILTER_TASK_TYPES, PR_COMPLETION_OPTIONS, pinnedPrCompletion, prCompletionOption, SWARM_COUNT_OPTIONS, SWARM_TASK_TYPES, toggleAppMetadataOverride, agentOptionButtonClass } from '../../constants';import { isCronExpression, describeCron } from '../../../../utils/cronHelpers';import ToggleSwitch from '../../../ToggleSwitch';+import useFieldDraft from '../../../../hooks/useFieldDraft';import { INTERVAL_LABELS, setMetadataOverride } from './scheduleConstants';const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalIntervalType, globalTaskMetadata, managedAgentOptions, fileIssuesCapable, defaultFileIssues, override, onUpdate }) {@@ -70,6 +71,19 @@ const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalInterconst handleSwarmCountChange = (raw) => handleOverrideChange('swarmCount', raw === '' ? '' : Number(raw));const handleBranchesPerAgentChange = (raw) => handleOverrideChange('branchesPerAgent', raw === '' ? '' : Number(raw));+ // Comma-separated free text for the issueExcludeLabels override — an array+ // field, so it doesn't fit the scalar '' = inherit select pattern the other+ // overrides use. An empty box clears the override (inherits the global+ // list), matching every other override field here.+ const excludeLabelsDraft = useFieldDraft(+ (override?.taskMetadata?.issueExcludeLabels || []).join(', '),+ (next) => {+ const trimmed = next.trim();+ const value = trimmed === '' ? '' : trimmed.split(',').map((s) => s.trim()).filter(Boolean);+ return handleOverrideChange('issueExcludeLabels', value);+ }+ );+return (<div className="flex flex-col sm:flex-row sm:flex-wrap sm:items-center gap-2 sm:gap-3 py-2 px-3 rounded hover:bg-port-card/30"><div className="flex items-center gap-2 min-w-0 w-full sm:w-auto sm:flex-1">@@ -195,6 +209,20 @@ const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalInter</select>)}+ {ISSUE_AUTHOR_FILTER_TASK_TYPES.has(taskType) && (+ <input+ type="text"+ value={excludeLabelsDraft.value}+ onChange={excludeLabelsDraft.onChange}+ onBlur={excludeLabelsDraft.onBlur}+ disabled={updating}+ aria-label={`Labels to leave for humans for ${app.name}`}+ title={`Comma-separated labels to skip when auto-claiming (blank inherits: ${(globalTaskMetadata?.issueExcludeLabels || []).join(', ') || 'none'})`}+ placeholder="Inherit"+ className="bg-port-card border border-port-border rounded px-2 py-1.5 text-xs text-white min-w-[140px] min-h-[40px]"+ />+ )}+{SWARM_TASK_TYPES.has(taskType) && (<selectvalue={override?.taskMetadata?.swarmCount ?? ''}diff --git a/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx b/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsxindex f65a5951c2..ab0d4ce8f8 100644--- a/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx+++ b/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx@@ -80,6 +80,44 @@ describe('AppOverrideRow — After opening PR override', () => {});});+describe('AppOverrideRow — issue exclude labels override', () => {+ const excludeLabelsInput = () => screen.queryByLabelText('Labels to leave for humans for Acme');++ it('is absent for a task type without the issue author filter', () => {+ renderRow({ taskType: 'feature-ideas' });+ expect(excludeLabelsInput()).not.toBeInTheDocument();+ });++ it('seeds from an existing override and commits a parsed list on blur', async () => {+ const onUpdate = renderRow({+ taskType: 'claim-issue',+ globalTaskMetadata: { issueExcludeLabels: [] },+ override: { taskMetadata: { issueExcludeLabels: ['good first issue'] } },+ });+ expect(excludeLabelsInput()).toHaveValue('good first issue');++ fireEvent.change(excludeLabelsInput(), { target: { value: 'good first issue, help wanted' } });+ await act(async () => { fireEvent.blur(excludeLabelsInput()); });++ expect(onUpdate).toHaveBeenCalledWith('app-1', 'claim-issue', {+ taskMetadata: { issueExcludeLabels: ['good first issue', 'help wanted'] },+ });+ });++ it('clears the override back to inherit when the input is emptied', async () => {+ const onUpdate = renderRow({+ taskType: 'claim-work',+ globalTaskMetadata: { issueExcludeLabels: ['good first issue'] },+ override: { taskMetadata: { issueExcludeLabels: ['help wanted'] } },+ });++ fireEvent.change(excludeLabelsInput(), { target: { value: '' } });+ await act(async () => { fireEvent.blur(excludeLabelsInput()); });++ expect(onUpdate).toHaveBeenCalledWith('app-1', 'claim-work', { taskMetadata: null });+ });+});+describe('AppOverrideRow — file issues only', () => {it('shows the Iss toggle for audit-capable tasks and hides it otherwise', () => {renderRow({ taskType: 'feature-ideas' });diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex 4d72b2f48a..a0b55bec17 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -1,4 +1,5 @@import { useState, useEffect, useMemo } from 'react';+import useFieldDraft from '../../../../hooks/useFieldDraft';import { RotateCcw, AlertCircle } from 'lucide-react';import CronInput from '../../../CronInput';import { AGENT_OPTIONS, BRANCHES_PER_AGENT_DEFAULT, BRANCHES_PER_AGENT_OPTIONS, BRANCHES_PER_AGENT_TASK_TYPES, DEFAULT_REVIEW_STOP_MODE, IMPLICIT_PR_COMPLETION, PR_AUTHOR_FILTER_OPTIONS, PR_COMPLETION_OPTIONS, pinnedPrCompletion, prCompletionOption, ISSUE_AUTHOR_FILTER_OPTIONS, ISSUE_AUTHOR_FILTER_TASK_TYPES, SWARM_COUNT_OPTIONS, SWARM_TASK_TYPES } from '../../constants';@@ -54,6 +55,14 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTriconst [selectedType, setSelectedType] = useState(config.type);const [editingPrompt, setEditingPrompt] = useState(false);const [promptValue, setPromptValue] = useState(config.prompt || '');+ // Comma-separated free text, committed to taskMetadata.issueExcludeLabels+ // (an array) on blur.+ const excludeLabelsDraft = useFieldDraft(+ (config.taskMetadata?.issueExcludeLabels || []).join(', '),+ (next) => onUpdate(taskType, {+ taskMetadata: { ...(config.taskMetadata || {}), issueExcludeLabels: next.split(',').map((s) => s.trim()).filter(Boolean) }+ })+ );// Provider/model/effort pins are shared with the schedule card's quick// controls — same optimistic write + rollback, one implementation.const {@@ -415,6 +424,26 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri</div>)}+ {ISSUE_AUTHOR_FILTER_TASK_TYPES.has(taskType) && (+ <div>+ <label htmlFor={`issue-exclude-labels-${taskType}`} className="text-sm text-gray-400 block mb-2">Leave issues with these labels for humans</label>+ <input+ id={`issue-exclude-labels-${taskType}`}+ type="text"+ value={excludeLabelsDraft.value}+ onChange={excludeLabelsDraft.onChange}+ onBlur={excludeLabelsDraft.onBlur}+ disabled={updating}+ placeholder="good first issue, help wanted"+ className="w-full bg-port-card border border-port-border rounded px-3 py-2 text-white text-sm"+ />+ <p className="text-xs text-gray-500 mt-1">+ Comma-separated labels. An issue carrying any of these is skipped by autonomous claiming, on top of the fixed <code>in-progress</code>/<code>blocked</code>/<code>needs-input</code>/<code>future</code>/<code>wontfix</code>/<code>question</code>/<code>discussion</code> set.+ {' '}This is the global default — individual apps can override it below.+ </p>+ </div>+ )}+{SWARM_TASK_TYPES.has(taskType) && (<div><label htmlFor={`swarm-count-${taskType}`} className="text-sm text-gray-400 block mb-2">Swarm Mode</label>diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsxindex 755ffced00..6fb73f2786 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx@@ -149,6 +149,46 @@ describe('GlobalConfigControls — branch-reconcile batch size', () => {});});+describe('GlobalConfigControls — issue exclude labels', () => {+ it('is hidden for a task type without the issue author filter', () => {+ renderControls({ taskType: 'feature-ideas' });+ expect(screen.queryByLabelText('Leave issues with these labels for humans')).toBeNull();+ });++ it('seeds the input from the configured labels and commits a parsed list on blur', () => {+ const onUpdate = renderControls({+ taskType: 'claim-issue',+ taskMetadata: { issueAuthorFilter: 'self', issueExcludeLabels: ['good first issue'] },+ onUpdate: vi.fn().mockResolvedValue(undefined),+ });+ const input = screen.getByLabelText('Leave issues with these labels for humans');+ expect(input).toHaveValue('good first issue');++ fireEvent.change(input, { target: { value: 'good first issue, help wanted' } });+ fireEvent.blur(input);++ expect(onUpdate).toHaveBeenCalledWith('claim-issue', {+ taskMetadata: { issueAuthorFilter: 'self', issueExcludeLabels: ['good first issue', 'help wanted'] }+ });+ });++ it('commits an empty array when the input is cleared', () => {+ const onUpdate = renderControls({+ taskType: 'claim-work',+ taskMetadata: { issueExcludeLabels: ['good first issue'] },+ onUpdate: vi.fn().mockResolvedValue(undefined),+ });+ const input = screen.getByLabelText('Leave issues with these labels for humans');++ fireEvent.change(input, { target: { value: '' } });+ fireEvent.blur(input);++ expect(onUpdate).toHaveBeenCalledWith('claim-work', {+ taskMetadata: { issueExcludeLabels: [] }+ });+ });+});+describe('GlobalConfigControls — require approval', () => {it('toggles requireApproval on the task metadata', () => {const onUpdate = renderControls({ taskType: 'release-check', taskMetadata: { useWorktree: false, openPR: false } });diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex 5ed40c3b9a..b42545e645 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -1528,6 +1528,39 @@ export const PR_AUTHOR_FILTERS = ['any', 'self', 'others'];// vocabulary.export const ISSUE_AUTHOR_FILTERS = ['self', 'collaborators', 'owner', 'any'];+// `issueExcludeLabels` — extra labels a user wants left for human contributors+// (e.g. `good first issue`) rather than auto-claimed by claim-issue/claim-work.+// Unioned with the fixed NON_ACTIONABLE_ISSUE_LABELS set at read time+// (perpetualWork.js#isActionableIssue) — never replacing it. Capped well below+// GitHub/GitLab's own per-issue label limits; this is a short curated list, not+// an arbitrary label dump.+export const MAX_ISSUE_EXCLUDE_LABELS = 20;++/**+ * Normalize a raw `issueExcludeLabels` list: keep only non-empty strings,+ * trim, cap length per entry (GitHub's own label name limit), case-+ * insensitively dedupe (labels are compared lowercased at read time), and cap+ * the list at MAX_ISSUE_EXCLUDE_LABELS. Unlike reviewer usernames, label text+ * is free-form ("good first issue") so no character-class restriction is+ * applied beyond trimming. Non-array input → [].+ */+export function normalizeIssueExcludeLabels(list) {+ if (!Array.isArray(list)) return [];+ const seen = new Set();+ const out = [];+ for (const raw of list) {+ if (typeof raw !== 'string') continue;+ const trimmed = raw.trim().slice(0, 50);+ if (!trimmed) continue;+ const key = trimmed.toLowerCase();+ if (seen.has(key)) continue;+ seen.add(key);+ out.push(trimmed);+ if (out.length >= MAX_ISSUE_EXCLUDE_LABELS) break;+ }+ return out;+}+// claim-issue `--swarm` fan-out size. Mirrors slashdo `/do:next --swarm=<N>`,// which clamps N to 1..6 and treats bare `--swarm` as 3. Here a swarmCount of// 0 (or absent) means swarm OFF (the default one-issue-per-run flow); a value@@ -1672,6 +1705,14 @@ export function sanitizeTaskMetadata(raw) {clean.issueAuthorFilter = raw.issueAuthorFilter;hasKeys = true;}+ // `issueExcludeLabels` — like `usernames`/`optionalReviewers` above, an+ // explicitly empty array is KEPT (not dropped): `[]` is a meaningful "no+ // extra exclusions for this task/type" choice that must override a global+ // default's non-empty list, not silently inherit it.+ if (Array.isArray(raw.issueExcludeLabels)) {+ clean.issueExcludeLabels = normalizeIssueExcludeLabels(raw.issueExcludeLabels);+ hasKeys = true;+ }// `swarmCount` turns claim-issue `--swarm` fan-out on (2..6 parallel agents)// or off. 0 is kept as an explicit "off" (so a per-app override can disable// swarm even when the global default has it on — `0` = off, absent = inherit);diff --git a/server/lib/validation.test.js b/server/lib/validation.test.jsindex 36e6224db7..e9a78ed7fa 100644--- a/server/lib/validation.test.js+++ b/server/lib/validation.test.js@@ -940,6 +940,23 @@ describe('validation.js', () => {.toEqual({ useWorktree: true });});+ it('should normalize issueExcludeLabels: trim, dedupe case-insensitively, cap length, keep an explicit empty list', () => {+ expect(sanitizeTaskMetadata({ issueExcludeLabels: ['good first issue'] }))+ .toEqual({ issueExcludeLabels: ['good first issue'] });+ expect(sanitizeTaskMetadata({ issueExcludeLabels: [' good first issue ', 'Good First Issue'] }))+ .toEqual({ issueExcludeLabels: ['good first issue'] });+ // Explicitly empty is KEPT (a task/type override of "no extra exclusions"),+ // same discipline as optionalReviewers/usernames above.+ expect(sanitizeTaskMetadata({ issueExcludeLabels: [] })).toEqual({ issueExcludeLabels: [] });+ // Non-string entries and a non-array value are dropped/ignored.+ expect(sanitizeTaskMetadata({ issueExcludeLabels: ['ok', 42, null, ''] }))+ .toEqual({ issueExcludeLabels: ['ok'] });+ expect(sanitizeTaskMetadata({ issueExcludeLabels: 'good first issue' })).toBeNull();+ // Caps at MAX_ISSUE_EXCLUDE_LABELS (20).+ const many = Array.from({ length: 25 }, (_, i) => `label-${i}`);+ expect(sanitizeTaskMetadata({ issueExcludeLabels: many }).issueExcludeLabels).toHaveLength(20);+ });+it('should accept swarmCount 0 + 2..6 and drop 1/out-of-range/non-integer', () => {// 0 is an explicit "off" (kept so a per-app override can disable swarm).expect(sanitizeTaskMetadata({ swarmCount: 0 })).toEqual({ swarmCount: 0 });diff --git a/server/routes/apps/taskTypes.js b/server/routes/apps/taskTypes.jsindex 7e2c8db515..3f870d5c43 100644--- a/server/routes/apps/taskTypes.js+++ b/server/routes/apps/taskTypes.js@@ -78,12 +78,13 @@ router.get('/:id/work-items', loadApp, asyncHandler(async (req, res) => {const app = req.loadedApp;const requested = req.query.issueAuthorFilter;const explicit = ISSUE_AUTHOR_FILTERS.includes(requested) ? requested : undefined;- // Only read the app's claim-work config when it's actually the answer — an- // explicit filter (every drawer refresh after the first) already wins, and the- // read costs a schedule load plus a per-app override read.- const issueAuthorFilter = explicit- ?? resolveClaimAuthorFilter(undefined, (await resolveClaimWorkMetadata(app)).metadata);- const result = await listWorkItems(app, { issueAuthorFilter });+ // `issueExcludeLabels` has no query-param override (unlike the author+ // filter) — the drawer preview always reflects the app's configured value,+ // same as the claim agent will see, so the metadata read always happens.+ const claimMetadata = (await resolveClaimWorkMetadata(app)).metadata;+ const issueAuthorFilter = explicit ?? resolveClaimAuthorFilter(undefined, claimMetadata);+ const issueExcludeLabels = claimMetadata?.issueExcludeLabels ?? [];+ const result = await listWorkItems(app, { issueAuthorFilter, issueExcludeLabels });res.json({ appId: app.id, appName: app.name, issueAuthorFilter, ...result });}));diff --git a/server/routes/apps/taskTypes.test.js b/server/routes/apps/taskTypes.test.jsindex bc460b7a23..79df80196e 100644--- a/server/routes/apps/taskTypes.test.js+++ b/server/routes/apps/taskTypes.test.js@@ -66,7 +66,7 @@ describe('Apps Task-Type Routes', () => {const response = await request(app).get('/api/apps/app-001/work-items');expect(response.status).toBe(200);- expect(listWorkItems).toHaveBeenCalledWith(expect.objectContaining({ id: 'app-001' }), { issueAuthorFilter: 'any' });+ expect(listWorkItems).toHaveBeenCalledWith(expect.objectContaining({ id: 'app-001' }), { issueAuthorFilter: 'any', issueExcludeLabels: [] });// Echoed back so the picker's select shows what was actually scanned.expect(response.body.issueAuthorFilter).toBe('any');expect(response.body.items).toEqual([{ ref: '7', title: 'Fix the thing' }]);@@ -75,7 +75,7 @@ describe('Apps Task-Type Routes', () => {it('defaults to the self boundary when nothing is configured', async () => {await request(app).get('/api/apps/app-001/work-items');- expect(listWorkItems).toHaveBeenCalledWith(expect.anything(), { issueAuthorFilter: 'self' });+ expect(listWorkItems).toHaveBeenCalledWith(expect.anything(), { issueAuthorFilter: 'self', issueExcludeLabels: [] });});it('lets an explicit query filter override the configured one', async () => {@@ -84,7 +84,7 @@ describe('Apps Task-Type Routes', () => {const response = await request(app).get('/api/apps/app-001/work-items?issueAuthorFilter=owner');expect(response.status).toBe(200);- expect(listWorkItems).toHaveBeenCalledWith(expect.anything(), { issueAuthorFilter: 'owner' });+ expect(listWorkItems).toHaveBeenCalledWith(expect.anything(), { issueAuthorFilter: 'owner', issueExcludeLabels: [] });});it('ignores an out-of-vocabulary filter rather than passing it through', async () => {@@ -92,7 +92,16 @@ describe('Apps Task-Type Routes', () => {await request(app).get('/api/apps/app-001/work-items?issueAuthorFilter=everyone');- expect(listWorkItems).toHaveBeenCalledWith(expect.anything(), { issueAuthorFilter: 'any' });+ expect(listWorkItems).toHaveBeenCalledWith(expect.anything(), { issueAuthorFilter: 'any', issueExcludeLabels: [] });+ });++ it('passes the app\'s configured issueExcludeLabels through to the picker', async () => {+ resolveClaimWorkMetadata.mockResolvedValue({ metadata: { issueAuthorFilter: 'self', issueExcludeLabels: ['good first issue'] }, interval: {} });++ const response = await request(app).get('/api/apps/app-001/work-items');++ expect(response.status).toBe(200);+ expect(listWorkItems).toHaveBeenCalledWith(expect.anything(), { issueAuthorFilter: 'self', issueExcludeLabels: ['good first issue'] });});it('returns 404 for an unknown app', async () => {diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.jsindex c386ad27fe..8634c08af7 100644--- a/server/services/cosTaskGenerator.js+++ b/server/services/cosTaskGenerator.js@@ -43,6 +43,7 @@ import { getSkipReason } from './cosTaskClaim.js';import { ensureInstanceId } from './instances.js';import { PR_COMPLETION_VALUES } from '../lib/prDisposition.js';import { resolveTrackerFilingBlock } from '../lib/workTracker.js';+import { NON_ACTIONABLE_ISSUE_LABELS } from './perpetualWork.js';import {isAuditTaskType,isFileIssuesMode,@@ -288,6 +289,22 @@ export function resolveIssueAuthorFilterBlock(promptTaskType, mode = 'self') {return blocks[ISSUE_AUTHOR_FILTERS.includes(mode) ? mode : 'self'];}+/**+ * Resolve the {issueExcludeLabels} directive for the GitHub/GitLab claim-issue+ * prompt bodies' Phase 1 step 4 blocking-label check. Renders the fixed+ * `NON_ACTIONABLE_ISSUE_LABELS` set (perpetualWork.js — MUST stay in sync with+ * the perpetual-drain detector) plus any app-configured `issueExcludeLabels`+ * extras (e.g. `good first issue`), so the LIVE claim agent honors the same+ * exclusions the perpetual detector applies — not just the perpetual drain.+ * With no configured extras this renders identically to the prior static+ * prompt text.+ */+export function resolveIssueExcludeLabelsBlock(extraLabels = []) {+ const extras = Array.isArray(extraLabels) ? extraLabels.filter((l) => typeof l === 'string' && l.trim()) : [];+ const all = [...NON_ACTIONABLE_ISSUE_LABELS, ...extras];+ return all.map((l) => `\`${l}\``).join(', ');+}+// Per-forge nouns/commands for the swarm directive. The orchestration shape is// forge-agnostic (partition → fan-out → serialized merge); only the PR/MR noun// and the merge command differ between GitHub (`gh`) and GitLab (`glab`).@@ -496,6 +513,7 @@ export async function buildClaimWorkTask(app, {}, codeReviewDefaults);const reviewersCsv = buildReviewersCsv(reviewersList, promptUsernames, promptOptionalReviewers, promptReviewerMaxRounds, promptReviewerModels, promptReviewerEfforts);const issueAuthorFilterBlock = resolveIssueAuthorFilterBlock(promptTaskType, resolvedAuthorFilter);+ const issueExcludeLabelsBlock = resolveIssueExcludeLabelsBlock(metadata.issueExcludeLabels);// Swarm mode (`/do:next --swarm`) is prepended (not an in-template// placeholder) so it stays an opt-in orchestration wrapper that needs no// prompt-default version bump; empty when swarmCount is off or the tracker@@ -513,6 +531,7 @@ export async function buildClaimWorkTask(app, {// interpreted as a backreference (see the scheduler's same-pattern note)..replace(/\{reviewers\}/g, () => reviewersCsv).replace(/\{issueAuthorFilter\}/g, () => issueAuthorFilterBlock)+ .replace(/\{issueExcludeLabels\}/g, () => issueExcludeLabelsBlock)+ appendTargetWorkItemBlock(promptTaskType, targetRef)+ appendPrefetchedIssueContext(promptTaskType, targetRef, issueContext)+ appendClaimOverrideContext(overrideContext)@@ -2424,6 +2443,7 @@ async function applyPerpetualWorkGate(app, taskType, promptTaskType, metadata, iconst { detectActionableWork } = await import('./perpetualWork.js');const detection = await detectActionableWork(promptTaskType, app, {issueAuthorFilter: metadata.issueAuthorFilter || 'self',+ issueExcludeLabels: metadata.issueExcludeLabels || [],// A detector that counts in-flight work must skip the task whose completion// triggered this refill — it is already recorded, just not yet marked done.ignoreTaskId@@ -2860,6 +2880,9 @@ async function buildImprovementTaskDescription({ promptTemplate, app, promptTask// from `metadata` (default 'self', the slashdo `/do:next --self` security// boundary — only claim issues you filed).const issueAuthorFilterBlock = resolveIssueAuthorFilterBlock(promptTaskType, metadata.issueAuthorFilter || 'self');+ // {issueExcludeLabels} directive — merged + normalized by sanitizeTaskMetadata+ // the same way, so read it straight from `metadata`.+ const issueExcludeLabelsBlock = resolveIssueExcludeLabelsBlock(metadata.issueExcludeLabels);// Swarm directive — prepended (see buildClaimWorkTask note). swarmCount was// merged (global → per-app override) + value-constrained by// sanitizeTaskMetadata, so read it from `metadata`. Empty for non-issue@@ -2883,6 +2906,7 @@ async function buildImprovementTaskDescription({ promptTemplate, app, promptTask// the {referenceData}/{prData} comment below for why this form is needed..replace(/\{reviewers\}/g, () => reviewersCsv).replace(/\{issueAuthorFilter\}/g, () => issueAuthorFilterBlock)+ .replace(/\{issueExcludeLabels\}/g, () => issueExcludeLabelsBlock)// Use a replacer function — String.replace with a replacement STRING// interprets `$&`, `$1`, etc. as backreferences. Commit subjects/authors// legitimately contain `$` (env-var docs, prices, awk snippets) anddiff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.jsindex c1010ed0a7..2bcaff12e5 100644--- a/server/services/cosTaskGenerator.test.js+++ b/server/services/cosTaskGenerator.test.js@@ -39,6 +39,7 @@ import {selectDryRunAutoApproved,exceedsMaxSpawns,resolveIssueAuthorFilterBlock,+ resolveIssueExcludeLabelsBlock,resolveSwarmBlock,isCooldownExemptTask,emitOnDemandEmpty,@@ -687,6 +688,35 @@ describe('resolveIssueAuthorFilterBlock', () => {});});+// {issueExcludeLabels} is the Phase 1 step 4 blocking-label directive — the fixed+// NON_ACTIONABLE_ISSUE_LABELS set (perpetualWork.js) plus any app-configured extras+// (e.g. `good first issue`), so the LIVE claim agent honors the same per-app+// exclusions the perpetual-drain detector applies.+describe('resolveIssueExcludeLabelsBlock', () => {+ it('renders the fixed base list with no configured extras (default, matches the prior static prompt text)', () => {+ const block = resolveIssueExcludeLabelsBlock();+ expect(block).toBe('`in-progress`, `blocked`, `needs-input`, `future`, `wontfix`, `question`, `discussion`');+ });++ it('appends configured extras after the fixed base list', () => {+ const block = resolveIssueExcludeLabelsBlock(['good first issue', 'help wanted']);+ expect(block).toBe('`in-progress`, `blocked`, `needs-input`, `future`, `wontfix`, `question`, `discussion`, `good first issue`, `help wanted`');+ });++ it('ignores non-string/empty entries and a non-array input', () => {+ expect(resolveIssueExcludeLabelsBlock(['ok', 42, '', null])).toBe(+ '`in-progress`, `blocked`, `needs-input`, `future`, `wontfix`, `question`, `discussion`, `ok`'+ );+ expect(resolveIssueExcludeLabelsBlock('not-an-array')).toBe(+ '`in-progress`, `blocked`, `needs-input`, `future`, `wontfix`, `question`, `discussion`'+ );+ });++ it('stays in sync with the NON_ACTIONABLE_ISSUE_LABELS set the perpetual-drain detector uses', () => {+ expect(readFileSync(join(__dirname, 'cosTaskGenerator.js'), 'utf-8')).toContain("from './perpetualWork.js'");+ });+});+// resolveSwarmBlock is prepended to the claim-issue prompt when swarmCount turns// on `/do:next --swarm` mode. Like the author filter, it's a standalone pure// helper shared by the scheduled router and the manual /do:next button.diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.jsindex 12becfcec3..801c9d0c39 100644--- a/server/services/perpetualWork.js+++ b/server/services/perpetualWork.js@@ -35,6 +35,12 @@ import { readOriginRemoteUrl } from '../lib/gitRemote.js';// label the agent applies when it decides an issue needs a human decision// (claim-issue prompt Phase 3) — excluding it here is what lets a perpetual// drain converge instead of re-picking the same ambiguous issue forever.+//+// This set is intentionally fixed/structural — a user's own reserved-for-humans+// labels (e.g. `good first issue`) are NOT added here. They're configured+// per-app via `taskMetadata.issueExcludeLabels` and unioned in at read time by+// `isActionableIssue`'s `excludeLabels` param, so the base skip-list stays the+// same across every install.export const NON_ACTIONABLE_ISSUE_LABELS = new Set(['in-progress', 'blocked', 'needs-input', 'future', 'wontfix', 'question', 'discussion']);@@ -183,8 +189,14 @@ export function titleMarksEpic(title) {* is autonomously claimable. Mirrors the claim-issue prompt's Phase 1 step 4* predicate: no in-flight claim ref, no assignees, no blocking label, not an* epic. Exported for direct unit testing.+ *+ * `excludeLabels` is the app's configured `issueExcludeLabels`+ * (`taskMetadata.issueExcludeLabels`) — extra labels a user wants left for+ * human contributors (e.g. `good first issue`). It is UNIONED with+ * `NON_ACTIONABLE_ISSUE_LABELS`, never replacing it: the base set is+ * structural (in-progress/blocked/etc.), not user-configurable.*/-export function isActionableIssue(issue, inFlight = new Set()) {+export function isActionableIssue(issue, inFlight = new Set(), excludeLabels = null) {if (!issue || typeof issue.number !== 'number') return false;if (inFlight.has(issue.number)) return false;if (Array.isArray(issue.assignees) && issue.assignees.length > 0) return false;@@ -192,6 +204,7 @@ export function isActionableIssue(issue, inFlight = new Set()) {.map((l) => (typeof l === 'string' ? l : l?.name) || '').map((s) => s.toLowerCase());if (labels.some((l) => NON_ACTIONABLE_ISSUE_LABELS.has(l))) return false;+ if (excludeLabels && labels.some((l) => excludeLabels.has(l))) return false;if (labels.includes('epic')) return false;if (titleMarksEpic(issue.title)) return false;return true;@@ -394,7 +407,7 @@ async function countOpenIssuesUnfiltered(cfg, repoPath) {* issues; 'any' = every author). The in-flight scan runs only when the list is* non-empty, so an empty queue parks without a wasted branch/PR scan.*/-async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self' } = {}) {+async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self', issueExcludeLabels = [] } = {}) {const cfg = FORGE_ISSUE_CONFIG[forgeKey];const repoPath = app?.repoPath;if (!repoPath) return { actionable: false, count: 0, reason: 'no-repo-path' };@@ -546,7 +559,10 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self' } =// apparently-non-empty queue yields zero claimable work — the exact confusion// behind "40 open issues but it parked."const inFlightCount = issues.filter((i) => typeof i.number === 'number' && inFlight.has(i.number)).length;- const actionable = issues.filter((issue) => isActionableIssue(issue, inFlight));+ const excludeSet = Array.isArray(issueExcludeLabels) && issueExcludeLabels.length > 0+ ? new Set(issueExcludeLabels.map((l) => String(l).toLowerCase()))+ : null;+ const actionable = issues.filter((issue) => isActionableIssue(issue, inFlight, excludeSet));const filteredCount = Math.max(0, total - actionable.length - inFlightCount);return {actionable: actionable.length > 0,diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.jsindex ad711bb98e..bce2a1fe43 100644--- a/server/services/perpetualWork.test.js+++ b/server/services/perpetualWork.test.js@@ -97,6 +97,20 @@ describe('perpetualWork', () => {expect(isActionableIssue(null)).toBe(false);expect(isActionableIssue({ title: 'no number' })).toBe(false);});++ it('rejects an issue carrying a configured excludeLabels entry', () => {+ const excludeLabels = new Set(['good first issue']);+ expect(isActionableIssue({ ...base, labels: [{ name: 'good first issue' }] }, new Set(), excludeLabels)).toBe(false);+ });++ it('accepts an excluded-label issue when no excludeLabels set is passed', () => {+ expect(isActionableIssue({ ...base, labels: [{ name: 'good first issue' }] })).toBe(true);+ });++ it('still rejects the fixed NON_ACTIONABLE_ISSUE_LABELS set when an excludeLabels set is active', () => {+ const excludeLabels = new Set(['good first issue']);+ expect(isActionableIssue({ ...base, labels: [{ name: 'blocked' }] }, new Set(), excludeLabels)).toBe(false);+ });});describe('titleMarksEpic', () => {diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.jsindex dcdae7350c..5b4bf7650c 100644--- a/server/services/taskPromptDefaults.test.js+++ b/server/services/taskPromptDefaults.test.js@@ -254,8 +254,8 @@ describe('taskPromptDefaults integrity snapshot', () => {// claim/plan prompt that enumerates the CLI reviewers must name the binary.it.each([['plan-task', 16],- ['claim-issue', 15],- ['claim-issue-gitlab', 14],+ ['claim-issue', 16],+ ['claim-issue-gitlab', 15],['claim-issue-jira', 12],])('%s v%d names the antigravity reviewer\'s `agy` binary, preserving the pre-`agy` default', (key, version) => {const current = DEFAULT_TASK_PROMPTS[key];@@ -287,8 +287,8 @@ describe('taskPromptDefaults integrity snapshot', () => {// pointed the local-LLM reviewers at a `gh pr diff` that could not exist yet.it.each([['plan-task', 16],- ['claim-issue', 15],- ['claim-issue-gitlab', 14],+ ['claim-issue', 16],+ ['claim-issue-gitlab', 15],['claim-issue-jira', 12],])('%s v%d reviews locally before it opens the PR/MR', (key, version) => {const current = DEFAULT_TASK_PROMPTS[key];diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex c65c502321..e8fd859a15 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -15,8 +15,8 @@"simplify": "2a048214d1dd3b75bee9ae1a38fa1589","feature-ideas": "d3282f16da29efe2d53595b3b34778bc","plan-task": "2012a0da54bdbf441911a0eed05f0cb1",- "claim-issue": "50e21cbaece1875f118d3a0f1a25da81",- "claim-issue-gitlab": "7ff928b2560ed6bb1a96dbbc80142ed9",+ "claim-issue": "e9909d2614eb7a19743850f16bb51049",+ "claim-issue-gitlab": "eed428fc96a8a58ee94d38e6e4896932","claim-issue-jira": "9d782972b20d6b721eb44d0673315cad","code-reviewer-review": "1cd13ee5142d130f95cc390098d0f278","code-reviewer-implement": "ab2c3e16d54e195bdf856574b7702042",@@ -41,8 +41,8 @@"do-replan": 2,"feature-ideas": 10,"plan-task": 16,- "claim-issue": 15,- "claim-issue-gitlab": 14,+ "claim-issue": 16,+ "claim-issue-gitlab": 15,"claim-issue-jira": 12,"pr-reviewer": 3,"code-reviewer-a": 1,@@ -132,7 +132,8 @@"12d78a91126213f7c10e9a6725cdb464","8e8f795bb75e996b80992883983a3c08","da0a8fbb33ac274a3b2efd968e302a1a",- "d8fe2bf614b465ca46108ea3295d2ec5"+ "d8fe2bf614b465ca46108ea3295d2ec5",+ "7ff928b2560ed6bb1a96dbbc80142ed9"],"claim-issue": ["37949d1b1fa8d461a15658f8f4192d97",@@ -148,7 +149,8 @@"9b90d29048e85c9db640b1db643a08c8","d5465bd5d6fa1cd979746b99a881dba9","0ffd94e6c7966e5ce457effea63f71d3",- "dc47a602c96b0618e7bca87e6b21c397"+ "dc47a602c96b0618e7bca87e6b21c397",+ "50e21cbaece1875f118d3a0f1a25da81"],"security": ["d0f54c1fbe62d067b1a23ee0a9f3528c"diff --git a/server/services/taskPromptDefaults/previousDefaults.js b/server/services/taskPromptDefaults/previousDefaults.jsindex d0fa09eaf0..58f3312ce0 100644--- a/server/services/taskPromptDefaults/previousDefaults.js+++ b/server/services/taskPromptDefaults/previousDefaults.js@@ -5794,6 +5794,143 @@ If \`git branch -d\` refuses, fetch the default branch and re-check the MR's mer- **No — the remainder is a clean, separable chunk** — close THIS issue with a summarizing note (shipped ✓ / moved to #NEW), remove \`in-progress\`, and file ONE tightly-scoped follow-up for the remainder: \`glab issue create --title "…" --label plan [--label model:<tier>] [--label effort:<level>] [--label "good first issue"] [--label "help wanted"] --description "…\\n\\nRefs #\${NUM}"\` (carry over any \`area:*\` labels the issue had; choose the optional labels independently and only when justified — a leftover mechanical sweep is not a good first issue).- **No — the remainder is a continuation of the same scope** — keep the issue OPEN, post a \`Done ✓ / Remaining ▢\` note, and release the claim so the queue re-picks it: \`glab issue update "\${NUM}" --unassign --unlabel in-progress\`.+NEVER leave the issue OPEN with \`in-progress\` still on it — that strands it as a zombie (the claim queue skips \`in-progress\`, so the remaining scope is never re-picked). **Do NOT \`git pull\`** from inside this phase — the work is already integrated on GitLab via \`glab mr merge\`; leave the user's working tree alone.`,+ // v14 default prompt — pre-{issueExcludeLabels} placeholder (Phase 1 step 4's blocking-label list was still hardcoded literal text; mirrors claim-issue v15)+ `[Claim Issue: {appName}] Claim and ship the next open GitLab issue++Pick the next available unclaimed open GitLab issue, **create your own worktree at \`claim/issue-<num>\`**, implement the fix, ship a merge request (MR) that closes the issue, and clean up. This is the \`/claim --issues\` flow for GitLab — same in-flight scan, same branch naming, same no-local-merge cleanup, but the work source is the repo's **GitLab** issue tracker and the forge CLI is \`glab\` (not \`gh\`). **YOU pick the issue in Phase 1 — the scheduler does not reserve one for you.** Picking at execution time and immediately claiming (worktree + assignee + label) **narrows** the window for two concurrent runs to collide on the same issue — it does NOT eliminate it. Do NOT modify files in the source repo directly; ALL editing happens inside the worktree you create.++{issueAuthorFilter}++**How claiming works.** An issue is "in flight" when its number appears as the issue-position segment in either a \`claim/issue-<num>\` ref (the human/TUI pattern) or a \`cos/<task>/issue-<num>/<agent>\` ref (the CoS sub-agent pattern) across local branches, remote branches, or open MR source-branch refs — OR the issue is already assigned to someone OR carries an \`in-progress\` label. The \`claim/issue-<num>\` branch + the assignee/\`in-progress\` markers you set ARE the claim, visible to every other agent (including parallel machines).++## Phase 1 — Pick the target issue++Run steps 1–5 in order.++1. cd into the repo root ({repoPath}) and confirm GitLab is the forge and \`glab\` is authenticated: \`glab auth status\` and \`glab repo view\`. If \`glab\` is not authenticated or the remote is not GitLab, exit cleanly — this task only works against GitLab issue trackers.+2. List candidate open issues, honoring the author filter described above. Fetch a JSON page and order **oldest-first** (GitLab returns newest-first by default; sort client-side by \`created_at\` since the page is bounded):+ \`\`\`bash+ git fetch --prune 2>/dev/null+ # Owner-only mode (default): add --author <owner> (resolve <owner> from the project namespace).+ glab issue list --per-page 100 -F json+ # Any-author mode: run the SAME command WITHOUT --author.+ \`\`\`+3. Build the in-flight set. Collect every branch/MR source ref:+ \`\`\`bash+ git branch -a --no-color --format='%(refname:short)'+ glab mr list --per-page 100 -F 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.+4. **Pick the target issue:** walk the candidate list oldest-first and pick the FIRST issue where ALL of the following are true:+ - Its number (\`iid\`) is NOT in the in-flight set.+ - It has NO assignees (an assignee means another machine/human already claimed it).+ - It does NOT carry any of these blocking labels: \`in-progress\`, \`blocked\`, \`needs-input\`, \`future\`, \`wontfix\`, \`question\`, \`discussion\`.+ - It is NOT a tracking/umbrella **epic** — recognized by an \`epic\` label, a title ending in "(epic)", OR a title beginning with an \`[epic]\` bracket or \`Epic:\` tag (e.g. "[Epic] …" / "Epic: …", case-insensitive). Leave epics for a human to split. **The bare \`plan\` label is NOT a skip signal** — it marks the claimable queue, not a blocker.+5. **If no eligible issue exists**, exit cleanly — an empty actionable queue is a healthy state, not a failure.++Capture the issue number (GitLab \`iid\`) as \`NUM\`, its title, and its full description — you'll reuse them in the MR and the \`Closes #<num>\` line.++## Phase 2 — Claim (worktree + markers)++Detect the default branch first (forge-agnostic), then create the worktree on \`claim/issue-<num>\` and set the cross-machine claim markers. Do all editing inside the worktree, NEVER in the source repo's working tree.++\`\`\`bash+NUM=<picked-number>+DEFAULT_BRANCH="$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's@^origin/@@')"+DEFAULT_BRANCH="\${DEFAULT_BRANCH:-main}"+WORKTREE="{worktreesRoot}/claim-issue-\${NUM}"+mkdir -p {worktreesRoot}+git fetch origin "\${DEFAULT_BRANCH}"+git worktree add --no-track -b "claim/issue-\${NUM}" "\${WORKTREE}" "origin/\${DEFAULT_BRANCH}"+# Cross-machine claim markers (best-effort — do not abort the run if these fail).+# Resolve your own username first — glab's --assignee wants a username (the+# \`@me\` gh-ism isn't universally supported), falling back to @me if the lookup fails:+ME="$(glab api user 2>/dev/null | sed -n 's/.*"username":"\\([^"]*\\)".*/\\1/p')"+glab issue update "\${NUM}" --assignee "\${ME:-@me}" 2>/dev/null+glab issue update "\${NUM}" --label in-progress 2>/dev/null+cd "\${WORKTREE}"+\`\`\`++**If \`git worktree add\` fails because the \`claim/issue-<num>\` branch already exists** (a concurrent run won the race), do NOT force or reuse it — that branch IS another run's claim. Treat the issue as in-flight, return to Phase 1, and pick the next eligible issue; if nothing else is eligible, exit cleanly. Stash \`WORKTREE\` — you'll need it for Phase 7 cleanup.++## Phase 3 — Verify still valid++Read the full issue (\`glab issue view "\${NUM}"\`) before writing any code. **Every exit from this phase must leave a CONVERGING outcome on the issue — closed, or labeled \`needs-input\`.** Phase 1 step 4 skips both, so an autonomous drain stops re-picking the item. Releasing an issue OPEN and unlabeled is NOT an exit: the work detector still reports it actionable, so the next pass re-picks it and burns another no-op agent — every pass, forever.++- **Already fixed, superseded, or closed-then-reopened-for-tracking** — a note says so, or the change it asks for is already on the default branch. **Close it:** post a note naming the MR/commit (or issue) that already delivered it (\`glab issue note "\${NUM}" -m "..."\`), then \`glab issue close "\${NUM}"\` and clear the markers (\`glab issue update "\${NUM}" --unassign --unlabel in-progress\`). Remove the worktree and return to Phase 1. **Evidence gate: if you cannot name the MR, commit, or issue that delivered it, this branch does NOT apply** — closing on a hunch destroys live work, which is far worse than one wasted pass. Treat the issue as real work and continue to Phase 4.+- **Stale reference** — the request names a function, file, or component that no longer exists (\`grep -rn\` the named identifiers; if they're gone, the issue is stale). Post a note naming what you searched for and what you found instead, **tag it \`needs-input\`** (\`glab issue update "\${NUM}" --label needs-input\`), release the claim markers (\`glab issue update "\${NUM}" --unassign --unlabel in-progress\`), remove the worktree, and return to Phase 1. Re-scoping a stale issue against today's code is a human call — and the label is what keeps the drain off it in the meantime.++(A too-large scope is NOT in this list — it has its own park path below.)++**A genuinely too-large issue needs parking so the drain converges.** If the work is bigger than one coherent claim — it would touch files far outside the issue's scope (>5 unrelated files) — and you can't carve a valuable standalone slice to partial-ship via Phase 6's \`Refs\` path, post a brief note naming the split you'd suggest, **tag it \`needs-input\`** (\`glab issue update "\${NUM}" --label needs-input\`), release the claim markers (\`glab issue update "\${NUM}" --unassign --unlabel in-progress\`), remove the worktree, and exit — splitting an omnibus issue is a human call, and parking it stops a perpetual drain from re-picking the same un-shippable issue every pass (Phase 1 step 4 skips \`needs-input\`).++**Ambiguity is NOT a release trigger — decide, don't defer.** If the issue is merely open to more than one reasonable reading, or leaves a design choice unstated, do NOT bail to \`needs-input\`. Pick the most reasonable interpretation, record the approach you chose in a brief issue note (\`glab issue note "\${NUM}" -m "..."\`) so the decision is on the record, and implement it. The user would rather iterate on top of a shipped best-guess than have the issue parked waiting on a decision they didn't ask to make. Reserve \`needs-input\` — which pulls the issue out of the autonomous queue — for the narrow cases where proceeding would be **destructive or irreversible**, or genuinely requires the human: specific hardware/credentials you don't have, or a judgment only they can make. In those cases only, post the explaining note, **tag it \`needs-input\`** (\`glab issue update "\${NUM}" --label needs-input\`), release the claim markers (\`glab issue update "\${NUM}" --unassign --unlabel in-progress\`), remove the worktree, and exit cleanly. **That label is what lets an autonomous drain converge** — Phase 1 step 4 skips \`needs-input\` issues. Never leave a half-claimed issue.++## Phase 4 — Implement++Write the code, tests, and any docs the issue requires. Follow the repo conventions in CLAUDE.md. Run the relevant test suite as you go.++**Roll discovered backbone work INTO this MR** — small supporting helpers, refactors, and tests that the fix depends on belong here, not a follow-up. Only defer genuinely-large adjacent work; when you do, file a NEW issue (\`glab issue create\`) tagged \`plan\` that references this one (\`Related to #<num>\`). Choose independent dispatch hints (\`model:light|medium|heavy\`, \`effort:low|medium|high|xhigh|max\`) and contributor labels (\`good first issue\`, \`help wanted\`) only when justified; omit an axis rather than guessing; create each missing label immediately before applying it; use repeated \`--label\` flags; do not prefix the title with \`[category]\` / \`[model:…]\`.++Commit with a conventional message referencing the issue:++\`\`\`+<type>: <one-line description> (#<num>)+\`\`\`++## Phase 5 — Review locally (BEFORE any MR exists)++**Every reviewer that can read the working tree runs HERE, while there is still no MR.** Open the MR only once the branch is already review-clean: the MR then carries the finished diff, and the only things left to satisfy are CI and the reviewers that genuinely cannot start until an MR is open.++The configured reviewers for this task, in order, are \`{reviewers}\`. Split that list in two, preserving its order:++- **LOCAL reviewers — every token that is NOT an \`@<login>\`.** \`claude\` / \`codex\` / \`antigravity\` (CLI binary: \`agy\`) / \`grok\` / \`cursor\` invoke a local-CLI critique; \`lmstudio\` / \`ollama\` use the appended Local Reviewer Procedure. They read this branch's own diff and need no MR — run them in THIS phase.+- **MR-SIDE reviewers — every \`@<login>\` token**, plus any review bot the project requests automatically when an MR opens. They review server-side and cannot start before the MR exists — they run in Phase 6.++1. **Write the changelog entry now, not after the reviewers run** — every commit the reviewers are about to read must already be on the branch, or the MR carries work nobody reviewed. If the repo maintains a changelog, record a one-line entry **following the convention that repo documents** — read its \`CLAUDE.md\` and changelog README (e.g. \`.changelog/README.md\`) first. Some repos collect per-branch fragments in a directory (e.g. \`.changelog/next/\`) via a helper script rather than appending to one shared file, precisely so parallel agents don't conflict on every merge; use that flow when it's documented. Fall back to appending to the unreleased section (\`.changelog/NEXT.md\`, or \`## Unreleased\` in \`CHANGELOG.md\`) in the repo's existing prose style only when no convention is documented. If the repo has no changelog, skip this.+2. **Self-review your diff for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix the findings in the same diff, before any reviewer runs. Claude Code runs this as the three-agent \`/simplify\` pass; on other CLIs, do the equivalent review by hand.+3. **Run each LOCAL reviewer in the listed order against the BRANCH diff, not an MR diff.** No MR exists yet, so \`glab mr diff\` has nothing to read — use the CLI's own base-diff mode or \`git diff "origin/\${DEFAULT_BRANCH}...HEAD"\`. Apply the findings, run the tests, and commit the fixes — capped at 3 rounds per reviewer — then advance to the next reviewer. A missing CLI, timeout, transport failure, malformed response, or empty response is UNSATISFIED, not clean. Do NOT substitute your own self-review, and do NOT open an MR on the strength of it.+4. **If the branch cannot be brought to a shippable state here, do NOT open an MR** — that is a local reviewer still unsatisfied after 3 rounds, or fixes that leave the build/tests red. Post a note on the ISSUE naming the reviewer and the failure (\`glab issue note "\${NUM}" -m "..."\`), leave the assignee and the \`in-progress\` label in place, remove ONLY the worktree (\`cd {repoPath} && git worktree remove "\${WORKTREE}"\`), and stop. The branch stays for a human to pick up cold. Do NOT run Phase 7.++## Phase 6 — Open the merge request, satisfy MR-side review + CI, and merge++Every local reviewer's fixes are already committed, so the MR opens against finished work. This flow ships GitLab issues — it does NOT touch PLAN.md. The audit trail is the merged MR + \`git log\`.++1. Push the branch: \`git push -u origin "claim/issue-\${NUM}"\`. Then confirm \`git log --oneline @{u}..HEAD\` is empty — if it isn't, a Phase 5 review fix never left the machine and the MR would be opened against a stale diff; push again before continuing.+2. Open the MR with \`glab mr create --fill --source-branch "claim/issue-\${NUM}" --target-branch "\${DEFAULT_BRANCH}" --yes\`. **Choose the issue trailer deliberately:** if this MR FULLY satisfies the issue's scope, the description MUST contain \`Closes #\${NUM}\` so the merge auto-closes it; if you deliberately shipped only PART of the issue (a valuable slice with real scope remaining), use \`Refs #\${NUM}\` instead (NOT \`Closes\`) and add a \`## Remaining\` section listing what's left — Phase 7 reconciles the issue so it is never stranded. Summarize what shipped + a short test plan (pass \`--description\` if \`--fill\` didn't capture it).+3. **Satisfy the MR-SIDE reviewers.** For each \`@<login>\` from the Phase 5 split, request the review now (resolve \`MR_IID\` from the source branch exactly as step 5 does, then \`glab mr update "\${MR_IID}" --reviewer <login>\`, dropping the \`@\`; if glab rejects the flag, run \`glab mr update --help\` rather than guessing), poll every 5–15s, and address the findings — push fixes, capped at 3 rounds per reviewer. Their approval gates the merge. If the project auto-requests a review bot when the MR opens, wait that round out and address it the same way. With no \`@<login>\` configured and no bot review appearing, this step is a no-op.++ **Review-stuck cleanup** (an MR-side reviewer still unsatisfied after 3 rounds): post one summarizing MR note (\`glab mr note\`), then run the worktree-only cleanup (\`cd {repoPath} && git worktree remove "\${WORKTREE}"\`). Leave the local branch, the open MR, the assignee, and the \`in-progress\` label in place so the human picks up cold. Do NOT run Phase 7.+4. **Let required CI finish and go green** — inspect the MR's pipeline (\`glab ci status\` on the branch, or \`glab mr view "\${MR_IID}"\`). A red required pipeline is not merge-eligible: fix it and re-push (same 3-round cap), or, if it stays red, stop exactly as the review-stuck cleanup above does.+5. **Merge immediately via \`glab mr merge\`** — NEVER a local \`git merge\`. \`glab mr merge\` takes the **MR IID**, which is NOT the issue number — resolve it from the source branch first, merge, then verify remote state:+ \`\`\`bash+ MR_IID="$(glab mr list --source-branch "claim/issue-\${NUM}" -F json | sed -n 's/.*"iid":\\([0-9]\\{1,\\}\\).*/\\1/p' | head -1)"+ glab mr merge "\${MR_IID}" --yes --remove-source-branch || {+ glab mr view "\${MR_IID}" -F json | jq -e 'select((.state | ascii_downcase) == "merged")' >/dev/null || \+ glab mr merge "\${MR_IID}" --yes --squash --remove-source-branch+ }+ glab mr view "\${MR_IID}" -F json | jq -er 'select((.state | ascii_downcase) == "merged") | .state'+ \`\`\`+ The verification command must succeed and print a merged state. An opened/closed state or missing value is not success; investigate CI, review, and branch protection, then retry. Do not enter Phase 7 until the forge confirms the MR is merged.++## Phase 7 — Clean up (post-merge ONLY)++This phase runs only after the MR merged via Phase 6. From the **source repo** (cd back to {repoPath} first):++\`\`\`bash+cd {repoPath}+git worktree remove "\${WORKTREE}"+git branch -d "claim/issue-\${NUM}"+\`\`\`++If \`git branch -d\` refuses, fetch the default branch and re-check the MR's merged state. Retry \`-d\` only when Git proves the branch integrated; otherwise leave it for reconciliation. Never force-delete with \`-D\`.++**Reconcile the issue — did this MR FULLY satisfy its scope?**+- **Yes (full)** — the \`Closes #\${NUM}\` line already auto-closed it on merge to the default branch; if it's somehow still open, close it (\`glab issue close "\${NUM}"\`) and remove the label (\`glab issue update "\${NUM}" --unlabel in-progress\`).+- **No — the remainder is a clean, separable chunk** — close THIS issue with a summarizing note (shipped ✓ / moved to #NEW), remove \`in-progress\`, and file ONE tightly-scoped follow-up for the remainder: \`glab issue create --title "…" --label plan [--label model:<tier>] [--label effort:<level>] [--label "good first issue"] [--label "help wanted"] --description "…\\n\\nRefs #\${NUM}"\` (carry over any \`area:*\` labels the issue had; choose the optional labels independently and only when justified — a leftover mechanical sweep is not a good first issue).+- **No — the remainder is a continuation of the same scope** — keep the issue OPEN, post a \`Done ✓ / Remaining ▢\` note, and release the claim so the queue re-picks it: \`glab issue update "\${NUM}" --unassign --unlabel in-progress\`.+NEVER leave the issue OPEN with \`in-progress\` still on it — that strands it as a zombie (the claim queue skips \`in-progress\`, so the remaining scope is never re-picked). **Do NOT \`git pull\`** from inside this phase — the work is already integrated on GitLab via \`glab mr merge\`; leave the user's working tree alone.`,],// claim-issue v1 default — excluded every `plan`-labelled issue (the entire@@ -7552,6 +7689,146 @@ If \`git branch -d\` refuses, fetch the default branch and re-check the PR's rem- **No — the remainder is a clean, separable chunk** — close THIS issue with a summarizing comment (shipped ✓ / moved to #NEW), remove \`in-progress\`, and file ONE tightly-scoped follow-up for the remainder: \`gh issue create --title "…" --label plan [--label model:<tier>] [--label effort:<level>] [--label "good first issue"] [--label "help wanted"] --body "…\\n\\nRefs #\${NUM}"\` (carry over any \`area:*\` labels the issue had; choose the optional labels independently and only when justified — a leftover mechanical sweep is not a good first issue).- **No — the remainder is a continuation of the same scope** — keep the issue OPEN, post a \`Done ✓ / Remaining ▢\` comment, and release the claim so the queue re-picks it: \`gh issue edit "\${NUM}" --remove-label in-progress --remove-assignee @me\`.+NEVER leave the issue OPEN with \`in-progress\` still on it — that strands it as a zombie (the claim queue skips \`in-progress\`, so the remaining scope is never re-picked). **Do NOT \`git pull\`** from inside this phase — the work is already integrated on GitHub via \`gh pr merge\`; leave the user's working tree alone.`,+ // v15 default prompt — pre-{issueExcludeLabels} placeholder (Phase 1 step 4's blocking-label list was still hardcoded literal text)+ `[Claim Issue: {appName}] Claim and ship the next open GitHub issue++Pick the next available unclaimed open GitHub issue, **create your own worktree at \`claim/issue-<num>\`**, implement the fix, ship a PR that closes the issue, and clean up. This is the \`/claim --issues\` flow — same in-flight scan, same branch naming, same no-local-merge cleanup, but the work source is the repo's GitHub issue tracker instead of PLAN.md. **YOU pick the issue in Phase 1 — the scheduler does not reserve one for you.** Picking at execution time and immediately claiming (worktree + assignee + label) **narrows** the window for two concurrent runs to collide on the same issue — it does NOT eliminate it. Do NOT modify files in the source repo directly; ALL editing happens inside the worktree you create.++{issueAuthorFilter}++**How claiming works.** An issue is "in flight" when its number appears as the issue-position segment in either a \`claim/issue-<num>\` ref (the human/TUI pattern) or a \`cos/<task>/issue-<num>/<agent>\` ref (the CoS sub-agent pattern) across local branches, remote branches, or open PR head refs — OR the issue is already assigned to someone OR carries an \`in-progress\` label. The \`claim/issue-<num>\` branch + the assignee/\`in-progress\` markers you set ARE the claim, visible to every other agent (including parallel machines) and to the human running \`/claim --issues\` in a TUI.++## Phase 1 — Pick the target issue++Run steps 1–5 in order.++1. cd into the repo root ({repoPath}) and confirm GitHub is the forge: \`gh repo view --json nameWithOwner -q .nameWithOwner\`. If \`gh\` is not authenticated or the remote is not GitHub, exit cleanly — this task only works against GitHub issue trackers.+2. List candidate open issues **oldest-first**, honoring the author filter described above. \`gh issue list\` defaults to newest-first, so order on the SERVER with \`--search "sort:created-asc"\` — a client-side \`jq\` sort would only reorder the already-truncated newest page, dropping the true oldest issues on repos with more than \`--limit\` open issues:+ \`\`\`bash+ git fetch --prune 2>/dev/null+ # Author filter (see the block above). Pass --author as a QUOTED single token —+ # do NOT pack flag+value into one variable: a bare \`$VAR\` holding "--author x"+ # is a single argv token in zsh (no word-splitting) and gh rejects it.+ # Owner-only mode (default): resolve the owner, then add --author "$OWNER"+ OWNER="$(gh repo view --json owner -q .owner.login)"+ gh issue list --state open --author "$OWNER" --search "sort:created-asc" --json number,title,author,assignees,labels,createdAt --limit 100+ # Any-author mode: run the SAME command WITHOUT the --author "$OWNER" flag.+ \`\`\`+3. Build the in-flight set. Collect every branch/PR ref:+ \`\`\`bash+ git branch -a --no-color --format='%(refname:short)'+ 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.+4. **Pick the target issue:** walk the candidate list oldest-first and pick the FIRST issue where ALL of the following are true:+ - Its number is NOT in the in-flight set.+ - It has NO assignees (an assignee means another machine/human already claimed it).+ - It does NOT carry any of these blocking labels: \`in-progress\`, \`blocked\`, \`needs-input\`, \`future\`, \`wontfix\`, \`question\`, \`discussion\`.+ - It is NOT a tracking/umbrella **epic** — recognized by an \`epic\` label, a title ending in "(epic)", OR a title beginning with an \`[epic]\` bracket or \`Epic:\` tag (e.g. "[Epic] …" / "Epic: …", case-insensitive). An epic needs per-slice partial-ship (each slice its own PR, \`Refs\` not \`Closes\`), so leave it for a human or \`/claim --issues\` to split — don't claim it wholesale here. **The bare \`plan\` label is NOT a skip signal.** \`do-replan --issues\` (and \`/do:replan --issues\`) labels EVERY migrated backlog item \`plan\` — atomic bug-fixes included — so \`plan\` marks the *claimable* queue exactly as \`/do:next --issues\` treats it (it is that flow's required candidate label). Skipping all \`plan\` issues would discard the entire actionable backlog and falsely report an empty queue.+5. **If no eligible issue exists**, exit cleanly — an empty actionable queue is a healthy state, not a failure.++Capture the issue number as \`NUM\`, its title, and its full body — you'll reuse them in the PR and the \`Closes #<num>\` trailer.++## Phase 2 — Claim (worktree + markers)++Create the worktree on a branch named \`claim/issue-<num>\`, then set the cross-machine claim markers. Do all editing inside the worktree, NEVER in the source repo's working tree.++\`\`\`bash+NUM=<picked-number>+WORKTREE="{worktreesRoot}/claim-issue-\${NUM}"+mkdir -p {worktreesRoot}+git fetch origin main+git worktree add --no-track -b "claim/issue-\${NUM}" "\${WORKTREE}" origin/main+# Cross-machine claim markers (best-effort — do not abort the run if these fail):+gh issue edit "\${NUM}" --add-assignee @me 2>/dev/null+gh issue edit "\${NUM}" --add-label in-progress 2>/dev/null+cd "\${WORKTREE}"+\`\`\`++(If the repo's default branch is not \`main\`, detect it with \`gh repo view --json defaultBranchRef -q .defaultBranchRef.name\` and substitute it for \`main\` above.)++**If \`git worktree add\` fails because the \`claim/issue-<num>\` branch already exists** (a concurrent run won the race, or a remote claim branch is now visible), do NOT force or reuse it — that branch IS another run's claim. Treat the issue as in-flight, return to Phase 1, and pick the next eligible issue; if nothing else is eligible, exit cleanly. Stash \`WORKTREE\` — you'll need it for Phase 7 cleanup.++## Phase 3 — Verify still valid++Read the full issue (\`gh issue view "\${NUM}" --comments\`) before writing any code. **Every exit from this phase must leave a CONVERGING outcome on the issue — closed, or labeled \`needs-input\`.** Phase 1 step 4 skips both, so an autonomous drain stops re-picking the item. Releasing an issue OPEN and unlabeled is NOT an exit: the work detector still reports it actionable, so the next pass re-picks it and burns another no-op agent — every pass, forever.++- **Already fixed, superseded, or closed-then-reopened-for-tracking** — a comment says so, or the change it asks for is already on the default branch. **Close it:** post a comment naming the PR/commit (or issue) that already delivered it (\`gh issue comment "\${NUM}" --body "..."\`), then \`gh issue close "\${NUM}" --reason completed\` (use \`--reason "not planned"\` when it was superseded rather than delivered) and clear the markers (\`gh issue edit "\${NUM}" --remove-assignee @me --remove-label in-progress\`). Remove the worktree and return to Phase 1. **Evidence gate: if you cannot name the PR, commit, or issue that delivered it, this branch does NOT apply** — closing on a hunch destroys live work, which is far worse than one wasted pass. Treat the issue as real work and continue to Phase 4.+- **Stale reference** — the request names a function, file, or component that no longer exists (\`grep -rn\` the named identifiers; if they're gone, the issue is stale). Post a comment naming what you searched for and what you found instead, **tag it \`needs-input\`** (\`gh issue edit "\${NUM}" --add-label needs-input\`), release the claim markers (\`gh issue edit "\${NUM}" --remove-assignee @me --remove-label in-progress\`), remove the worktree, and return to Phase 1. Re-scoping a stale issue against today's code is a human call — and the label is what keeps the drain off it in the meantime.++(A too-large scope is NOT in this list — it has its own park path below.)++**A genuinely too-large issue needs parking so the drain converges.** If the work is bigger than one coherent claim — it would touch files far outside the issue's scope (>5 unrelated files) — and you can't carve a valuable standalone slice to partial-ship via Phase 6's \`Refs\` path, post a brief comment naming the split you'd suggest, **tag it \`needs-input\`** (\`gh issue edit "\${NUM}" --add-label needs-input\`), release the claim markers (\`gh issue edit "\${NUM}" --remove-assignee @me --remove-label in-progress\`), remove the worktree, and exit — splitting an omnibus issue is a human call, and parking it is what stops a perpetual drain from re-picking the same un-shippable issue every pass (Phase 1 step 4 skips \`needs-input\`).++**Ambiguity is NOT a release trigger — decide, don't defer.** If the issue is merely open to more than one reasonable reading, or leaves a design choice unstated, do NOT bail to \`needs-input\`. Pick the most reasonable interpretation, record the approach you chose in a brief issue comment (\`gh issue comment "\${NUM}" --body "..."\`) so the decision is on the record, and implement it. The user would rather iterate on top of a shipped best-guess than have the issue parked waiting on a decision they didn't ask to make. Reserve \`needs-input\` — which pulls the issue out of the autonomous queue — for the narrow cases where proceeding would be **destructive or irreversible**, or genuinely requires the human: specific hardware/credentials you don't have, or a judgment only they can make. In those cases only, post the explaining comment, **tag it \`needs-input\`** (\`gh issue edit "\${NUM}" --add-label needs-input\`), release the claim markers (\`gh issue edit "\${NUM}" --remove-assignee @me --remove-label in-progress\`), remove the worktree, and exit cleanly. **That label is what lets an autonomous drain converge** — Phase 1 step 4 skips \`needs-input\` issues. Never leave a half-claimed issue.++## Phase 4 — Implement++Write the code, tests, and any docs the issue requires. Follow the repo conventions in CLAUDE.md (no try/catch in route handlers, functional programming, Zod validation, Tailwind tokens, reactive UI updates). Run the relevant test suite as you go.++**Roll discovered backbone work INTO this PR** — small supporting helpers, refactors, and tests that the fix depends on belong here, not a follow-up. Only defer genuinely-large adjacent work; when you do, file a NEW issue (\`gh issue create\`) tagged \`plan\` that references this one (\`Related to #<num>\`) rather than appending to PLAN.md. Choose independent dispatch hints (\`model:light|medium|heavy\`, \`effort:low|medium|high|xhigh|max\`) and contributor labels (\`good first issue\`, \`help wanted\`) only when justified; omit an axis rather than guessing; create each missing label immediately before applying it; use repeated \`--label\` flags; do not prefix the title with \`[category]\` / \`[model:…]\`.++Commit with a conventional message referencing the issue so the trail is grep-able:++\`\`\`+<type>: <one-line description> (#<num>)+\`\`\`++## Phase 5 — Review locally (BEFORE any PR exists)++**Every reviewer that can read the working tree runs HERE, while there is still no PR.** Open the PR only once the branch is already review-clean: the PR then carries the finished diff, and the only things left to satisfy are CI and the reviewers that genuinely cannot start until a PR is open.++The configured reviewers for this task, in order, are \`{reviewers}\`. Split that list in two, preserving its order:++- **LOCAL reviewers — every token that is NOT an \`@<login>\`.** \`claude\` / \`codex\` / \`antigravity\` (CLI binary: \`agy\`) / \`grok\` / \`cursor\` invoke a local-CLI critique; \`lmstudio\` / \`ollama\` use the appended Local Reviewer Procedure. They read this branch's own diff and need no PR — run them in THIS phase.+- **PR-SIDE reviewers — every \`@<login>\` token**, plus any review bot the repo requests automatically when a PR opens. They review cloud-side and cannot start before the PR exists — they run in Phase 6.++1. **Write the changelog entry now, not after the reviewers run** — every commit the reviewers are about to read must already be on the branch, or the PR carries work nobody reviewed. If the repo maintains a changelog, record a one-line entry **following the convention that repo documents** — read its \`CLAUDE.md\` and changelog README (e.g. \`.changelog/README.md\`) first. Some repos collect per-branch fragments in a directory (e.g. \`.changelog/next/\`) via a helper script rather than appending to one shared file, precisely so parallel agents don't conflict on every merge; use that flow when it's documented. Fall back to appending to the unreleased section (\`.changelog/NEXT.md\`, or \`## Unreleased\` in \`CHANGELOG.md\`) in the repo's existing prose style only when no convention is documented. If the repo has no changelog, skip this — the PR + commit history is the record.+2. **Self-review your diff for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix the findings in the same diff, before any reviewer runs. Claude Code runs this as the three-agent \`/simplify\` pass; on other CLIs, do the equivalent review by hand.+3. **Run each LOCAL reviewer in the listed order against the BRANCH diff, not a PR diff.** No PR exists yet, so \`gh pr diff\` has nothing to read — use the CLI's own base-diff mode or \`git diff origin/main...HEAD\` (substitute the repo's default branch when it isn't \`main\`). Apply the findings, run the tests, and commit the fixes — capped at 3 rounds per reviewer — then advance to the next reviewer. A missing CLI, timeout, transport failure, malformed response, or empty response is UNSATISFIED, not clean. Do NOT substitute your own self-review, and do NOT open a PR on the strength of it.+4. **If the branch cannot be brought to a shippable state here, do NOT open a PR** — that is a local reviewer still unsatisfied after 3 rounds, or fixes that leave the build/tests red. Comment on the ISSUE naming the reviewer and the failure (\`gh issue comment "\${NUM}" --body "..."\`), leave the assignee and the \`in-progress\` label in place, remove ONLY the worktree (\`cd {repoPath} && git worktree remove "\${WORKTREE}"\`), and stop. The branch stays for a human to pick up cold. Do NOT run Phase 7.++## Phase 6 — Open the PR, satisfy PR-side review + CI, and merge++Every local reviewer's fixes are already committed, so the PR opens against finished work. This flow ships GitHub issues — it does NOT touch PLAN.md. The audit trail is the merged PR + \`git log\`.++1. Push the branch: \`git push -u origin "claim/issue-\${NUM}"\`. Then confirm \`git log --oneline @{u}..HEAD\` is empty — if it isn't, a Phase 5 review fix never left the machine and the PR would be opened against a stale diff; push again before continuing.+2. Open the PR with \`gh pr create\`. Summarize what shipped + a short test plan. **Choose the issue trailer deliberately:** if this PR FULLY satisfies the issue's scope, the body MUST contain \`Closes #\${NUM}\` so the merge auto-closes it. If you deliberately shipped only PART of the issue (a valuable slice, with real scope still remaining), use \`Refs #\${NUM}\` instead (NOT \`Closes\`) and add a \`## Remaining\` section listing what's left — Phase 7 reconciles the issue so it is never stranded.+3. **Satisfy the PR-SIDE reviewers.** For each \`@<login>\` from the Phase 5 split, request the review now (\`gh pr edit <pr-number> --add-reviewer <login>\`, drop the \`@\`), poll every 5–15s for it, and address the findings — push fixes, capped at 3 rounds per reviewer. Their approval gates the merge. If the repo auto-requests a review bot when the PR opens, wait that round out and address it the same way. With no \`@<login>\` configured and no bot review appearing, this step is a no-op.++ **Review-stuck cleanup** (a PR-side reviewer still unsatisfied after 3 rounds): post one summarizing PR comment (\`gh pr comment\`), then run the worktree-only cleanup (\`cd {repoPath} && git worktree remove "\${WORKTREE}"\`). Leave the local branch, the open PR, the assignee, and the \`in-progress\` label in place so the human picks up cold. Do NOT run Phase 7.+4. **Let required CI finish and go green** — \`gh pr checks <pr-number> --required --watch --fail-fast\` (scope the wait to REQUIRED checks so an optional job can't stall a merge branch protection would allow). A red required check is not merge-eligible: fix it and re-push (same 3-round cap), or, if it stays red, stop exactly as the review-stuck cleanup above does.+5. **Merge immediately via \`gh pr merge\`** — NEVER a local \`git merge\` and NEVER \`--auto\`, which can return successfully while leaving the PR queued and OPEN. Prefer a true merge commit, with squash/rebase fallbacks for repositories that disallow it:+ \`\`\`bash+ PR_URL=$(gh pr view --json url -q .url) # no number: resolves the PR from the checked-out branch+ gh pr merge "$PR_URL" --merge --delete-branch || {+ [ "$(gh pr view "$PR_URL" --json state -q .state)" = "MERGED" ] || \+ gh pr merge "$PR_URL" --squash --delete-branch || \+ gh pr merge "$PR_URL" --rebase --delete-branch+ }+ STATE=$(gh pr view "$PR_URL" --json state -q .state)+ [ "$STATE" = "MERGED" ] || { echo "Expected MERGED, got $STATE" >&2; exit 1; }+ \`\`\`+ The exact comparison MUST succeed. \`OPEN\` means CI, review, or branch protection still blocks the merge; investigate, fix, and retry. \`CLOSED\` is also not success. Do not enter Phase 7 until remote GitHub state is exactly \`MERGED\`.++## Phase 7 — Clean up (post-merge ONLY)++This phase runs only after the PR merged via Phase 6. From the **source repo** (cd back to {repoPath} first):++\`\`\`bash+cd {repoPath}+git worktree remove "\${WORKTREE}"+git branch -d "claim/issue-\${NUM}"+\`\`\`++If \`git branch -d\` refuses, fetch the default branch and re-check the PR's remote \`MERGED\` state. Retry \`-d\` only when Git can prove the branch is integrated; otherwise leave the local branch for the reconciliation task. Never force-delete with \`-D\`.++**Reconcile the issue — did this PR FULLY satisfy its scope?**+- **Yes (full)** — the \`Closes #\${NUM}\` trailer already auto-closed it; if it's somehow still open, close it (\`gh issue close "\${NUM}"\`) and remove the label (\`gh issue edit "\${NUM}" --remove-label in-progress\`).+- **No — the remainder is a clean, separable chunk** — close THIS issue with a summarizing comment (shipped ✓ / moved to #NEW), remove \`in-progress\`, and file ONE tightly-scoped follow-up for the remainder: \`gh issue create --title "…" --label plan [--label model:<tier>] [--label effort:<level>] [--label "good first issue"] [--label "help wanted"] --body "…\\n\\nRefs #\${NUM}"\` (carry over any \`area:*\` labels the issue had; choose the optional labels independently and only when justified — a leftover mechanical sweep is not a good first issue).+- **No — the remainder is a continuation of the same scope** — keep the issue OPEN, post a \`Done ✓ / Remaining ▢\` comment, and release the claim so the queue re-picks it: \`gh issue edit "\${NUM}" --remove-label in-progress --remove-assignee @me\`.+NEVER leave the issue OPEN with \`in-progress\` still on it — that strands it as a zombie (the claim queue skips \`in-progress\`, so the remaining scope is never re-picked). **Do NOT \`git pull\`** from inside this phase — the work is already integrated on GitHub via \`gh pr merge\`; leave the user's working tree alone.`,],// Basic self-improvement tasks: prior defaults that hardcoded the target app asdiff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex e081d37a24..e4025c1ead 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -769,7 +769,7 @@ Run steps 1–5 in order.4. **Pick the target issue:** walk the candidate list oldest-first and pick the FIRST issue where ALL of the following are true:- Its number is NOT in the in-flight set.- It has NO assignees (an assignee means another machine/human already claimed it).- - It does NOT carry any of these blocking labels: \`in-progress\`, \`blocked\`, \`needs-input\`, \`future\`, \`wontfix\`, \`question\`, \`discussion\`.+ - It does NOT carry any of these blocking labels: {issueExcludeLabels}.- It is NOT a tracking/umbrella **epic** — recognized by an \`epic\` label, a title ending in "(epic)", OR a title beginning with an \`[epic]\` bracket or \`Epic:\` tag (e.g. "[Epic] …" / "Epic: …", case-insensitive). An epic needs per-slice partial-ship (each slice its own PR, \`Refs\` not \`Closes\`), so leave it for a human or \`/claim --issues\` to split — don't claim it wholesale here. **The bare \`plan\` label is NOT a skip signal.** \`do-replan --issues\` (and \`/do:replan --issues\`) labels EVERY migrated backlog item \`plan\` — atomic bug-fixes included — so \`plan\` marks the *claimable* queue exactly as \`/do:next --issues\` treats it (it is that flow's required candidate label). Skipping all \`plan\` issues would discard the entire actionable backlog and falsely report an empty queue.5. **If no eligible issue exists**, exit cleanly — an empty actionable queue is a healthy state, not a failure.@@ -912,7 +912,7 @@ Run steps 1–5 in order.4. **Pick the target issue:** walk the candidate list oldest-first and pick the FIRST issue where ALL of the following are true:- Its number (\`iid\`) is NOT in the in-flight set.- It has NO assignees (an assignee means another machine/human already claimed it).- - It does NOT carry any of these blocking labels: \`in-progress\`, \`blocked\`, \`needs-input\`, \`future\`, \`wontfix\`, \`question\`, \`discussion\`.+ - It does NOT carry any of these blocking labels: {issueExcludeLabels}.- It is NOT a tracking/umbrella **epic** — recognized by an \`epic\` label, a title ending in "(epic)", OR a title beginning with an \`[epic]\` bracket or \`Epic:\` tag (e.g. "[Epic] …" / "Epic: …", case-insensitive). Leave epics for a human to split. **The bare \`plan\` label is NOT a skip signal** — it marks the claimable queue, not a blocker.5. **If no eligible issue exists**, exit cleanly — an empty actionable queue is a healthy state, not a failure.diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex 63202ca2c9..6f8fe44086 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -12,8 +12,8 @@ export const PROMPT_VERSIONS = {'do-replan': 2, // v2: scheduled issue-quality gate rejects speculative/future-only work and keeps valid current refactors claimable'feature-ideas': 10, // v10: Phase 4 (Brainstorm) consults the repo's REJECTED.md and recently closed-unmerged PRs before proposing, so ideas the user already declined aren't re-proposed (mirrors idle-review's REJECTED.md contract). v9: drop DONE.md reads — use `.changelog/` + `git log` (last 50) as the completed-work signal'plan-task': 16, // v16: every reviewer that can read the working tree runs BEFORE the PR is opened — Phase 6 splits the configured list into LOCAL reviewers (every non-`@<login>` token, reviewed against `git diff origin/main...HEAD`) and PR-SIDE reviewers (`@<login>` plus any auto-requested review bot), opens the PR only once the branch is review-clean, and then waits on those PR-side reviewers plus required CI. Previously the PR was opened first and every reviewer ran against its diff, so each round of findings landed as follow-up commits on an already-public PR. v14: claim worktree creation passes `--no-track`, so a branch based on `origin/main` cannot inherit `main` as its upstream and make a config-derived push write directly to the default branch; the later `git push -u` sets the intended branch upstream. v13: Phase 5's changelog step reads the repo's documented convention FIRST (per-branch fragment directory + helper script, as PortOS now uses) and only falls back to detect-and-append when none is documented; the Phase 6 review-stuck note no longer names `.changelog/NEXT.md` as the file it wrote. v12: the reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — the bare `antigravity` slug is a command that exists nowhere, and a review-loop agent that probed for it concluded no reviewer was available and merged on its own self-review. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v11: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree. v10: Phase 3 "decide, don't defer" — an *ambiguous* PLAN.md item no longer jumps to the Phase 3b clarification PR; the agent picks the most reasonable reading, notes it, and implements. Phase 3b is reserved for destructive/irreversible or genuinely-human-gated items. Mirrors claim-issue v7 + CLAUDE.md. v9: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v8: Phase-6 merge fallback prefers --merge over --squash (after --auto), matching the /do:pr + review-loop default and PortOS's merge-only policy- 'claim-issue': 15, // v15: Phase 5 is now the pre-PR local review (LOCAL reviewers = every non-`@<login>` token, run against the branch diff; an unsatisfied one blocks PR creation entirely) and Phase 6 opens the PR, satisfies the PR-SIDE reviewers (`@<login>` plus any auto-requested review bot) and required CI, then merges. v13: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v12: claim worktree creation passes `--no-track`, so a branch based on `origin/main` cannot inherit `main` as its upstream and make a config-derived push write directly to the default branch; the later `git push -u` sets the intended branch upstream. v11: EVERY Phase-3 release now converges — the "already fixed / superseded" case CLOSES the issue (with a comment naming what delivered it) and the "stale reference" case tags `needs-input`, instead of both releasing the issue open and unlabeled. `isActionableIssue` (perpetualWork.js) can only see labels/assignees/epic/in-flight, so a body-or-comment-driven release left the issue looking actionable and the perpetual drain re-spawned a no-op agent on it every tick. v10: Phase 5's changelog step defers to the convention the repo documents (per-branch fragment directory + helper script when present) instead of prescribing an append to `.changelog/NEXT.md`. v9: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v8: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree. v7: Phase 3 no longer releases/parks an *ambiguous* issue to `needs-input` — the agent decides (picks the most reasonable reading, records it in an issue comment, ships) rather than punting the choice back to a human; `needs-input` is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. Mirrors the "Decide, don't defer" policy in CLAUDE.md. v6: Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix — mirrors the perpetualWork detector so a `[Epic]`-titled issue with no `epic` label stops re-spawning a claim agent that always skips it (perpetual drain now converges/parks). v5: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v4: Phase 5 chooses the issue trailer deliberately (Closes for a full ship, Refs + a `## Remaining` section for a partial one) and Phase 7 reconciles the issue with the partial-ship hybrid — close + file a scoped follow-up when the remainder is separable, else comment "done/remaining" + release the `in-progress` claim — so a partial ship is never left OPEN + `in-progress` (a zombie the claim queue skips forever). v3: Phase 3 tags an ambiguous/too-large issue `needs-input` (not just a comment) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge instead of re-picking the same un-actionable issue. v2: stop treating the bare `plan` label as a skip — `plan` is the claimable-queue label (do-replan --issues labels every migrated backlog item `plan`), so v1's exclusion emptied the whole actionable queue; now skip only true epics (`epic` label or "(epic)" title)- 'claim-issue-gitlab': 14, // v14: mirrors claim-issue v15 — Phase 5 runs the LOCAL reviewers against the branch diff before any MR exists, Phase 6 opens the MR and satisfies the MR-SIDE reviewers + pipeline before merging. v12: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v11: claim worktree creation passes `--no-track`, so a branch based on the default-branch remote ref does not inherit it as an upstream; the later `git push -u` sets the intended branch upstream. v10: mirrors claim-issue v11 — every Phase-3 release converges (close the already-fixed/superseded issue, tag the stale-reference one `needs-input`) so the perpetual drain stops re-picking it. v9: mirrors claim-issue v10 — Phase 5's changelog step defers to the repo's documented convention (per-branch fragments) rather than prescribing a `.changelog/NEXT.md` append. v8: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v7: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree (mirrors claim-issue v8). v6: mirrors claim-issue v7 — Phase 3 decides an *ambiguous* issue (record the chosen reading in an issue note, ship) instead of parking it to `needs-input`, which is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. v5: mirrors claim-issue v6 — Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix, so the GitLab detector/agent converge on epic-titled issues too. v4: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v3: mirrors claim-issue v4 — Phase 5 chooses Closes-vs-Refs deliberately and Phase 7 reconciles the issue with the partial-ship hybrid (close + scoped follow-up when separable, else "done/remaining" note + release the `in-progress` claim) so a partial ship is never stranded. v2: Phase 3 tags an ambiguous/too-large issue `needs-input` (mirrors claim-issue v3) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge. v1: GitLab sibling of claim-issue — same 7-phase /claim --issues flow over `glab` issues + merge requests. Reached via the claim-work router when an app's resolved workTracker is 'gitlab'.+ 'claim-issue': 16, // v16: Phase 1 step 4's blocking-label check is now the `{issueExcludeLabels}` placeholder (resolveIssueExcludeLabelsBlock, cosTaskGenerator.js) — the fixed NON_ACTIONABLE_ISSUE_LABELS set plus any app-configured `taskMetadata.issueExcludeLabels` extras (e.g. `good first issue`), so the live claim agent honors the same per-app exclusions the perpetual-drain detector applies, not just the hardcoded set. v15: Phase 5 is now the pre-PR local review (LOCAL reviewers = every non-`@<login>` token, run against the branch diff; an unsatisfied one blocks PR creation entirely) and Phase 6 opens the PR, satisfies the PR-SIDE reviewers (`@<login>` plus any auto-requested review bot) and required CI, then merges. v13: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v12: claim worktree creation passes `--no-track`, so a branch based on `origin/main` cannot inherit `main` as its upstream and make a config-derived push write directly to the default branch; the later `git push -u` sets the intended branch upstream. v11: EVERY Phase-3 release now converges — the "already fixed / superseded" case CLOSES the issue (with a comment naming what delivered it) and the "stale reference" case tags `needs-input`, instead of both releasing the issue open and unlabeled. `isActionableIssue` (perpetualWork.js) can only see labels/assignees/epic/in-flight, so a body-or-comment-driven release left the issue looking actionable and the perpetual drain re-spawned a no-op agent on it every tick. v10: Phase 5's changelog step defers to the convention the repo documents (per-branch fragment directory + helper script when present) instead of prescribing an append to `.changelog/NEXT.md`. v9: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v8: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree. v7: Phase 3 no longer releases/parks an *ambiguous* issue to `needs-input` — the agent decides (picks the most reasonable reading, records it in an issue comment, ships) rather than punting the choice back to a human; `needs-input` is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. Mirrors the "Decide, don't defer" policy in CLAUDE.md. v6: Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix — mirrors the perpetualWork detector so a `[Epic]`-titled issue with no `epic` label stops re-spawning a claim agent that always skips it (perpetual drain now converges/parks). v5: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v4: Phase 5 chooses the issue trailer deliberately (Closes for a full ship, Refs + a `## Remaining` section for a partial one) and Phase 7 reconciles the issue with the partial-ship hybrid — close + file a scoped follow-up when the remainder is separable, else comment "done/remaining" + release the `in-progress` claim — so a partial ship is never left OPEN + `in-progress` (a zombie the claim queue skips forever). v3: Phase 3 tags an ambiguous/too-large issue `needs-input` (not just a comment) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge instead of re-picking the same un-actionable issue. v2: stop treating the bare `plan` label as a skip — `plan` is the claimable-queue label (do-replan --issues labels every migrated backlog item `plan`), so v1's exclusion emptied the whole actionable queue; now skip only true epics (`epic` label or "(epic)" title)+ 'claim-issue-gitlab': 15, // v15: mirrors claim-issue v16 — Phase 1 step 4's blocking-label check is now the `{issueExcludeLabels}` placeholder. v14: mirrors claim-issue v15 — Phase 5 runs the LOCAL reviewers against the branch diff before any MR exists, Phase 6 opens the MR and satisfies the MR-SIDE reviewers + pipeline before merging. v12: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v11: claim worktree creation passes `--no-track`, so a branch based on the default-branch remote ref does not inherit it as an upstream; the later `git push -u` sets the intended branch upstream. v10: mirrors claim-issue v11 — every Phase-3 release converges (close the already-fixed/superseded issue, tag the stale-reference one `needs-input`) so the perpetual drain stops re-picking it. v9: mirrors claim-issue v10 — Phase 5's changelog step defers to the repo's documented convention (per-branch fragments) rather than prescribing a `.changelog/NEXT.md` append. v8: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v7: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree (mirrors claim-issue v8). v6: mirrors claim-issue v7 — Phase 3 decides an *ambiguous* issue (record the chosen reading in an issue note, ship) instead of parking it to `needs-input`, which is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. v5: mirrors claim-issue v6 — Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix, so the GitLab detector/agent converge on epic-titled issues too. v4: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v3: mirrors claim-issue v4 — Phase 5 chooses Closes-vs-Refs deliberately and Phase 7 reconciles the issue with the partial-ship hybrid (close + scoped follow-up when separable, else "done/remaining" note + release the `in-progress` claim) so a partial ship is never stranded. v2: Phase 3 tags an ambiguous/too-large issue `needs-input` (mirrors claim-issue v3) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge. v1: GitLab sibling of claim-issue — same 7-phase /claim --issues flow over `glab` issues + merge requests. Reached via the claim-work router when an app's resolved workTracker is 'gitlab'.'claim-issue-jira': 12, // v12: mirrors claim-issue v15 in the JIRA flow — Phase 5 runs the LOCAL reviewers against the branch diff before the MR/PR is opened (and before the In Review transition), Phase 6 keeps only the PR-side reviewers plus the worktree cleanup. v10: follow-up tickets receive equivalent hyphenated dispatch (`model-*`/`effort-*`) and contributor (`good-first-issue`/`help-wanted`) labels when independently justified. v9: claim worktree creation passes `--no-track`, so a branch based on the default-branch remote ref does not inherit it as an upstream; the later `git push -u` sets the intended branch upstream. v8: mirrors claim-issue v11 in JIRA's status vocabulary — an already-fixed/superseded ticket transitions to Done/Closed and a stale-reference ticket parks on a Blocked/On Hold status behind a Review Hub todo, instead of transitioning back to a not-started status that Phase 1 immediately re-picks. v7: mirrors claim-issue v10 — Phase 5's changelog step defers to the repo's documented convention (per-branch fragments) rather than prescribing a `.changelog/NEXT.md` append. v6: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v5: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of `{repoPath}/data/cos/worktrees/`, so the agent's checkout no longer lands inside the managed app's working tree (mirrors claim-issue v8). v4: mirrors claim-issue v7 — Phase 3 decides an *ambiguous* ticket (record the chosen reading in a ticket comment, ship) instead of parking it to a "Needs clarification" Review Hub todo, and Phase 1 no longer skips a merely-underspecified ticket; the todo is reserved for destructive/irreversible or genuinely-human-gated cases. v3: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v2: Phase 5 records remaining scope in the ticket (Done/Remaining comment) and files a follow-up ticket when a partial ship's remainder is separable, so remaining work isn't lost when a human lands the MR/PR. v1: JIRA sibling of claim-issue — claim ONE ready sprint ticket, move it To Do→In Progress→In Review around a self-managed worktree + MR/PR. Reached via the claim-work router when an app's resolved workTracker is 'jira' (replaces the prior jira→jira-sprint-manager route).'pr-reviewer': 3, // v3: multi-stage pipeline (security scan → code review + merge)'code-reviewer-a': 1, // v1: 2-stage pipeline (codebase review → triage & implement)diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex 08be7f315c..866c3d9622 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -387,7 +387,12 @@ export const DEFAULT_TASK_INTERVALS = {// access (GitHub collaborators / GitLab project members); 'owner' only claims// issues the repo owner filed; 'any' claims any open issue. Per-app override// supported via taskTypeOverrides.- 'claim-issue': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, claimFlow: true, simplify: true, issueAuthorFilter: 'self' } },+ // `issueExcludeLabels` (default `[]`) lists ADDITIONAL labels to skip when+ // auto-claiming, on top of the fixed NON_ACTIONABLE_ISSUE_LABELS set+ // (perpetualWork.js) — e.g. `good first issue`, to leave those open for human+ // contributors. Per-app override supported via taskTypeOverrides, like+ // `issueAuthorFilter`.+ 'claim-issue': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, claimFlow: true, simplify: true, issueAuthorFilter: 'self', issueExcludeLabels: [] } },// claim-work is the SINGLE-SOURCE router: one toggle per app that ships the// next work item from whatever tracker the app is configured for// (app.workTracker, default 'auto' → resolved from the git origin host). At@@ -399,9 +404,9 @@ export const DEFAULT_TASK_INTERVALS = {// Both `useWorktree` and `openPR` are OFF on the CoS side// for the SAME reasons as plan-task/claim-issue (a CoS-managed worktree would// hide the claim slug and trigger cleanupAgentWorktree's auto-merge).- // `issueAuthorFilter` applies only when the resolved tracker is a forge- // (github/gitlab); it's inert for plan/jira.- 'claim-work': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, claimFlow: true, simplify: true, issueAuthorFilter: 'self' } },+ // `issueAuthorFilter` / `issueExcludeLabels` apply only when the resolved+ // tracker is a forge (github/gitlab); both are inert for plan/jira.+ 'claim-work': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, claimFlow: true, simplify: true, issueAuthorFilter: 'self', issueExcludeLabels: [] } },'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },'typing': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },// Release-check inspects and mutates release state (for example, the main →diff --git a/server/services/workItems.js b/server/services/workItems.jsindex 05f6fa82c4..b4710f350a 100644--- a/server/services/workItems.js+++ b/server/services/workItems.js@@ -56,17 +56,20 @@ async function listJiraTickets(app) {* author filter the claim flow uses on forge trackers.** @param {object} app - managed app record (needs `id`, `repoPath`, `jira`)- * @param {{ issueAuthorFilter?: 'self'|'collaborators'|'owner'|'any' }} [opts]+ * @param {{ issueAuthorFilter?: 'self'|'collaborators'|'owner'|'any', issueExcludeLabels?: string[] }} [opts]* @returns {Promise<{tracker, source, promptTaskType, items, count, reason, transient}>}*/-export async function listWorkItems(app, { issueAuthorFilter } = {}) {+export async function listWorkItems(app, { issueAuthorFilter, issueExcludeLabels } = {}) {const wt = await resolveAppWorkTracker(app);const promptTaskType = trackerToClaimTaskType(wt.resolved) || 'plan-task';const base = { tracker: wt.resolved, source: wt.source, promptTaskType };+ const detectorOpts = {};+ if (issueAuthorFilter) detectorOpts.issueAuthorFilter = issueAuthorFilter;+ if (Array.isArray(issueExcludeLabels) && issueExcludeLabels.length > 0) detectorOpts.issueExcludeLabels = issueExcludeLabels;const result = promptTaskType === 'claim-issue-jira'? await listJiraTickets(app)- : await detectActionableWork(promptTaskType, app, issueAuthorFilter ? { issueAuthorFilter } : {});+ : await detectActionableWork(promptTaskType, app, detectorOpts);return {...base,diff --git a/server/services/workItems.test.js b/server/services/workItems.test.jsindex 843f8d9e25..6f98f4d6ed 100644--- a/server/services/workItems.test.js+++ b/server/services/workItems.test.js@@ -46,6 +46,18 @@ describe('listWorkItems', () => {expect(out.items).toHaveLength(2);});+ it('passes a non-empty issueExcludeLabels through to the detector, omits it when empty', async () => {+ resolveAppWorkTracker.mockResolvedValue({ resolved: 'github', source: 'origin' });+ detectActionableWork.mockResolvedValue({ actionable: false, count: 0, reason: 'no-open-issues' });++ await listWorkItems(app, { issueExcludeLabels: ['good first issue'] });+ expect(detectActionableWork).toHaveBeenCalledWith('claim-issue', app, { issueExcludeLabels: ['good first issue'] });++ detectActionableWork.mockClear();+ await listWorkItems(app, { issueExcludeLabels: [] });+ expect(detectActionableWork).toHaveBeenCalledWith('claim-issue', app, {});+ });+it('routes PLAN.md apps to the plan-task detector', async () => {resolveAppWorkTracker.mockResolvedValue({ resolved: 'plan', source: 'fallback' });detectActionableWork.mockResolvedValue({ actionable: true, count: 1, reason: 'actionable-plan-items', items: [{ ref: 'do-thing', title: 'Do the thing' }] });