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

address review (codex): manual /do:next honors custom claim-work prompt

Adam Eivy84d9a5a1f0ce
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index c66447df67..d5221919dd 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -188,8 +188,10 @@ export function resolveIssueAuthorFilterBlock(promptTaskType, mode = 'owner') {
* `claim-work` behavior (global schedule metadata → per-app override → Code
* Review Defaults), exactly as the scheduled `claim-work` router resolves them —
* so clicking the button honors `issueAuthorFilter: 'any'` and non-Copilot
- * reviewers instead of silently forcing owner-only + Copilot. Explicit options
- * still win when a caller passes them.
+ * reviewers instead of silently forcing owner-only + Copilot. A direct
+ * `claim-work` prompt customization likewise overrides the tracker-specific body
+ * (matching the scheduled router's `promptKeyForBody` selection). Explicit
+ * options still win when a caller passes them.
*
* @returns {Promise<{ tracker, source, promptTaskType, prompt, taskMetadata }>}
*/
@@ -200,7 +202,6 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers } =
const wt = await resolveAppWorkTracker(app);
const promptTaskType = trackerToClaimTaskType(wt.resolved) || 'plan-task';
- const template = await getTaskPrompt(promptTaskType);
// Resolve the app's configured claim-work metadata the same way the scheduled
// router does: global schedule metadata, then per-app overrides on top (managed
@@ -217,6 +218,12 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers } =
const sanitizedAppMeta = sanitizeTaskMetadata(strippedAppOverride);
if (sanitizedAppMeta) Object.assign(metadata, sanitizedAppMeta);
+ // Honor a direct claim-work prompt customization if the user set one;
+ // 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);
+
// Explicit option > configured metadata > 'owner' default.
const resolvedAuthorFilter = issueAuthorFilter ?? metadata.issueAuthorFilter ?? 'owner';
diff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.js
index e9cbb72e4d..468ef406a4 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -140,6 +140,9 @@ describe('claim-work single-source routing', () => {
// reviewers fall back to Code Review Defaults via normalizeReviewers, dropping local-LLM reviewers.
expect(fn).toMatch(/normalizeReviewers\(metadata, codeReviewDefaults\?\.reviewers\)/);
expect(fn).toMatch(/LOCAL_LLM_REVIEWERS\.includes/);
+ // 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\)/);
});
});