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
fix: preserve task completion and PR overrides
[._.]/ Adam Eivy0f7930a17bec
diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex a1df2f11ab..bb7015b005 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -1262,6 +1262,7 @@ export const createCosTaskSchema = z.object({v => v === 'true' ? true : v === 'false' ? false : v,z.boolean().optional()),+ whenDone: z.enum(['commit-push', 'leave-uncommitted']).optional(),// Read-only planning mode: investigate the codebase and file the issue, but// do not start implementation delivery. The task store expands this into// the safe no-worktree/no-PR/no-simplify posture before persistence.@@ -1914,6 +1915,10 @@ export function sanitizeTaskMetadata(raw) {clean.reviewerApplies = raw.reviewerApplies;hasKeys = true;}+ if (Object.prototype.hasOwnProperty.call(raw, 'whenDone') && ['commit-push', 'leave-uncommitted'].includes(raw.whenDone)) {+ clean.whenDone = raw.whenDone;+ hasKeys = true;+ }// `prAuthorFilter` gates pr-watcher dispatch on PR authorship — constrained// to a known value so a hand-edited config can't smuggle in an arbitrary// string the watcher would silently treat as "any".diff --git a/server/lib/cosValidation.test.js b/server/lib/cosValidation.test.jsindex 7a997a9a73..970afe5295 100644--- a/server/lib/cosValidation.test.js+++ b/server/lib/cosValidation.test.js@@ -199,6 +199,16 @@ describe('cosValidation plan-only task mode', () => {});+describe('cosValidation non-worktree completion choice', () => {+ it('accepts the supported completion choices and preserves them through metadata sanitization', () => {+ expect(createCosTaskSchema.parse({ description: 'x', whenDone: 'commit-push' }).whenDone).toBe('commit-push');+ expect(createCosTaskSchema.parse({ description: 'x', whenDone: 'leave-uncommitted' }).whenDone).toBe('leave-uncommitted');+ expect(createCosTaskSchema.safeParse({ description: 'x', whenDone: 'later' }).success).toBe(false);+ expect(sanitizeTaskMetadata({ whenDone: 'commit-push' })).toEqual({ whenDone: 'commit-push' });+ expect(sanitizeTaskMetadata({ whenDone: 'later' })).toBeNull();+ });+});+describe('cosValidation reviewer CLI binaries', () => {// The bug this exists to prevent: `antigravity` is the stored, federated// reviewer identity, but the shipped executable is `agy` — no `antigravity`diff --git a/server/services/cosTaskStore.js b/server/services/cosTaskStore.jsindex 6ce9cab889..55931bbc47 100644--- a/server/services/cosTaskStore.js+++ b/server/services/cosTaskStore.js@@ -388,7 +388,7 @@ export async function addTask(taskData, taskType = 'user', { raw = false, ignore// always wins, and internal/system tasks (autopilot, self-improvement) keep// their existing auto-merge behavior so automation isn't silently gated on a// human merging a PR.- else if (taskData.useWorktree === true && taskType === 'user') metadata.openPR = true;+ else if (taskData.openPR === undefined && taskData.useWorktree === true && taskType === 'user') metadata.openPR = true;// Claim prompts own their forge lifecycle in a separately-created// claim/<item> worktree. Keep this marker independent from openPR: false is// still required to stop CoS from provisioning a second worktree.diff --git a/server/services/cosTaskStore.test.js b/server/services/cosTaskStore.test.jsindex c9fe91deda..bbf412baa2 100644--- a/server/services/cosTaskStore.test.js+++ b/server/services/cosTaskStore.test.js@@ -857,6 +857,11 @@ describe('cosTaskStore.addTask', () => {expect(task.metadata.prCompletion).toBe('leave-open');});+ it('persists the non-worktree completion choice', async () => {+ const task = await addTask({ description: 'commit in place', useWorktree: false, whenDone: 'commit-push' }, 'user');+ expect(task.metadata.whenDone).toBe('commit-push');+ });+it('defaults a worktree USER task to openPR:true when openPR is unspecified', async () => {const task = await addTask({ description: 'wt default pr', useWorktree: true }, 'user');expect(task.metadata.useWorktree).toBe(true);