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
address review (codex r2): match the coordinator predicate to the learning-bucket resolution
[._.]/ Adam Eivyfa283d1bfcf4
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.jsindex db39028fa8..640abb5a2e 100644--- a/server/services/agentLifecycle.js+++ b/server/services/agentLifecycle.js@@ -21,7 +21,7 @@ import { createToolExecution, startExecution, completeExecution, errorExecutionimport { determineLane, acquire, release } from './executionLanes.js';import { analyzeAgentFailure, resolveFailedTaskUpdate, resolveTypeFailureSignal } from './agentErrorAnalysis.js';import { createAgentRun, completeAgentRun, checkForTaskCommit } from './agentRunTracking.js';-import { isProgrammaticIoTaskType, resolveTaskHookType, NON_COMMITTING_COORDINATOR_TASK_TYPES } from './taskTypeHooks.js';+import { isProgrammaticIoTaskType, resolveTaskHookType, isNonCommittingCoordinatorTask } from './taskTypeHooks.js';import { buildAgentPrompt, getAppWorkspace } from './agentPromptBuilder.js';import { isOllamaClaudeProvider, isClaudeCommand, providerSuppliesGithubToken } from '../lib/providerModels.js';import { buildOpencodeEnvVars } from '../lib/opencodeConfig.js';@@ -864,8 +864,10 @@ export async function evaluateSuccessCriteria({ task, terminatedByUser, workspac// return false on every SUCCESSFUL run and drive their learning bucket to ~0% (#2696) —// the same artifact #2700 fixed for the programmatic-I/O reasoning run. They register no// output hook, so like pipeline/media jobs there is no deliverable signal to judge them- // by; fall back to the exit code (null = criterion undeclared).- if (NON_COMMITTING_COORDINATOR_TASK_TYPES.has(scheduledType)) return null;+ // by; fall back to the exit code (null = criterion undeclared). Uses the predicate (not a+ // bare `scheduledType` lookup) so the archived `taskAnalysisType` shape resolves the same+ // way the learning bucket does — see isNonCommittingCoordinatorTask.+ if (isNonCommittingCoordinatorTask(task)) return null;return await checkForTaskCommit(task.id, workspacePath);}diff --git a/server/services/agentLifecycle.successCriteria.test.js b/server/services/agentLifecycle.successCriteria.test.jsindex e211a1b9d7..36d9d5e4bb 100644--- a/server/services/agentLifecycle.successCriteria.test.js+++ b/server/services/agentLifecycle.successCriteria.test.js@@ -290,6 +290,14 @@ describe('evaluateSuccessCriteria — gh/git coordinator exemption (#2696)', ()expect(checkForTaskCommit).toHaveBeenCalledTimes(2);});+ it('exempts the ARCHIVED coordinator shape (metadata.taskAnalysisType) (#2696 codex)', async () => {+ // Matches extractTaskType's bucket resolution so the criterion agrees with the bucket on+ // the archived agent shape too (agentLifecycle stamps taskAnalysisType).+ const task = { id: 't4', taskType: 'internal', metadata: { taskAnalysisType: 'branch-cleanup' } };+ expect(await evaluateSuccessCriteria({ task, workspacePath: '/w', success: true })).toBeNull();+ expect(checkForTaskCommit).not.toHaveBeenCalled();+ });+it('exempts a coordinator typed on taskType alone, not just metadata.analysisType', async () => {// Same resolver as the programmatic-I/O gate (resolveTaskHookType), so a task shaped// with the scheduled type at the top level is exempted the same way.diff --git a/server/services/taskLearning/lifecycle.test.js b/server/services/taskLearning/lifecycle.test.jsindex e20370654d..d9733501fc 100644--- a/server/services/taskLearning/lifecycle.test.js+++ b/server/services/taskLearning/lifecycle.test.js@@ -49,6 +49,20 @@ describe('backfillFromHistory — stale coordinator verdict (#2696)', () => {}});+ it('strips the fossil for the ARCHIVED shape (taskAnalysisType, no analysisType) (#2696 codex)', async () => {+ // agentLifecycle stamps the run type onto the AGENT as metadata.taskAnalysisType, and the+ // backfill re-processes exactly that shape. extractTaskType buckets it as+ // self-improve:branch-reconcile, so the sanitizer MUST recognize it too, or the purge is+ // undone. (No `analysisType` key — only the archived `taskAnalysisType`.)+ agentsStore.list = [{+ status: 'completed', taskId: 't1',+ result: { success: true, duration: 100, validationPassed: false },+ metadata: { taskAnalysisType: 'branch-reconcile', taskType: 'internal' },+ }];+ await backfillFromHistory();+ expect(recordTaskCompletion.mock.calls[0][0].result.validationPassed).toBeNull();+ });+it('passes a committing type through UNTOUCHED — its commit verdict is real', async () => {// accessibility genuinely commits; a persisted false is a real miss, not a fossil.agentsStore.list = [completed('t1', 'accessibility', false)];diff --git a/server/services/taskTypeHooks.js b/server/services/taskTypeHooks.jsindex 41c9bfec1a..b43186cd9c 100644--- a/server/services/taskTypeHooks.js+++ b/server/services/taskTypeHooks.js@@ -97,11 +97,22 @@ export const NON_COMMITTING_COORDINATOR_TASK_TYPES = new Set([/*** Whether a task declares NO `[task-<id>]` commit criterion because it is a gh/git- * coordinator (see NON_COMMITTING_COORDINATOR_TASK_TYPES). Keyed on the same resolver as- * the programmatic-I/O gate so the scheduled type — not the CoS queue category — decides.+ * coordinator (see NON_COMMITTING_COORDINATOR_TASK_TYPES).+ *+ * Resolves the type the SAME way extractTaskType (taskLearning/store.js) computes the+ * learning bucket — `metadata.analysisType || metadata.taskAnalysisType || taskType` — NOT+ * via resolveTaskHookType (which reads only `analysisType`). This matters for the archived+ * agent shape: a LIVE queue task carries `metadata.analysisType`, but agentLifecycle stamps+ * the run's type onto the AGENT record as `metadata.taskAnalysisType` (agentLifecycle.js),+ * and that archived form is exactly what the history backfill re-processes. Keying on+ * `analysisType` alone made this predicate DISAGREE with the bucket for archived agents, so+ * the backfill sanitizer skipped them and the migration's purge could be undone (#2696,+ * codex review). Matching extractTaskType keeps the criterion, the bucket, and the sanitizer+ * consistent across both task shapes.*/export function isNonCommittingCoordinatorTask(task) {- return NON_COMMITTING_COORDINATOR_TASK_TYPES.has(resolveTaskHookType(task));+ const type = task?.metadata?.analysisType || task?.metadata?.taskAnalysisType || task?.taskType || null;+ return NON_COMMITTING_COORDINATOR_TASK_TYPES.has(type);}/**