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: preserve effort in model outcome backfills

[._.]/ Adam Eivydb9ea44d8fdc
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index b3a59e2986..5f2b1b83b6 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,7 +2,7 @@
## Changed
-- **Series Autopilot can learn which models actually work at each step.** AI run history now distinguishes technical completion from a later editorial keep/revert decision and aggregates evidence by orchestration step, creative-versus-judge role, provider, model, and reasoning effort. The new opt-in selector requires multiple quality-reviewed samples, ignores disabled providers and removed models, and remains a soft default beneath explicit run choices and exact prompt-stage pins. The Options panel reports how much attributed and quality-reviewed evidence exists, while local APIs expose the full metrics and allow an operator to correct or backfill a historical outcome. Foundation judges record contract-valid responses separately from true editorial approval, and foundation repairs automatically record accepted versus rolled-back outcomes, so a model that finishes a long run but makes the story worse is not learned as a success.
+- **Series Autopilot can learn which models actually work at each step.** AI run history now distinguishes technical completion from a later editorial keep/revert decision and aggregates evidence by orchestration step, creative-versus-judge role, provider, model, and reasoning effort. The new opt-in selector requires multiple quality-reviewed samples, ignores disabled providers and removed models, and remains a soft default beneath explicit run choices and exact prompt-stage pins. The Options panel reports how much attributed and quality-reviewed evidence exists, while local APIs expose the full metrics and allow an operator to correct or backfill a historical outcome, including its effort when the older run predates effort telemetry. Foundation judges record contract-valid responses separately from true editorial approval, and foundation repairs automatically record accepted versus rolled-back outcomes, so a model that finishes a long run but makes the story worse is not learned as a success.
- **Completed CoS agents no longer strand a worktree because of their own completion marker.** The `.agent-done` sentinel is consumed before worktree cleanup, but Git still reported the untracked file as ordinary authored work and the safety gate preserved the otherwise-clean checkout with a high-priority warning. Cleanup now ignores only that runtime marker: sentinel-only trees are removed normally, while any real source change still preserves the worktree and is named in the warning.
diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsx
index 9623b9971e..767ea840b1 100644
--- a/client/src/components/pipeline/AutopilotPanel.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.jsx
@@ -928,7 +928,7 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
</label>
{opt.autoSelectModels ? (
<p className="text-[11px] text-gray-500">
- Uses separate technical and quality outcomes by step, role, provider, model and effort. A route needs at least {modelMetrics?.minimumQualitySamples ?? 2} quality-reviewed samples; explicit choices above and exact Prompts-stage pins still win. Current history: {modelMetrics?.evidenceRuns ?? 0} attributed run{modelMetrics?.evidenceRuns === 1 ? '' : 's'}, {modelMetrics?.metrics?.reduce((sum, metric) => sum + (metric.qualityEvaluated || 0), 0) ?? 0} quality-reviewed.
+ Uses separate technical and quality outcomes by step, role, provider, model and effort. Historical outcomes can backfill effort when older run records lack it. A route needs at least {modelMetrics?.minimumQualitySamples ?? 2} quality-reviewed samples; explicit choices above and exact Prompts-stage pins still win. Current history: {modelMetrics?.evidenceRuns ?? 0} attributed run{modelMetrics?.evidenceRuns === 1 ? '' : 's'}, {modelMetrics?.metrics?.reduce((sum, metric) => sum + (metric.qualityEvaluated || 0), 0) ?? 0} quality-reviewed.
</p>
) : null}
<label className="flex items-center gap-2 text-xs text-gray-300">
diff --git a/server/routes/pipeline/autopilot.js b/server/routes/pipeline/autopilot.js
index cb7af596cd..9d4f7048f7 100644
--- a/server/routes/pipeline/autopilot.js
+++ b/server/routes/pipeline/autopilot.js
@@ -185,6 +185,7 @@ const modelOutcomeSchema = z.object({
role: z.enum(['creative', 'judge']),
stage: z.string().trim().min(1).max(80),
outcome: z.enum(['accepted', 'rejected', 'valid', 'invalid']),
+ effort: z.enum(EFFORT_LEVELS).optional(),
target: z.string().trim().max(120).optional(),
scoreBefore: z.number().finite().optional(),
scoreAfter: z.number().finite().optional(),
diff --git a/server/services/pipeline/seriesAutopilot/modelPerformance.js b/server/services/pipeline/seriesAutopilot/modelPerformance.js
index 721eaf359c..f6945d157b 100644
--- a/server/services/pipeline/seriesAutopilot/modelPerformance.js
+++ b/server/services/pipeline/seriesAutopilot/modelPerformance.js
@@ -171,6 +171,7 @@ export async function recordModelOutcome(runId, patch = {}) {
const scoreAfter = finiteOrNull(patch.scoreAfter);
await patchRunMetadata(runId, {
autopilotSystem: 'series',
+ ...(patch.effort ? { effort: patch.effort } : {}),
...(patch.role ? { pipelineRole: patch.role } : {}),
...(patch.stage ? { pipelineStage: patch.stage } : {}),
...(patch.outcome ? { qualityOutcome: patch.outcome } : {}),
diff --git a/server/services/pipeline/seriesAutopilot/modelPerformance.test.js b/server/services/pipeline/seriesAutopilot/modelPerformance.test.js
index d28d32f198..2d604c6fd9 100644
--- a/server/services/pipeline/seriesAutopilot/modelPerformance.test.js
+++ b/server/services/pipeline/seriesAutopilot/modelPerformance.test.js
@@ -1,5 +1,14 @@
-import { describe, expect, it } from 'vitest';
-import { MIN_QUALITY_SAMPLES, summarizeModelPerformance } from './modelPerformance.js';
+import { describe, expect, it, vi } from 'vitest';
+
+const { patchRunMetadata } = vi.hoisted(() => ({ patchRunMetadata: vi.fn() }));
+
+vi.mock('../../runner.js', () => ({
+ getRun: vi.fn(async () => ({ id: 'run-1' })),
+ listRuns: vi.fn(),
+ patchRunMetadata,
+}));
+
+import { MIN_QUALITY_SAMPLES, recordModelOutcome, summarizeModelPerformance } from './modelPerformance.js';
const provider = (id, models, enabled = true) => ({ id, name: id, models, enabled });
const run = (over = {}) => ({
@@ -17,6 +26,13 @@ const run = (over = {}) => ({
});
describe('Series Autopilot model performance', () => {
+ it('backfills effort onto historical run evidence', async () => {
+ await recordModelOutcome('run-1', {
+ role: 'creative', stage: 'foundationGate', outcome: 'rejected', effort: 'max',
+ });
+ expect(patchRunMetadata).toHaveBeenCalledWith('run-1', expect.objectContaining({ effort: 'max' }));
+ });
+
it('keeps technical completion separate from quality rejection', () => {
const { metrics } = summarizeModelPerformance([
run({ qualityOutcome: 'rejected', qualityScoreDelta: -0.2 }),