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

address review (codex r4): revert the duration-rebuild override, clarify exemption basis

[._.]/ Adam Eivy7db2a1b74399
diff --git a/server/services/taskLearning/metrics.js b/server/services/taskLearning/metrics.js
index 023e3e07c2..4820933179 100644
--- a/server/services/taskLearning/metrics.js
+++ b/server/services/taskLearning/metrics.js
@@ -29,7 +29,6 @@ import {
} from './store.js';
import { deriveFailureSignalAvoidance, isNonRoutableLearnedTier } from './routing.js';
import { recordCorrelationSample } from './correlationQuality.js';
-import { isNonCommittingCoordinatorTask } from '../taskTypeHooks.js';
// Cap on retained per-category signature samples — bounds file growth the same
// way `recentUnknownErrors` does, while keeping enough recent context to spot
@@ -879,26 +878,31 @@ export async function recalculateDurationStats() {
agentCount++;
const duration = meta.result?.duration || 0;
- const archivedTask = {
- description: meta.metadata?.taskDescription,
- metadata: meta.metadata,
- taskType: meta.metadata?.taskType
- };
// Validation-authoritative outcome (issue #2344), consistent with the live
// recordTaskCompletion path: an archived clean-exit run that missed its
// declared criterion is NOT a success (excluded from success-only ETAs),
// and a commit-found run is a success even on a non-zero exit. Falls back to
// the raw exit-code success for records that predate validationPassed.
- // A gh/git coordinator's persisted validationPassed is a pre-fix FOSSIL (#2696) —
- // it never makes a [task-<id>] commit — so drop it here exactly as the backfill
- // sanitizer and finalize do, or its successful runs would be wrongly excluded and
- // its success-only ETA underestimated.
- const vp = isNonCommittingCoordinatorTask(archivedTask) ? null : meta.result?.validationPassed;
+ // NOTE (#2696): the coordinator commit-criterion exemption is deliberately NOT
+ // applied here. This rebuild re-derives success-only DURATIONS from archives but
+ // does not rebuild the `succeeded` COUNTS, and totals.successDurationMs (below) is
+ // summed unconditionally. Overriding a coordinator's fossil validationPassed:false
+ // to an exit-code success here would add its duration to totals while migration 198
+ // had already removed its count — inflating the totals ETA. A post-fix coordinator
+ // run carries validationPassed:null (finalize returns null) and is already counted
+ // correctly; a pre-fix fossil is left excluded so durations stay consistent with the
+ // purged counts. The residual archives-vs-counts skew of this manual rebuild predates
+ // #2696 and is ETA-cosmetic.
+ const vp = meta.result?.validationPassed;
const outcomeSuccess = typeof vp === 'boolean' ? vp : !!meta.result?.success;
if (!outcomeSuccess || duration <= 0) continue;
successCount++;
- const taskType = extractTaskType(archivedTask);
+ const taskType = extractTaskType({
+ description: meta.metadata?.taskDescription,
+ metadata: meta.metadata,
+ taskType: meta.metadata?.taskType
+ });
if (data.byTaskType[taskType]) {
data.byTaskType[taskType].successDurationMs += duration;
diff --git a/server/services/taskTypeHooks.js b/server/services/taskTypeHooks.js
index b43186cd9c..387a8d3b9d 100644
--- a/server/services/taskTypeHooks.js
+++ b/server/services/taskTypeHooks.js
@@ -84,12 +84,24 @@ export function resolveTaskHookType(task) {
* Deliberately NOT every self-improvement type: accessibility / security / code-quality
* / plan-task / claim-issue / claim-work / jira-sprint-manager / do-replan all COMMIT
* (fixing tasks, /claim flows, or a triage that commits PLAN.md), so their commit
- * criterion is real and must stay — exempting them would MASK genuine failures. Only the
- * structurally-no-commit coordinators belong here. pr-watcher is intentionally excluded:
- * its prompt is customizable to push code, so exempting it could mask a customized run's
- * failure. Kept as a leaf so both agentLifecycle (the live criterion) and taskLearning's
- * history backfill (migration-durability) read ONE source of truth. Migration 198 purges
- * the buckets these already poisoned on existing installs.
+ * criterion is real and must stay — exempting them would MASK genuine failures. Only
+ * complete tasks whose DEFAULT contract is structurally no-commit belong here.
+ *
+ * pr-watcher is intentionally excluded on a different axis: it is a review-of-others'-PRs
+ * TEMPLATE — its shipped prompt explicitly says "the operator customizes this prompt to
+ * change what happens on each opened PR" (and it ships `readOnly:false`), i.e. it is
+ * designed to be rewritten, commonly into a commit-pushing flow, so a type-level exemption
+ * would be the wrong default for it. The four types here are complete tasks that finish
+ * YOUR in-flight work via a git/gh/API side effect. CAVEAT: the exemption keys on the
+ * SCHEDULED TYPE, not the actual per-install prompt, so an operator who rewrites one of
+ * these four prompts to make source commits would have that customized run judged by exit
+ * code instead of its commit (a telemetry-accuracy tradeoff, not a functional bug). A
+ * per-task `noCommitCriterion` contract would remove that caveat but complicates the
+ * migration's static type→bucket mapping; deferred as not worth it for the default case.
+ *
+ * Kept as a leaf so both agentLifecycle (the live criterion) and taskLearning's history
+ * backfill (migration-durability) read ONE source of truth. Migration 198 purges the
+ * buckets these already poisoned on existing installs.
*/
export const NON_COMMITTING_COORDINATOR_TASK_TYPES = new Set([
'branch-reconcile', 'issue-reconcile', 'branch-cleanup', 'jira-status-report',