Skip to content

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

fix: preserve claim review flow for manual plan tasks

[._.]/ Adam Eivye5e0e3db9692
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index 63f7709d52..6782b26983 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -505,7 +505,10 @@ export async function buildClaimWorkTask(app, {
// otherwise delegate to the resolved tracker's prompt body. Mirrors the
// scheduled router's `promptKeyForBody` selection — a custom claim-work prompt
// overrides the tracker-specific body for both paths.
- const template = await getTaskPrompt(interval.prompt ? 'claim-work' : promptTaskType);
+ const template = await getTaskPrompt(
+ interval.prompt ? 'claim-work' : promptTaskType,
+ { claimFlow: true }
+ );
const resolvedAuthorFilter = resolveClaimAuthorFilter(issueAuthorFilter, metadata);
diff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.js
index 0c46ace455..9a09b6a278 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -522,7 +522,7 @@ describe('claim-work single-source routing', () => {
expect(fn).toMatch(/buildLocalReviewerInstructions\(reviewersList/);
// A direct claim-work prompt customization overrides the tracker body, same
// as the scheduled router's promptKeyForBody selection.
- expect(fn).toMatch(/getTaskPrompt\(interval\.prompt \? 'claim-work' : promptTaskType\)/);
+ expect(fn).toMatch(/getTaskPrompt\(\s*interval\.prompt \? 'claim-work' : promptTaskType/);
});
});
diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.js
index 7c5bd9b0de..20380a66bc 100644
--- a/server/services/taskPromptDefaults.test.js
+++ b/server/services/taskPromptDefaults.test.js
@@ -51,7 +51,7 @@ describe('taskPromptDefaults integrity snapshot', () => {
expect(gitlab).toContain('Never force-delete with `-D`');
});
- it('plan-task v18 omits the code-review phase while preserving v17', () => {
+ it('plan-task v18 scheduled default omits review while preserving CI and v17', () => {
const current = DEFAULT_TASK_PROMPTS['plan-task'];
const previous = PREVIOUS_DEFAULT_PROMPTS['plan-task'].at(-1);
@@ -60,6 +60,7 @@ describe('taskPromptDefaults integrity snapshot', () => {
expect(current).not.toContain('{reviewers}');
expect(current).not.toContain('LOCAL reviewers');
expect(current).not.toContain('PR-SIDE reviewers');
+ expect(current).toContain('gh pr checks <num> --required --watch --fail-fast');
expect(previous).toContain('## Phase 6 — Review locally');
expect(previous).toContain('{reviewers}');
expect(previous).not.toBe(current);
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 9342898cae..d01279fdb7 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -15,7 +15,7 @@
"simplify": "2a048214d1dd3b75bee9ae1a38fa1589",
"feature-ideas": "d3282f16da29efe2d53595b3b34778bc",
"plan-feature": "b20980c8eda2256060d09d4bca397244",
- "plan-task": "d242bd29757b5780a486e613de7297f2",
+ "plan-task": "b85fe92999aa4ee4a8910320457c4242",
"claim-issue": "6a9bebb3f31b7c1b0a0728def0fe5b3c",
"claim-issue-gitlab": "1f9ec476dce71d04e588d17e72cd46c9",
"claim-issue-jira": "c66170bfcdee911f03e60261c4f503db",
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index 0809710465..d1489ee7a8 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -810,7 +810,8 @@ Use \`feat:\` / \`fix:\` / \`refactor:\` / \`chore:\` / etc. (The bracketed-scop
1. Push the branch: \`git push -u origin claim/<slug>\`.
2. Open the PR with \`gh pr create\` — title MUST encode the slug: \`<type>([<slug>]): <description>\`. Body should summarize what shipped + test plan.
-3. **Merge immediately via \`gh pr merge\`** — NEVER a local merge and NEVER \`--auto\`. Prefer a true merge commit so Git retains the branch tip, but fall back when the repository disallows that method:
+3. **Wait for required CI before merging.** Run \`gh pr checks <num> --required --watch --fail-fast\` — REQUIRED checks only, so optional jobs cannot stall the merge. If a required check stays red, comment on the PR naming the failure, remove only the worktree, and leave the branch and PR for reconciliation.
+4. **Merge immediately via \`gh pr merge\`** — NEVER a local merge and NEVER \`--auto\`. Prefer a true merge commit so Git retains the branch tip, but fall back when the repository disallows that method:
\`\`\`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 || {
diff --git a/server/services/taskPromptService.js b/server/services/taskPromptService.js
index 5c5b0a990f..d3c9c92c40 100644
--- a/server/services/taskPromptService.js
+++ b/server/services/taskPromptService.js
@@ -46,6 +46,14 @@ export {
PREVIOUS_DEFAULT_PROMPTS
};
+// The scheduled plan-task default intentionally omits the review loop, but the
+// manual /do:next PLAN claim still owns the complete claim lifecycle. Keep that
+// path on the last shipped review-capable body rather than silently handing it
+// a partial prompt just because both paths resolve the same task type.
+const CLAIM_FLOW_DEFAULT_PROMPTS = Object.freeze({
+ 'plan-task': PREVIOUS_DEFAULT_PROMPTS['plan-task'].at(-1)
+});
+
// ============================================================
// Prompt getters
// ============================================================
@@ -84,9 +92,12 @@ async function resolvePromptPlaceholders(prompt) {
return prompt;
}
-export async function getTaskPrompt(taskType) {
+export async function getTaskPrompt(taskType, { claimFlow = false } = {}) {
const interval = await getTaskInterval(taskType);
- let prompt = interval.prompt || DEFAULT_TASK_PROMPTS[taskType] || `[Improvement] ${taskType} analysis
+ let prompt = interval.prompt
+ || (claimFlow ? CLAIM_FLOW_DEFAULT_PROMPTS[taskType] : null)
+ || DEFAULT_TASK_PROMPTS[taskType]
+ || `[Improvement] ${taskType} analysis
Repository: {repoPath}
diff --git a/server/services/taskPromptService.test.js b/server/services/taskPromptService.test.js
index f24f4fd2fb..d14d078bad 100644
--- a/server/services/taskPromptService.test.js
+++ b/server/services/taskPromptService.test.js
@@ -8,7 +8,7 @@ vi.mock('./taskSchedule.js', () => ({
getTaskInterval: vi.fn(async () => ({ prompt: 'before {worktreesRoot}/claim-x after' })),
}));
-import { getTaskPrompt, getStagePrompt, DEFAULT_TASK_PROMPTS } from './taskPromptService.js';
+import { getTaskPrompt, getStagePrompt, DEFAULT_TASK_PROMPTS, PREVIOUS_DEFAULT_PROMPTS } from './taskPromptService.js';
import { getTaskInterval } from './taskSchedule.js';
import { PATHS } from '../lib/fileUtils.js';
@@ -26,6 +26,23 @@ describe('taskPromptService {worktreesRoot} substitution', () => {
});
});
+describe('claim-flow prompt variants', () => {
+ it('keeps scheduled plan-task review-free while manual PLAN claims retain review guidance', async () => {
+ getTaskInterval.mockResolvedValue({ prompt: null });
+
+ const scheduled = await getTaskPrompt('plan-task');
+ const manual = await getTaskPrompt('plan-task', { claimFlow: true });
+
+ expect(scheduled).not.toContain('## Phase 6 — Review locally');
+ expect(scheduled).toContain('gh pr checks <num> --required --watch --fail-fast');
+ const expectedManual = PREVIOUS_DEFAULT_PROMPTS['plan-task'].at(-1)
+ .replace(/\{worktreesRoot\}/g, PATHS.worktrees);
+ expect(manual).toBe(expectedManual);
+ expect(manual).toContain('## Phase 6 — Review locally');
+ expect(manual).toContain('{reviewers}');
+ });
+});
+
// A pipeline STAGE body (pr-reviewer-security, code-reviewer-review, …) is read
// straight out of the catalog by its promptKey — it is never persisted and never
// versioned, which is why editing one takes no PROMPT_VERSIONS bump and no