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: keep claim-miss warn shape and un-export helper (#12875)

Adam Eivy060ce13029e7
diff --git a/server/lib/README.md b/server/lib/README.md
index ec0d07d326..782ba24c0b 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -116,7 +116,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `persistentMindToolActivation.js` | Pure lease-state helpers for progressive Persistent Mind tool exposure: the `TOOL_ACTIVATION_FAMILIES` vocabulary, `tools.activate`/`tools.deactivate` input schemas, and default/normalize/age/activate/renew/deactivate over a `{family: turnsLeft}` lease map. Retention is a selection hint only — every consumer still re-checks the real capability grant.
| `heavyJobClaim.js` | Cross-process, machine-wide accelerator claim: `claimHeavyLocalJob({ kind, id, timeoutMs? })` either acquires an ephemeral `data/` lock or reports its active holder; dead-PID claims are reclaimed, and a spawned child can take over the recorded PID across a server restart. |
| `agentValidation.js` | Social-bot agent schemas (personality, Moltbook/Moltworld accounts, automation schedules, agent tools + Moltworld payloads) and CoS Feature Agent definitions. |
-| `autonomousJobTask.js` | `generatedJobTaskFields` — (+ `isEphemeralJobTask` / `isExpectedUnpersistedMiss`: a scheduled fire never persists its task, so the spawn/finalize status writes miss by design and stay quiet) flattens a `generateTaskFromJob` result into the top-level keys the non-raw `cos.addTask` path maps onto metadata. One allowlist shared by the manual "Run now" endpoint and the quota-burn lane, so a key added to the generator cannot reach one and not the other. Pure. |
+| `autonomousJobTask.js` | `generatedJobTaskFields` — (+ `isExpectedUnpersistedMiss`: a scheduled fire never persists its task, so the spawn/finalize status writes miss by design and stay quiet) flattens a `generateTaskFromJob` result into the top-level keys the non-raw `cos.addTask` path maps onto metadata. One allowlist shared by the manual "Run now" endpoint and the quota-burn lane, so a key added to the generator cannot reach one and not the other. Pure. |
| `qualitySchedulePlan.js` | Lays a managed app's schedulable quality audits out across a week. `planQualitySchedule({taskTypes, fileIssuesByType, busy, options})` → one weekly cron per check plus ONE daily cron for the issue-claim drain that follows each check by `claimOffsetHours` (placed forward-only, so a drain never precedes the audit it works for); `orderQualityChecks` topologically sorts the selection by `AUDIT_SUGGESTED_AFTER`; `buildBusySlots(occupancies, options)` turns expanded crons into the occupied `"<day>:<hour>"` cells the placement avoids (which is how a 03:30 release job keeps audits out of its window); `resolveQualityScheduleOptions` is the ONE default/window/claim-type resolver the planner and its service caller share. Which repo shape each audit needs is catalog-owned (`auditCapabilityRequirement`), not declared here. Pure: no schedule read, no repo read, no clock. |
| `quotaBurnConfig.js` | Quota-burn plan shape: the provider families, the burn-job type alphabet + catalog the config page renders its form from, `QUOTA_BURN_BOUNDS` (the one bounds table the normalizer clamps to, the Zod schemas reject against, and the catalog descriptors publish as min/max), and total normalization (`normalizeQuotaBurnConfig`). Owns the dispatch-cap sentinel too (`QUOTA_BURN_UNLIMITED_DISPATCHES` / `isUnlimitedDispatchCap`) — -1 means the window is not counted, and is the default. Also owns the retired executor's task-description parser (`QUOTA_BURN_TASK_PREFIX` / `quotaBurnFamilyOfDescription`), kept for migration 225, and the `run once` vocabulary (`quotaBurnJobKey` / `jobIsSpent`, plus the two family predicates `familyIsConfigured` and `familyHasRunnableJobs`). Pure — no storage, no provider I/O. |
| `quotaBurnLegacyConversion.js` | The ONE rule turning a LEGACY quota-burn step (copied prompt + quota-only `jobType`) into a scheduled-task reference, shared by migration 359 and the live compat path so the two cannot drift. `planQuotaBurnStepConversion` decides between three outcomes — a recognized unmodified shipped preset onto its scheduled audit counterpart with issues-only pinned explicitly (`AUDIT_TASK_TYPE_BY_PRESET_ID`, inverted from `auditCatalog.js`), the two programmatic types onto their scheduled handlers, and anything customized or targetless onto a `buildQuotaBurnCustomJob` on-demand custom task addressed by the deterministic `quotaBurnCustomJobId` (which is what makes a repeated or resumed conversion create no duplicate). `legacyAgentTaskMetadata` reproduces the retired executor's dispatch posture; `applyQuotaBurnStepConversion` rewrites the step, preserving id, label, enabled and run-once state. Recognition is `matchStoredAuditPreset`, never a label or a partial match. |
diff --git a/server/lib/autonomousJobTask.js b/server/lib/autonomousJobTask.js
index 3c9a948d1f..04d48c4dc5 100644
--- a/server/lib/autonomousJobTask.js
+++ b/server/lib/autonomousJobTask.js
@@ -65,7 +65,7 @@ export function generatedJobTaskFields(generated) {
* at spawn and finalization legitimately find no row. Manual/quota runs queue
* through `addTask` and get a store-minted id, so a missing one IS a deletion.
*/
-export function isEphemeralJobTask(task) {
+function isEphemeralJobTask(task) {
const jobId = task?.metadata?.jobId;
return task?.metadata?.autonomousJob === true && !!jobId && typeof task.id === 'string' && task.id.startsWith(`${jobId}-`);
}
diff --git a/server/services/agentSpawnDispatch.js b/server/services/agentSpawnDispatch.js
index ae713edd33..161e230064 100644
--- a/server/services/agentSpawnDispatch.js
+++ b/server/services/agentSpawnDispatch.js
@@ -268,8 +268,8 @@ async function runAgentDispatch(context, { spawnViaRunner } = {}) {
console.error(`❌ Failed to mark task ${task.id} as in_progress: ${err.message}`);
return null;
});
- if (updateResult?.error && !isExpectedUnpersistedMiss(task, updateResult.error)) {
- emitLog('warn', `⚠️ in_progress claim for task ${task.id} returned an error (taskType=${task.taskType}): ${updateResult.error}`, { taskId: task.id, error: updateResult.error });
+ if (updateResult?.error) {
+ if (!isExpectedUnpersistedMiss(task, updateResult.error)) emitLog('warn', `⚠️ in_progress claim for task ${task.id} returned an error (taskType=${task.taskType}): ${updateResult.error}`, { taskId: task.id, error: updateResult.error });
}
if (prep.cleanupReviewPinConsumed && (updateResult?.error || updateResult?.statusChanged)) {
await context.cleanupOnError('Failed to persist reviewed-head launch admission; retained checkout requires revalidation');