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

Merge pull request #2345 from atomantic/claim/issue-2329

[._.]/ Adam Eivy8ab798e20875
diff --cc .changelog/NEXT.md
index 2bc959e157,665bf87d47..4f949b7dba
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@@ -14,8 -14,8 +14,9 @@@
## Added
+- **[issue-2328] Auto-fix outcomes are now aggregated into dashboard telemetry with a success-rate trend.** The structured `metadata.diagnostics` persisted on every error-driven task (tier / category / failure reason) were queryable but never surfaced. A new pure aggregator (`server/services/autoFixMetrics.js`) reads them off task records and rolls them up by fallback tier, failure category, and task status — plus a time-to-recovery summary (count / avg / median / min / max) and a daily success-rate trend — exposed via `GET /api/autofix/metrics` and rendered by a new **Auto-Fix Telemetry** dashboard widget (overall recovery rate, trend sparkline, per-tier breakdown, median recovery time). To measure time-to-recovery, each diagnostics record now carries an `observedAt` failure timestamp; recovery is derived from the task's completion edit. Sentinel discipline throughout — a rate with no denominator and a duration with no completed-with-timing samples return `null`, never a fabricated `0`, so "no data yet" can't read as "0% success". (Further #2328 slice remains: full 4-tier fallback *execution* wiring — the classifier still annotates the investigation task rather than attempting each tier's fix in sequence.)
- **[issue-2333] Untyped task executions are now auto-classified instead of piling up as `unknown`.** Task-learning's `extractTaskType` used to dump every execution it couldn't pattern-match into a single blind `unknown` bucket — those tasks bypassed routing logic, skipped outcome learning, and leaked unstructured failures. It now runs an execution-entry classification hook (`classifyUntypedTask`, pure/idempotent/<50ms) that, before giving up, infers a concrete domain from additional signals — a `selfImprovementType` metadata hint, an explicit `task.taskType` the primary extractor didn't special-case (e.g. `scheduled` → `scheduled-task`), and broader whole-word description keyword signatures (`fix`/`investigate`/`crash` → `auto-fix`, `refactor`/`optimize` → `self-improve:general`, `review`/`audit` → `idle-review`, `unit test`/`coverage` → `test-task`) — and only falls back to a new sandboxed `external/untyped` type when nothing matches. Newly-classified and fallback executions flow through the existing #2329 failure-signature harvesting so their failures are captured in the normalized telemetry schema. The `external/untyped` bucket is explicitly walled off from routing (it never drives a model-tier suggestion and is never globally skipped) so a heterogeneous grab-bag can't create a routing blind spot or loop. (Partial delivery of #2333; the spawn-time key mirror in `agentModelSelection.extractTaskTypeKey` and deeper self-improvement-loop consumption of the harvested `failureSignatures` remain.)
+ - **[issue-2329] Model routing now consumes the enriched failure signatures, and the latency split derives a queue/compute breakdown when a source timestamp is missing.** The `failureSignatures` telemetry recorded per completion (provider/model/tier-attributed, recency-bounded) is now read by `suggestModelTier`: a new pure `deriveFailureSignalAvoidance` cross-references those recent failures against `routingAccuracy` and steers selection off a tier that is BOTH accumulating recent failures for a task type AND unproven (success rate < 80%, or no success data) — catching a freshly-degrading tier before its all-time rate crosses the hard misroute line, while a proven tier keeps its slot despite absolute failures (signatures record failures only, so counts alone can't condemn a tier). The dominant failing provider/model is surfaced as a `failureSignal` on the suggestion and named in the model-selection log, so the routing decision is legible rather than "avoid tier X". Separately, the queue/compute latency split now falls back to `wall − compute` (or `wall − queue`) when a run carries no `createdAt` or no runner duration, with a per-leg `source` marker (`measured`/`derived`/`null`) so a derived value is never confused with a measured one and a legitimate `0ms` is never confused with an absent leg. (Further #2329 work remains: success-criteria validation booleans on every completion path and the >0.8 correlation-quality measurement window.)
- **[issue-2329] Task-learning now records a structured telemetry context for every completed agent.** On each completion the learning system builds a `TaskTelemetryContext` — a failure signature (`{ category, messageSnippet, failurePosition }`, reusing the category `agentErrorAnalysis` already classified), execution context (`provider`, `model`, `modelTier`, `taskType`, `component`, input-size, and the routing decision rationale), and a latency breakdown (`wallMs` spawn→completion vs. `queueMs` wait vs. `executionMs` measured) — using explicit null sentinels for anything not cheaply derivable rather than fabricating values. Failure signatures are aggregated per error category into a new additive `failureSignatures` block in `learning.json` (older files without the key load unchanged), and the enriched context is surfaced on the single-line completion log. (Partial delivery of #2329; routing auto-adjustment that consumes these signals, success-criteria validation flags, the queue/compute split where spawn timestamps are missing, and correlation-quality measurement remain.)
## Fixed