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: record queued release-check outcomes on the migrated do-release ledger

[._.]/ Adam Eivy174dc1ccf219
diff --git a/server/lib/README.md b/server/lib/README.md
index 326160d1a6..f167709f4a 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -492,7 +492,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `taskStatusTransition.js` | The CoS task STATUS TRANSITION vocabulary (#6620) — `resolveTaskStatusTransition(previousStatus, nextStatus)` classifies one update's status pair ONCE and returns `{ action, isRevive, isRequeue, entersInProgress, leavesInProgress, leavesBlocked, isTerminal }`, so `writeTaskUpdate`'s blocked/pause clear, resume-pointer drop, retry-hold retire, claim release, requeue stamp and emitted `tasks:changed` action all read one answer instead of re-deriving seven. A falsy `nextStatus` means "this patch carries no status" (a lease-renewal heartbeat) and releases nothing. `isTerminalTaskStatus(status)` is the shared `completed`/`blocked` predicate `cosTaskStore` and `cosTaskMerge` both read. Pure — metadata predicates (is this block a pause?) stay at the application site. |
| `taskTargetBranch.js` | Pure task-branch contract: `resolveTaskTargetBranch(metadata)` reads a retry's legacy `existingBranch` or a review-loop follow-up's canonical `reviewLoopPRBranch`; `shouldStripTaskTargetBranch(metadata)` identifies only retry-owned pointers for terminal cleanup. |
| `claimContinuation.js` | Claim-flow relaunch pointer. `claimContinuationBranch(claimTarget)` is the `claim/issue-<n>` or `claim/<key>` branch a pinned target checks out. `claimContinuationPointer(...)` names the `claim-*` worktree already holding that branch when a relaunch should finish it in place (locked, prunable, unmanaged, or occupied by another running/paused agent → null). `claimContinuationWorkspace(...)` turns a still-on-disk pointer into the cwd the next agent uses without moving the directory. |
-| `scheduledTaskTypes.js` | Registered scheduled task names (`SELF_IMPROVEMENT_TASK_TYPES`), shared by schedule configuration and authoritative skill routing. |
+| `scheduledTaskTypes.js` | Registered scheduled task names (`SELF_IMPROVEMENT_TASK_TYPES`), shared by schedule configuration and authoritative skill routing; plus the retired-name map (`TASK_TYPE_RENAMES`, `currentTaskTypeName`, `taskExecutionKey`) for tasks and records written before a task rename. |
| `scheduleRunOrder.js` | Storage rules for a task's advisory `suggestedAfter` list — which OTHER scheduled tasks to run first. `normalizeSuggestedAfter` drops blanks, duplicates and self-references and caps at `SUGGESTED_AFTER_MAX`; the shipped order it defaults to is `auditCatalog.AUDIT_SUGGESTED_AFTER`, layered at read time in `getScheduleStatus`. Advisory only — the ENFORCED dependency field is `runAfter`. Pure — no I/O. |
| `taskTargetScope.js` | Target scope for a scheduled task type: `INSTALL_WIDE_TASK_TYPES`, `MANAGED_APP_TARGET_TASK_TYPES`, `PROGRAMMATIC_SCHEDULED_TASK_TYPES`, `isProgrammaticScheduledTaskType`, `requiresManagedAppTarget`, `requiresInstallWideTarget`. Declared here (not in `services/taskScheduleRegistry.js`, which re-exports it) so `quotaBurnValidation.js` can reject a burn reference with the wrong target scope without importing upward into services. |
| `taxonomyTally.js` | Generic taxonomy tally + top-N-line render engine shared by the two Layered Intelligence leaf taxonomies (`services/layeredIntelligenceRejections.js`, `layeredIntelligenceExecutionFailures.js`). `createTaxonomyTally({predicate, select, field, vocabulary, sentinel, glossFn, gapWording})` is the single composed seam — it binds a taxonomy config into `{summarize, format}`, where `summarize(records)` yields the three-bucket `{entries, unknown, unclassified, diagnosed, total}` tally (commonest-first + taxonomy-order tie-break) and `format(records, limit)` renders one prompt line naming every non-zero gap. Also exports the two leaf utilities the classifiers use directly: `normalizeToken(value)` (lowercase + separator-collapse for label/category matching) and `formatTaxonomyToken(token, labels)` (gloss-map render, nullish→'', unglossed passthrough). Pure leaf — imports nothing from the LI graph. |
diff --git a/server/lib/scheduledTaskTypes.js b/server/lib/scheduledTaskTypes.js
index 81a7fc279b..9f6b536743 100644
--- a/server/lib/scheduledTaskTypes.js
+++ b/server/lib/scheduledTaskTypes.js
@@ -8,6 +8,8 @@ import { PROGRAMMATIC_SCHEDULED_TASK_TYPES } from './taskTargetScope.js';
// and the prompt-integrity history that follows the renamed key.
export const TASK_TYPE_RENAMES = Object.freeze({ 'react-lifecycle': 'ui-lifecycle', 'release-check': 'do-release' });
export const currentTaskTypeName = (taskType) => TASK_TYPE_RENAMES[taskType] || taskType;
+// A task type's `task:`-prefixed schedule executions key, under its current name.
+export const taskExecutionKey = (taskType) => `task:${currentTaskTypeName(taskType.startsWith('task:') ? taskType.slice(5) : taskType)}`;
export const SELF_IMPROVEMENT_TASK_TYPES = [
PRIVATE_SECURITY_TASK_TYPE,
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index 2cc5b9a3e9..91f826ecfd 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -19,6 +19,7 @@
* perpetual gate in cosTaskGenerator.prepareManagedAppImprovementTask.
*/
+import { taskExecutionKey as executionKey } from '../lib/scheduledTaskTypes.js';
import { cosEvents, emitLog } from './cosEvents.js';
import { formatSkipCauses } from '../lib/perpetualSkipCauses.js';
import { DAY, safeDate } from '../lib/fileUtils.js';
@@ -496,11 +497,6 @@ function ensureExecutionRecord(schedule, taskType, appId) {
return top;
}
-/** Normalize a task type to its `task:`-prefixed executions map key. */
-function executionKey(taskType) {
- return taskType.startsWith('task:') ? taskType : `task:${taskType}`;
-}
-
/**
* Resolve the EXISTING execution sub-record (global or per-app) without creating
* it — the read-only counterpart to ensureExecutionRecord. Returns null when the
diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.js
index 29d7c0b538..c2ba4f6f37 100644
--- a/server/services/taskSchedule.test.js
+++ b/server/services/taskSchedule.test.js
@@ -3202,6 +3202,20 @@ describe('taskSchedule', () => {
expect(saved.executions['task:security'].perApp['app-1'].consecutiveFailures).toBe(1)
})
+ it('records a task queued under a retired type name on the renamed ledger', async () => {
+ // A release-check task queued before migration 417 finishes after it.
+ mockSchedule({
+ tasks: { 'do-release': { type: 'on-demand', enabled: true } },
+ executions: { 'task:do-release': { lastRun: null, count: 0, perApp: {
+ 'app-1': { lastRun: null, count: 0, consecutiveFailures: 1, lastFailureAt: new Date().toISOString() }
+ } } }
+ })
+ const rec = await recordTaskTypeFailure('release-check', 'app-1', { errorCategory: 'timeout' })
+ expect(rec.consecutiveFailures).toBe(2)
+ const saved = JSON.parse(writeFile.mock.calls.at(-1)[1])
+ expect(saved.executions).not.toHaveProperty('task:release-check')
+ })
+
it('auto-parks + notifies after FAILURE_PARK_THRESHOLD consecutive failures', async () => {
mockSchedule({
tasks: { security: { type: 'rotation', enabled: true } },
diff --git a/server/services/taskScheduleBackoff.js b/server/services/taskScheduleBackoff.js
index 0d50ef1ec1..0a6cdcc4d1 100644
--- a/server/services/taskScheduleBackoff.js
+++ b/server/services/taskScheduleBackoff.js
@@ -1,6 +1,9 @@
/** Consecutive-failure backoff and auto-park state for scheduled task types. */
import { cosEvents, emitLog } from './cosEvents.js';
+// Resolves a pre-rename task type (TASK_TYPE_RENAMES) to the ledger key the
+// rename migration moved its history to.
+import { taskExecutionKey as executionKey } from '../lib/scheduledTaskTypes.js';
import { loadSchedule, updateSchedule } from './taskScheduleStore.js';
import {
FAILURE_BACKOFF_BASE_MS,
@@ -23,7 +26,6 @@ export function computeFailureBackoffMs(consecutiveFailures, baseMs = FAILURE_BA
if (n <= 0) return 0;
return Math.min(baseMs * Math.pow(2, n), capMs);
}
-const executionKey = (taskType) => taskType.startsWith('task:') ? taskType : `task:${taskType}`;
const ensureExecutionRecord = (schedule, taskType, appId) => {
const key = executionKey(taskType);