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: don't pin a scheduled-task prompt re-saved as the current default (#5432)
[._.]/ Adam Eivy398e59d3bfb9
diff --git a/server/routes/cosScheduleRoutes.test.js b/server/routes/cosScheduleRoutes.test.jsindex 7831677122..b55d5f380a 100644--- a/server/routes/cosScheduleRoutes.test.js+++ b/server/routes/cosScheduleRoutes.test.js@@ -177,9 +177,11 @@ describe('CoS Schedule Routes', () => {expect(taskSchedule.updateTaskInterval).not.toHaveBeenCalled();});- // promptSource carries the stored prompt's provenance (#5432). It must reach- // updateTaskInterval, or a PUT that round-trips a task config would strip a- // user's pin and hand the prompt back to the auto-upgrade.+ // promptSource carries the stored prompt's provenance (#5432). An explicit+ // prompt write stamps it server-side, so the allowlist entry exists for the+ // writes that carry provenance WITHOUT a prompt — restoring a saved config,+ // or releasing a pin back to the auto-upgrade path without clearing the body.+ // The enum is validated here so neither can persist an unrecognized value.it('forwards a valid promptSource', async () => {taskSchedule.updateTaskInterval.mockResolvedValue({ type: 'weekly' });diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex f2a4a1b862..1db8bc74bc 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -162,14 +162,21 @@ export async function updateTaskInterval(taskType, settings) {// If user is setting a custom prompt, mark it so auto-upgrade won't overwrite it.// If user clears the prompt (null), remove the customized flag to resume defaults.//- // `promptSource` records that this write was an EXPLICIT user action, which is- // what the store's self-heal reads to leave the pin alone (#5432). Without it,- // pasting an older SHIPPED body into Settings → Scheduled Tasks was un-pinnable:- // the self-heal saw a body matching a retired default, cleared the flag on the- // next load, and the next PROMPT_VERSIONS bump overwrote the chosen text.+ // `promptSource: 'user'` records that this write was an EXPLICIT user action,+ // which is what the store's self-heal reads to leave the pin alone (#5432).+ // Without it, pasting an older SHIPPED body into Settings → Scheduled Tasks was+ // un-pinnable: the self-heal saw a body matching a retired default, cleared the+ // flag on the next load, and the next PROMPT_VERSIONS bump overwrote the text.+ //+ // A body identical to the CURRENT default is not a pin. The editor prefills its+ // textarea from the stored prompt, so re-saving an untouched default would+ // otherwise stamp a permanent pin and freeze that type off every future prompt+ // upgrade — which is exactly the mis-flag the self-heal existed to undo, now+ // beyond its reach. Retired shipped bodies still pin: that is the #5432 case.if ('prompt' in settings) {- settings.promptCustomized = settings.prompt != null;- settings.promptSource = settings.prompt != null ? 'user' : null;+ settings.promptCustomized = settings.prompt != null+ && settings.prompt !== DEFAULT_TASK_PROMPTS[taskType];+ settings.promptSource = settings.promptCustomized ? 'user' : null;}schedule.tasks[taskType] = {diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.jsindex 4f0e8471ec..1682292a34 100644--- a/server/services/taskSchedule.test.js+++ b/server/services/taskSchedule.test.js@@ -725,6 +725,26 @@ describe('taskSchedule', () => {expect(result.promptSource).toBe('user')})+ // The prompt editor prefills from the stored body, so "open, click Save" sends+ // back the CURRENT default verbatim. That must not pin — a pin is checked by+ // the self-heal only when its provenance is inferred, so a 'user' stamp here+ // would freeze the type off every future prompt upgrade with no way back.+ it('should not pin a prompt that is byte-identical to the current default', async () => {+ const result = await updateTaskInterval('security', {+ prompt: DEFAULT_TASK_PROMPTS['security']+ })+ expect(result.promptCustomized).toBe(false)+ expect(result.promptSource).toBeNull()+ })++ // A RETIRED shipped body IS a deliberate choice — the #5432 case.+ it('should pin a retired shipped default written by the user', async () => {+ const retired = PREVIOUS_DEFAULT_PROMPTS['security'][0]+ const result = await updateTaskInterval('security', { prompt: retired })+ expect(result.promptCustomized).toBe(true)+ expect(result.promptSource).toBe('user')+ })+it('should clear promptSource when the prompt is set to null', async () => {const result = await updateTaskInterval('security', {prompt: null