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
fix: recognize deeper foundation critique
[._.]/ Adam Eivy971d1688637a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1a765f4a83..33be8d42de 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -10,5 +10,6 @@- **Runs History safely displays structured model output.** Prompt and output endpoints are read as plain text, preventing valid JSON completions from crashing React when a run is expanded.- **Arc auto-resolve keeps corrections field-scoped and within storage limits.** A resolver fixing one synopsis now omits unrelated volume fields instead of paraphrasing them, and its prompt carries explicit headroom below every persisted arc/volume string cap so a well-intended rewrite cannot be silently clipped into the next verification failure.- **Arc verification preserves its best demonstrated draft.** Any auto-resolve pass that raises the total blocking-finding count now pauses immediately and restores the lowest-blocker arc snapshot seen in that gate, even when the verifier describes the added problems as newly surfaced findings. Equal-count rounds advance the checkpoint because narrower replacement findings can reflect real causal repairs; divergence and max-round exits therefore keep the latest verified best state instead of rewinding useful work or preserving whichever unverified rewrite happened to run last.+- **Foundation repair distinguishes a deeper critique from a stalled rewrite.** When a harsh re-judge holds a dimension at the same coarse score but identifies a genuinely different underlying gap, that new layer receives its own bounded repair window. Fuzzy-matched paraphrases of the same problem still accrue toward the divergence guard, so the loop remains finite instead of pausing simply because one successful fix exposed the next weakness.- **Continuing a video carries its prompt forward.** Continuing or extending a clip we generated now prefills the Video Gen prompt (and negative prompt) with the one that produced the source, instead of dropping you into an empty box. This covers both entry points: the **Continue** action on a video card/lightbox, and picking a prior render in Extend mode. Text you typed yourself is never overwritten — only a blank box or a value an earlier pick filled — and a clip we didn't generate (an import, or a legacy render with no stored prompt) leaves the field alone rather than clearing it. The style preset is dropped along with the prefill, since history stores the already-composed prompt and re-applying a preset would prefix it twice.- **Subscription Usage cards now lay out in four quadrants.** The provider quota grid orders Claude, Antigravity, Codex, Grok — and because Codex and Grok typically report only a single weekly meter, they now share one grid cell stacked vertically instead of each stretching to a full-height card. Cards render at their natural height, so the Image Gen card floats into the fourth quadrant and the whole section fits above the fold on desktop.diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.jsindex 27cb80d12d..d4553db81e 100644--- a/server/services/pipeline/seriesAutopilot.test.js+++ b/server/services/pipeline/seriesAutopilot.test.js@@ -1715,7 +1715,23 @@ describe('autopilot conductor', () => {});it('foundation gate: still stops after the same target repeatedly fails to improve', async () => {- foundationScore = 7;+ const stalled = {+ seriesId: 'ser-example', status: 'complete', weightedScore: 7,+ dimensions: {+ worldbuilding: {+ score: 7,+ gap: 'The setting lacks a concrete scarcity mechanism and authority conflict.',+ fix: 'Define the scarcity mechanism and authority conflict.',+ },+ character: { score: 10, gap: 'clean', fix: 'none' },+ structure: { score: 10, gap: 'clean', fix: 'none' },+ craft: { score: 10, gap: 'clean', fix: 'none' },+ },+ };+ judgeFoundation+ .mockImplementationOnce(async () => stalled)+ .mockImplementationOnce(async () => stalled)+ .mockImplementationOnce(async () => stalled);const { seriesId } = await seedComplete();await autopilot.startSeriesAutopilot(seriesId, { maxFoundationRounds: 5 });await waitFor(runFinished(seriesId));@@ -1726,6 +1742,32 @@ describe('autopilot conductor', () => {expect(applyFoundationFix).toHaveBeenCalledTimes(2);});+ it('foundation gate: gives a newly exposed gap at the same score its own repair window', async () => {+ const snap = (gap, score = 7) => ({+ seriesId: 'ser-example', status: 'complete', weightedScore: score,+ dimensions: {+ worldbuilding: { score, gap, fix: `repair ${gap}` },+ character: { score: 10, gap: 'clean', fix: 'none' },+ structure: { score: 10, gap: 'clean', fix: 'none' },+ craft: { score: 10, gap: 'clean', fix: 'none' },+ },+ });+ judgeFoundation+ .mockImplementationOnce(async () => snap('The visitor has no defined body scale or metabolic support needs.'))+ .mockImplementationOnce(async () => snap('The neighboring societies lack governance, factions, and translation methods.'))+ .mockImplementationOnce(async () => snap('The home settlement has no concrete infrastructure failure chain or ration authority.'))+ .mockImplementationOnce(async () => snap('clean', 10));++ const { seriesId } = await seedComplete();+ await autopilot.startSeriesAutopilot(seriesId, { maxFoundationRounds: 4 });+ await waitFor(runFinished(seriesId));++ expect(autopilot.__testing.runs.get(seriesId)?.lastPayload?.type).toBe('complete');+ expect(applyFoundationFix).toHaveBeenCalledTimes(3);+ expect(applyFoundationFix.mock.calls.map(([, dimension]) => dimension))+ .toEqual(['worldbuilding', 'worldbuilding', 'worldbuilding']);+ });+it('foundation gate: pauses immediately when the weakest dimension cannot be auto-fixed', async () => {foundationScore = 3;foundationFixApplied = false; // owning service can't apply a fixdiff --git a/server/services/pipeline/seriesAutopilot/childRuns.js b/server/services/pipeline/seriesAutopilot/childRuns.jsindex cffe0cdc09..a2b4b26444 100644--- a/server/services/pipeline/seriesAutopilot/childRuns.js+++ b/server/services/pipeline/seriesAutopilot/childRuns.js@@ -22,7 +22,7 @@ import { MAX_ARC_VERIFY_ROUNDS, MAX_BEAT_CONTINUITY_ROUNDS, MAX_FOUNDATION_ROUNDimport {CHILD_POLL_MS, DIVERGENCE_PATIENCE, trackConvergence, convergencePauseReason,divergencePauseReason, foundationPauseReason, foundationDivergenceReason,- regressionPauseReason,+ regressionPauseReason, sameFinding,} from './convergence.js';import { broadcast, budgetPause, providerOverrideOpts, providerIdOpts, roleLlm, seasonPreserveOpts } from './session.js';import { requiredScriptStages, textReady } from './stepResolver.js';@@ -378,10 +378,25 @@ export async function runFoundationGate(seriesId, record) {// THEIR OWN target. A global weighted high-water mark is not comparable// across different targets: improving character can make a previously// latent structure or craft gap judgeable and lower the aggregate score.- const targetConvergence = trackConvergence(- convergenceByDimension.get(weak.dimension) || { best: null, sinceBest: 0 },- 10 - weak.score,- );+ const priorConvergence = convergenceByDimension.get(weak.dimension)+ || { best: null, sinceBest: 0, finding: null };+ const currentFinding = {+ location: weak.dimension,+ problem: snap.dimensions?.[weak.dimension]?.gap || '',+ };+ let targetConvergence = trackConvergence(priorConvergence, 10 - weak.score);+ // A harsh critic can hold a dimension at the same score after the repair+ // closed its broad gap, then expose a genuinely different layer beneath it.+ // That is progress even though the coarse 0–10 number tied. Give the new+ // gap its own patience window; fuzzy-match paraphrases of the SAME gap so a+ // judge cannot evade the bounded stall guard merely by rewording itself.+ const changedGap = priorConvergence.finding?.problem+ && currentFinding.problem+ && !sameFinding(priorConvergence.finding, currentFinding);+ if (targetConvergence.sinceBest > 0 && changedGap) {+ targetConvergence = { best: targetConvergence.best, sinceBest: 0 };+ }+ targetConvergence.finding = currentFinding;convergenceByDimension.set(weak.dimension, targetConvergence);if (targetConvergence.sinceBest >= DIVERGENCE_PATIENCE) {const floorReason = gate.failingDimensions.length > 0