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): recognize legacy pending CD tasks by their creativeDirector marker

Adam Eivy40639220728e
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index 2b67926c95..e535eb7683 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -724,8 +724,11 @@ export async function buildAgentPrompt(task, config, workspaceDir, worktreeInfo
// all commit/push/PR completion guidance in favor of the sentinel-only contract.
const discardWorktree = isTruthyMetaFn(task.metadata?.discardWorktree);
// No-code / API-action task (e.g. Creative Director agents): deliverable is an
- // HTTP PATCH, not a commit — suppress the /do:push completion workflow.
- const noCodeOutput = isTruthyMetaFn(task.metadata?.noCodeOutput);
+ // HTTP PATCH, not a commit — suppress the /do:push completion workflow. Also
+ // derive from a CD task's own `creativeDirector` marker so tasks queued as
+ // `pending` BEFORE this flag existed (persisted across an upgrade) are still
+ // recognized without a metadata migration.
+ const noCodeOutput = isTruthyMetaFn(task.metadata?.noCodeOutput) || !!task.metadata?.creativeDirector;
const isWorktreeOnExistingBranch = worktreeInfo?.existingBranch === true;
const worktreeSection = worktreeInfo ? `
## Git Worktree Context
@@ -1062,8 +1065,10 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMet
const discardWorktree = isTruthyMetaFn(task.metadata?.discardWorktree);
// A no-code / API-action task (e.g. a Creative Director plan/treatment/evaluate
// agent): its deliverable is an HTTP PATCH, not a commit — suppress the
- // /do:push completion workflow (see buildActionOutputCompletionSection).
- const noCodeOutput = isTruthyMetaFn(task.metadata?.noCodeOutput);
+ // /do:push completion workflow (see buildActionOutputCompletionSection). Also
+ // derive from a CD task's `creativeDirector` marker so pre-upgrade `pending`
+ // tasks (queued before this flag existed) are recognized without a migration.
+ const noCodeOutput = isTruthyMetaFn(task.metadata?.noCodeOutput) || !!task.metadata?.creativeDirector;
const isReviewLoopFollowUp = isTruthyMetaFn(task.metadata?.reviewLoopFollowUp);
const isWorktreeOnExistingBranch = worktreeInfo?.existingBranch === true;
// Ordered reviewer list + flags for the Review Loop (task metadata wins; else
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index be5b341cd4..d902a4e662 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -130,6 +130,19 @@ describe('no-code / API-action task completion (CD agents must NOT be told to /d
expect(prompt).not.toMatch(/## Completion Workflow/);
});
+ it('recognizes a legacy CD task by its creativeDirector marker (pre-upgrade pending, no explicit flag)', () => {
+ // A CD task queued before the noCodeOutput flag existed carries only the
+ // creativeDirector marker — it must STILL skip the /do:push workflow.
+ const legacyCdTask = makeTask({
+ metadata: { context: 'PATCH the plan', creativeDirector: { projectId: 'p', kind: 'plan' }, openPR: false },
+ });
+ const prompt = buildLightContextPrompt(legacyCdTask, '/repo', null, isTruthyMeta, {
+ providerId: 'claude-code-tui', providerCommand: 'claude',
+ });
+ expect(prompt).toMatch(/## Completion \(No Code Output\)/);
+ expect(prompt).not.toMatch(/## Completion Workflow/);
+ });
+
it('a normal code task on the same provider still gets the /do:push Completion Workflow', () => {
const prompt = buildLightContextPrompt(
makeTask({ metadata: { openPR: false } }), '/repo', null, isTruthyMeta,