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
address review (codex): rank atomic work above epics, and promote a split parent on both axes
[._.]/ Adam Eivy76e5fb521319
diff --git a/server/lib/dispatchLabels.js b/server/lib/dispatchLabels.jsindex c8e6369285..85f6bd6f1e 100644--- a/server/lib/dispatchLabels.js+++ b/server/lib/dispatchLabels.js@@ -71,12 +71,22 @@ export const CONTRIBUTOR_LABEL_DESCRIPTIONS = Object.freeze({*/export const EPIC_DECOMPOSED_LABEL = 'decomposed';+/**+ * The umbrella marker itself. Half of the "already handled" signal — an issue is+ * skipped by the claim queue only when it is BOTH epic-shaped and decomposed —+ * so a flow that promotes an oversized issue to an epic has to be able to create+ * this label too, not just apply it.+ */+export const EPIC_LABEL = 'epic';+export const WORKFLOW_LABEL_COLORS = Object.freeze({[EPIC_DECOMPOSED_LABEL]: 'BFD4F2',+ [EPIC_LABEL]: 'B60205',});export const WORKFLOW_LABEL_DESCRIPTIONS = Object.freeze({[EPIC_DECOMPOSED_LABEL]: 'Epic already split into per-slice child issues',+ [EPIC_LABEL]: 'Umbrella/tracking issue — shipped as per-slice children, never as one PR',});const MODEL_SET = new Set(DISPATCH_MODEL_TIERS);diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.jsindex 4633a66002..53ac0e3f9a 100644--- a/server/services/perpetualWork.js+++ b/server/services/perpetualWork.js@@ -33,7 +33,7 @@ import { githubApiHost, hostFromOriginUrl } from '../lib/workTracker.js';// The epic marker lives with the forge label vocabulary (name + color + the// `label create` idiom the prompt bodies interpolate), so the detector and the// live claim agent cannot drift on what "already decomposed" is spelled.-import { EPIC_DECOMPOSED_LABEL } from '../lib/dispatchLabels.js';+import { EPIC_DECOMPOSED_LABEL, EPIC_LABEL } from '../lib/dispatchLabels.js';export { EPIC_DECOMPOSED_LABEL };@@ -191,7 +191,7 @@ export function titleMarksEpic(title) {// True when an issue is a tracking/umbrella epic — by `epic` label or by the// title conventions above. `labels` is the caller's already-lowercased list.-const isEpicIssue = (title, labels) => labels.includes('epic') || titleMarksEpic(title);+const isEpicIssue = (title, labels) => labels.includes(EPIC_LABEL) || titleMarksEpic(title);const normalizeLogin = (value) => (value == null ? '' : String(value)).trim().toLowerCase();diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex 081a6bb3ed..3e3ad92687 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -16,8 +16,8 @@"feature-ideas": "d3282f16da29efe2d53595b3b34778bc","plan-feature": "b20980c8eda2256060d09d4bca397244","plan-task": "b85fe92999aa4ee4a8910320457c4242",- "claim-issue": "041598f468843d08c0cd0f8b9449f652",- "claim-issue-gitlab": "e521b88f0c1e92b7c7b2750cecc3501a",+ "claim-issue": "af99e76b4881d1a18234eff0d58d49a4",+ "claim-issue-gitlab": "b5e24d2caefba4acc6fb09f6c09f2afd","claim-issue-jira": "d5e2b6cf39c2acfebef9ee8e826a7e42","code-reviewer-review": "27ded42013f28e7d327d8f1cc624aac1","code-reviewer-implement": "2e10cac7c1e1cd021d06bfddb5c1eaf2",diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex f3a3232fd3..83c1fe1f63 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -11,7 +11,7 @@// PORTOS_API_URL is interpolated into the jira-status-report default prompt below.import { PORTOS_API_URL } from '../../lib/ports.js';-import { EPIC_DECOMPOSED_LABEL, ISSUE_QUALITY_GUIDANCE, formatLabelCreateCommand } from '../../lib/dispatchLabels.js';+import { EPIC_DECOMPOSED_LABEL, EPIC_LABEL, ISSUE_QUALITY_GUIDANCE, formatLabelCreateCommand } from '../../lib/dispatchLabels.js';// The epic marker and its idempotent `label create` line come from the shared// label registry, so the label the claim agent stamps is by construction the one@@ -19,6 +19,12 @@ import { EPIC_DECOMPOSED_LABEL, ISSUE_QUALITY_GUIDANCE, formatLabelCreateCommand// second decomposition must not abort Phase 1b just because the label exists.const EPIC_LABEL_CREATE_GH = formatLabelCreateCommand(EPIC_DECOMPOSED_LABEL);const EPIC_LABEL_CREATE_GLAB = formatLabelCreateCommand(EPIC_DECOMPOSED_LABEL, { cli: 'glab' });+// Promoting an oversized issue to an epic needs the umbrella label to EXIST: the+// queue skips a parent only when it is both epic-shaped and marked, so an+// `--add-label epic` that fails on a repo without the label leaves the parent+// actionable and it gets re-split every pass.+const UMBRELLA_LABEL_CREATE_GH = formatLabelCreateCommand(EPIC_LABEL);+const UMBRELLA_LABEL_CREATE_GLAB = formatLabelCreateCommand(EPIC_LABEL, { cli: 'glab' });const SCHEDULED_ISSUE_QUALITY_GATE = `## Scheduled issue-quality gate@@ -886,11 +892,11 @@ Run steps 1–5 in order.gh pr list --state open --json headRefName -q '.[].headRefName' 2>/dev/null\`\`\`For each ref (after stripping any leading \`origin/\` / \`upstream/\` prefix), extract the issue number **only when the ref matches** \`claim/issue-<num>\` (number after \`claim/issue-\`) or \`cos/<task>/issue-<num>/<agent>\` (the \`issue-<num>\` third segment). Do NOT flag an issue just because its bare number appears elsewhere in a ref.-4. **Pick the target issue:** walk the candidate list oldest-first and pick the FIRST issue where ALL of the following are true:+4. **Pick the target issue:** walk the candidate list oldest-first in TWO passes. First pass, consider only NON-epic issues and take the first that satisfies every rule below — atomic work always outranks an epic, whatever their relative age. Only if that pass finds nothing do you make a second pass for an undecomposed epic (same rules), and an epic you pick goes to **Phase 1b**, not Phase 2. A single oldest-first pass would enter a decomposition the moment an epic happened to be older than claimable work, which is exactly backwards. The rules:- Its number is NOT in the in-flight set.- It has no assignees, or at least one assignee's login matches \`$ME\` (an issue assigned only to another account is already claimed). If \`$ME\` is empty, skip every assigned issue.- It does NOT carry any of these blocking labels: {issueExcludeLabels}.- - It is NOT an ALREADY-DECOMPOSED tracking/umbrella **epic**. An epic is 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); it counts as decomposed once it carries the \`decomposed\` label. Skip a decomposed epic — its child slices are ordinary claimable issues in this very list, so claiming the parent would duplicate them. An epic that is NOT yet decomposed IS eligible, but only as a **last resort**: it can't ship as one PR, so prefer every eligible non-epic issue first and fall through to an epic only when the walk finds no atomic work. An epic you pick goes to **Phase 1b**, not Phase 2. **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.+ - It is NOT an ALREADY-DECOMPOSED tracking/umbrella **epic**. An epic is recognized by an \`${EPIC_LABEL}\` label, a title ending in "(epic)", OR a title beginning with an \`[epic]\` bracket or \`Epic:\` tag (e.g. "[Epic] …" / "Epic: …", case-insensitive); it counts as decomposed once it ALSO carries the \`${EPIC_DECOMPOSED_LABEL}\` label. Skip a decomposed epic — its child slices are ordinary claimable issues in this very list, so claiming the parent would duplicate them. An undecomposed epic is eligible only in the second pass above. **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. **But an open, undecomposed epic is NOT an empty queue**: never report "no work available" while one is unclaimed. Splitting it is the work — go to Phase 1b.Capture the issue number as \`NUM\`, its title, and its full body — you'll reuse them in the PR and the \`Closes #<num>\` trailer.@@ -970,7 +976,12 @@ Read the full issue (\`gh issue view "\${NUM}" --comments\`) before writing any(A too-large scope is NOT in this list — it has its own park path below.)-**A genuinely too-large issue gets SPLIT, not parked.** 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, promote it to an epic and decompose it: file the slices and rewrite the parent exactly as **Phase 1b** steps 4–6 describe (each slice carrying \`Part of #\${NUM}\`; add \`epic\` and \`decomposed\` to THIS issue), release its claim markers (\`gh issue edit "\${NUM}" --remove-assignee @me --remove-label in-progress\`), remove the worktree, then continue at Phase 2 with the first slice you filed. Splitting an omnibus issue is work you do, not a hand-off. Park to \`needs-input\` (\`gh issue edit "\${NUM}" --add-label needs-input\`, release the markers, remove the worktree, exit) ONLY when the issue is too vague to slice against the code at all — that park is what stops a perpetual drain from re-picking an un-shippable issue every pass (Phase 1 step 4 skips \`needs-input\`).+**A genuinely too-large issue gets SPLIT, not parked.** 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, promote it to an epic and decompose it: file the slices and rewrite the parent exactly as **Phase 1b** steps 4–6 describe (each slice carrying \`Part of #\${NUM}\`). **Promote it on BOTH axes, creating the umbrella label first** — the queue skips a parent only when it is epic-shaped AND marked, so an issue left carrying only \`${EPIC_DECOMPOSED_LABEL}\` stays claimable and gets re-split every pass:+\`\`\`bash+${UMBRELLA_LABEL_CREATE_GH}+gh issue edit "\${NUM}" --add-label ${EPIC_LABEL} --add-label ${EPIC_DECOMPOSED_LABEL}+\`\`\`+Verify BOTH labels are actually on the issue afterwards (\`gh issue view "\${NUM}" --json labels\`); if the \`${EPIC_LABEL}\` label still won't stick, append " (epic)" to the title instead (\`gh issue edit "\${NUM}" --title "… (epic)"\`) — the title convention marks an epic with no label at all. Then release its claim markers (\`gh issue edit "\${NUM}" --remove-assignee @me --remove-label in-progress\`), remove the worktree, and continue at Phase 2 with the first slice you filed. Splitting an omnibus issue is work you do, not a hand-off. Park to \`needs-input\` (\`gh issue edit "\${NUM}" --add-label needs-input\`, release the markers, remove the worktree, exit) ONLY when the issue is too vague to slice against the code at all — that park is what stops a perpetual drain from re-picking an 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.@@ -1080,11 +1091,11 @@ Run steps 1–5 in order.glab mr list --per-page 100 --output json # read each MR's source_branch\`\`\`For each ref (after stripping any leading \`origin/\` prefix), extract the issue number **only when the ref matches** \`claim/issue-<num>\` (number after \`claim/issue-\`) or \`cos/<task>/issue-<num>/<agent>\` (the \`issue-<num>\` third segment). Do NOT flag an issue just because its bare number appears elsewhere in a ref.-4. **Pick the target issue:** walk the candidate list oldest-first and pick the FIRST issue where ALL of the following are true:+4. **Pick the target issue:** walk the candidate list oldest-first in TWO passes. First pass, consider only NON-epic issues and take the first that satisfies every rule below — atomic work always outranks an epic, whatever their relative age. Only if that pass finds nothing do you make a second pass for an undecomposed epic (same rules), and an epic you pick goes to **Phase 1b**, not Phase 2. A single oldest-first pass would enter a decomposition the moment an epic happened to be older than claimable work, which is exactly backwards. The rules:- Its number (\`iid\`) is NOT in the in-flight set.- It has no assignees, or at least one assignee's username matches \`$ME\` (an issue assigned only to another account is already claimed). If \`$ME\` is empty, skip every assigned issue.- It does NOT carry any of these blocking labels: {issueExcludeLabels}.- - It is NOT an ALREADY-DECOMPOSED tracking/umbrella **epic**. An epic is 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); it counts as decomposed once it carries the \`decomposed\` label. Skip a decomposed epic — its child slices are ordinary claimable issues in this very list. An epic that is NOT yet decomposed IS eligible, but only as a **last resort**: prefer every eligible non-epic issue first, and an epic you pick goes to **Phase 1b**, not Phase 2. **The bare \`plan\` label is NOT a skip signal** — it marks the claimable queue, not a blocker.+ - It is NOT an ALREADY-DECOMPOSED tracking/umbrella **epic**. An epic is recognized by an \`${EPIC_LABEL}\` label, a title ending in "(epic)", OR a title beginning with an \`[epic]\` bracket or \`Epic:\` tag (e.g. "[Epic] …" / "Epic: …", case-insensitive); it counts as decomposed once it ALSO carries the \`${EPIC_DECOMPOSED_LABEL}\` label. Skip a decomposed epic — its child slices are ordinary claimable issues in this very list. An undecomposed epic is eligible only in the second pass above. **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. **But an open, undecomposed epic is NOT an empty queue** — go to Phase 1b instead of reporting "no work available".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.@@ -1135,7 +1146,7 @@ Read the full issue (\`glab issue view "\${NUM}"\`) before writing any code. **E(A too-large scope is NOT in this list — it has its own park path below.)-**A genuinely too-large issue gets SPLIT, not parked.** 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, promote it to an epic and decompose it exactly as **Phase 1b** steps 4–6 describe (each slice carrying \`Part of #\${NUM}\`; add \`epic\` and \`decomposed\` to THIS issue), release its claim markers (\`glab issue update "\${NUM}" --unassign --unlabel in-progress\`), remove the worktree, then continue at Phase 2 with the first slice you filed. Splitting an omnibus issue is work you do, not a hand-off. Park to \`needs-input\` (\`glab issue update "\${NUM}" --label needs-input\`, release the markers, remove the worktree, exit) ONLY when the issue is too vague to slice against the code at all — that park stops a perpetual drain from re-picking an un-shippable issue every pass (Phase 1 step 4 skips \`needs-input\`).+**A genuinely too-large issue gets SPLIT, not parked.** 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, promote it to an epic and decompose it exactly as **Phase 1b** steps 4–6 describe (each slice carrying \`Part of #\${NUM}\`). **Promote it on BOTH axes, creating the umbrella label first** — the queue skips a parent only when it is epic-shaped AND marked, so an issue left carrying only \`${EPIC_DECOMPOSED_LABEL}\` stays claimable and gets re-split every pass: \`${UMBRELLA_LABEL_CREATE_GLAB}\`, then \`glab issue update "\${NUM}" --label ${EPIC_LABEL} --label ${EPIC_DECOMPOSED_LABEL}\`. Confirm both landed (\`glab issue view "\${NUM}" --output json\`); if the \`${EPIC_LABEL}\` label won't stick, append " (epic)" to the title instead — the title convention marks an epic with no label at all. Then release its claim markers (\`glab issue update "\${NUM}" --unassign --unlabel in-progress\`), remove the worktree, and continue at Phase 2 with the first slice you filed. Splitting an omnibus issue is work you do, not a hand-off. Park to \`needs-input\` (\`glab issue update "\${NUM}" --label needs-input\`, release the markers, remove the worktree, exit) ONLY when the issue is too vague to slice against the code at all — that park stops a perpetual drain from re-picking an 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.