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: admit and dedupe tasks queued under the pre-rename release-check name

[._.]/ Adam Eivyccd7d3792686
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index 8f0ff6d0c7..d5db68532b 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -32,6 +32,7 @@ import { sanitizeTaskMetadata, PIPELINE_STAGE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS,
import { PATHS } from '../lib/fileUtils.js';
import { applyAppPlaceholders } from '../lib/appPromptPlaceholders.js';
import { renderOrPrependSection } from '../lib/promptSectionRenderer.js';
+import { currentTaskTypeName } from '../lib/scheduledTaskTypes.js';
import { isPlainObject } from '../lib/objects.js';
import { hasQuotaBurnProvenance, isManualOnDemandRequest } from '../lib/quotaBurnOrigin.js';
import { isAutoApprovableInvestigation } from '../lib/investigationTasks.js';
@@ -788,7 +789,9 @@ export async function resolveAutonomyBudget(state, runningAgentEntries) {
return { cosAutonomyMode, autonomousActionsRemaining };
}
-const analysisTypeForTask = (task) => task.metadata?.analysisType || task.metadata?.selfImprovementType;
+// Tasks queued before a task-type rename (TASK_TYPE_RENAMES) resolve to the
+// current schedule key, or they would read as disabled and never drain.
+const analysisTypeForTask = (task) => currentTaskTypeName(task.metadata?.analysisType || task.metadata?.selfImprovementType);
function isDisabledAnalysisType(task, taskSchedule) {
const analysisType = analysisTypeForTask(task);
@@ -1423,9 +1426,9 @@ export function buildImprovementDedupSets(existingTasks, { ignoreTaskId = null }
const isActive = task.status === 'pending' || task.status === 'in_progress';
const isBlocked = task.status === 'blocked';
const isFailureBlocked = isBlocked && task.metadata?.blockedCategory !== 'user-terminated';
- const analysisType = task.metadata?.analysisType ||
+ const analysisType = currentTaskTypeName(task.metadata?.analysisType ||
task.metadata?.selfImprovementType ||
- task.description?.match(/\[(?:self-improvement|improvement)\]\s*(\w[\w-]*)/i)?.[1];
+ task.description?.match(/\[(?:self-improvement|improvement)\]\s*(\w[\w-]*)/i)?.[1]);
const appId = task.metadata?.app;
if ((isActive || isBlocked) && analysisType) {
const taskKey = appId ? `app:${appId}:${analysisType}` : analysisType;
diff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.js
index 82e2f2d1ba..bbe65805ec 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -1423,6 +1423,14 @@ describe('buildImprovementDedupSets (#2614 — failure-blocked tasks occupy thei
expect(sets.appsWithBlockedImprovement.get('app-1')).toBe('sys-t1');
});
+ it('a task queued under a renamed type holds the current type slot', () => {
+ // A release-check task queued before migration 417 must dedupe against
+ // do-release, or the generator mints a duplicate next to it.
+ const sets = buildImprovementDedupSets([liTask({}, { analysisType: 'release-check' })]);
+ expect(sets.existingTaskTypes.has('app:app-1:do-release')).toBe(true);
+ expect(sets.existingTaskTypes.has('app:app-1:release-check')).toBe(false);
+ });
+
it('a failure-blocked NON-improvement task never holds the per-app cap', () => {
// Blocked tasks are not reaped, so a blocked investigation / review
// follow-up (app-tagged but no derivable analysis type) holding the cap