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

carry rejected arc findings through every later resolve in the gate

[._.]/ Adam Eivya1de78ccd44f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 46af903711..2f425fa533 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -102,3 +102,4 @@
- **A generated Three.js model's materials are now checked against the substance they're named for.** `threejsMaterialSchema` bounds every PBR channel to what Three.js accepts, which is a much weaker claim than it looks: metalness 0.9 oak and transmission 1.0 steel both validate, both persist, and both light completely wrong — a wooden crate that reads as chrome, a window that reads as concrete — with nothing anywhere pushing back. A new material-plausibility gate keys a small per-family prior table (metal, wood, plastic, glass, fabric, ceramic, rubber, stone, leather, paper) off tokens in each material's own id and reports the channels whose values that substance doesn't support, in both directions: metal that isn't metallic and glass that doesn't transmit are as much a finding as wood that does. It is advisory by construction and never clamps, because a stylized model is entitled to break every prior in the table — and the matching is deliberately conservative to match: a material keys a prior only when its id names exactly one family, so `mat_primary` and `wood_metal_trim` produce no feedback rather than a wrong one, and a channel the material's `type` never forwards to Three.js is skipped rather than reported as a defect the user can't see. Findings land on the record, show up in a new panel on the model detail page, and an unsteered refinement now asks for values that match the substance alongside the existing coverage, depth, and penetration feedback.
- **Stitched and re-encoded video renders now carry BT.709 color tags, so they stop decoding washed-out.** Every ffmpeg re-encode in video-gen — the chained render's chunk stitch, the frame-exact trim behind its context window, and the 2× upscale export — wrote H.264 with no color metadata at all, leaving each player to guess a color space (and the common guess for HD content differs from the one for SD). The three `-color_primaries/-color_trc/-colorspace` container flags alone do not fix this on ffmpeg 8: the encoder reads its color properties off the *frames* coming down the filter graph, which inherit the decoded input's unspecified values and silently override the flags — verified locally on ffmpeg 8.1.1, where a flags-only output came back `color_primaries=unknown, color_transfer=unknown`. All three sites now emit the container flags *and* a trailing `setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709` on the video chain, which makes all three properties stick. The `setparams` filter only landed in ffmpeg 4.3 and an older build aborts the whole run on an unknown filter, so its availability is probed once per process from `-filters` and the tag is dropped (container flags only) when it isn't there — a probe that could not run is left uncached rather than remembered as "unsupported", so one transient failure can't disable tagging for the life of the server.
- **The Digital Twin's 19 sections are grouped now, instead of one 19-wide tab strip you had to read end to end.** The strip carried every section in a single flat row with no ordering a user could infer — setup, content, output and archival tasks interleaved, `Import` sitting between `Interview` and `Avatar Bio`, and `Export`, `Legacy` and `Time Capsule` as three adjacent tabs that all mean "get data out" — so every visit started by scanning 19 labels, several of which (`Enrich` vs `Taste` vs `Personality` vs `Personas`) only tell you apart if you already know the feature. They now collapse into five groups named for what you're doing to the twin: **Profile** (who it is), **Sources** (where its material comes from), **Assessment** (whether it's actually you), **Presence** (how it shows up) and **Legacy** (how you get it out). Above `sm` that's a group row over the active group's sections — at most six at a time; on a phone the whole thing becomes one `<select>` with `<optgroup>` headers, which is the measured fix for a 375x812 screen where the strip plus the health header pushed **Analyze Traits**, **Recalculate** and **Check for Contradictions** below the fold. Nothing about addressing changed: the section id is still the route param, so every deep link, ⌘K entry and voice `ui_navigate` target resolves exactly as before, and the group is derived from the section rather than stored. The nav manifest carries the grouping as a keyword tag per section plus a `twin-<group>` alias, so "twin sources" lands somewhere sensible without inventing a group path no route serves.
+- **An arc verification no longer forgets a rejected rewrite one round after it reverted it.** The gate already carried a reverted candidate's own blockers into the corrective retry that follows the rollback, as "do not author these" evidence — but only that one call. If the retry landed on a state that was no better than the checkpoint yet still blocked, the next ordinary resolve rebuilt its avoid list from scratch, so the resolver was free to re-author the exact rewrite the gate had just thrown away. That is what a paused run showed: 2 blockers resolved down to 1, a rewrite back up to 5 (reverted), the retry back to 1, then straight back to 2 with no retries left and a pause for review. Every blocker set discarded during a run is now accumulated and passed to every later resolve in that gate — ordinary, corrective, and per-finding isolated alike — bounded by the same limit the persisted marker uses, newest evidence first so it is never the part that gets trimmed. Anything that has since become an active repair target is filtered out, so the resolver is never told to both fix and avoid the same finding, and the cross-Resume evidence from a previous run still layers in underneath.
diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.js
index 73f8df0381..58d8aea9e8 100644
--- a/server/services/pipeline/seriesAutopilot.test.js
+++ b/server/services/pipeline/seriesAutopilot.test.js
@@ -2560,6 +2560,44 @@ describe('autopilot conductor', () => {
expect(series.autopilot?.pauseKind).not.toBe('regression');
});
+ it('carries a rejected candidate\'s findings past its corrective retry into the next ordinary resolve', async () => {
+ // The 2026-08-12 verifyArcSpine stall, replayed: 2 blockers → 1, a rewrite
+ // back to 5 (reverted), the corrective retry back to 1, then straight back
+ // to 2 with no retries left. The rejected set has to survive for the rest of
+ // the gate, not just for the retry that immediately follows the rollback —
+ // see `runDiscarded` in runArcVerify.
+ const standing = { severity: 'high', problem: 'the succession vow is never paid off', location: 'V1' };
+ const closed = { severity: 'high', problem: 'the choir loses its founding member offscreen', location: 'V2' };
+ const collateral = (i) => ({ severity: 'high', problem: `collateral break ${i}`, location: `V${i + 3}` });
+ const rejected = [standing, ...Array.from({ length: 4 }, (_, i) => collateral(i))];
+ arcSpies.verifyArc.mockReset();
+ [
+ [standing, closed], // round 1 — resolve #1
+ [standing], // round 2 — real progress; resolve #2
+ rejected, // round 3 — regressed to 5, reverted, corrective retry (#3)
+ [standing], // round 4 — retry landed back on the checkpoint; resolve #4
+ [], // round 5 — clean
+ ].forEach((issues) => arcSpies.verifyArc.mockImplementationOnce(async () => ({ issues })));
+
+ const { seriesId } = await seedComplete();
+ await autopilot.startSeriesAutopilot(seriesId, { maxArcVerifyRounds: 6 });
+ await waitFor(runFinished(seriesId));
+
+ // The corrective retry keeps its own rollback's evidence whole, as before.
+ expect(arcSpies.resolveVerifyIssues.mock.calls[2][1]).toMatchObject({
+ findings: [standing],
+ avoid: rejected,
+ });
+ // …and so does the ORDINARY resolve that follows it, minus the one entry the
+ // restored state still has as an active target — the resolver must never be
+ // told to both fix and avoid the same finding.
+ const ordinary = arcSpies.resolveVerifyIssues.mock.calls[3][1];
+ expect(ordinary).toMatchObject({ findings: [standing] });
+ expect(ordinary.avoid).toEqual(rejected.filter((f) => f !== standing));
+ const series = await seriesSvc.getSeries(seriesId);
+ expect(series.autopilot?.pauseKind).not.toBe('regression');
+ });
+
it('honors maxArcResolveRetries: 0 by pausing on the first regression', async () => {
// The pre-#3781 behavior stays reachable per run: no corrective pass, so the
// first reverted candidate ends the gate without spending a second resolve.
diff --git a/server/services/pipeline/seriesAutopilot/childRuns.js b/server/services/pipeline/seriesAutopilot/childRuns.js
index caf04d53a1..a9d4370ca7 100644
--- a/server/services/pipeline/seriesAutopilot/childRuns.js
+++ b/server/services/pipeline/seriesAutopilot/childRuns.js
@@ -27,7 +27,7 @@ import {
import {
CHILD_POLL_MS, DIVERGENCE_PATIENCE, trackConvergence, convergencePauseReason,
divergencePauseReason, foundationPauseReason, foundationDivergenceReason,
- foundationRepairMissed, regressionPauseReason, sameFinding, isBlockingSetRegression,
+ foundationRepairMissed, regressionPauseReason, sameFinding, containsFinding, isBlockingSetRegression,
isIsolatedFixSafe,
} from './convergence.js';
import { broadcast, budgetPause, providerOverrideOpts, providerIdOpts, roleLlm, seasonPreserveOpts } from './session.js';
@@ -212,7 +212,7 @@ async function isolateArcFindings(seriesId, record, { scope, round, spineOnly, b
if (attempts >= attemptsLeft) break;
// An earlier accepted patch may have taken this one with it — paying a
// resolve + a verify to re-close a finding that is already gone is pure spend.
- if (!blocking().some((finding) => sameFinding(target, finding))) continue;
+ if (!containsFinding(blocking(), target)) continue;
if (record.cancelRequested) return { accepted, attempts, verified: standing, outcome: { canceled: true } };
const beforeResolve = await budgetPause();
if (beforeResolve) return { accepted, attempts, verified: standing, outcome: beforeResolve };
@@ -270,21 +270,38 @@ export async function runArcVerify(seriesId, record, { spineOnly = false } = {})
const priorAvoid = Array.isArray(record.options.priorArcAvoidFindings)
? record.options.priorArcAvoidFindings
: [];
- // Preserve rejected-candidate evidence across Resume, then layer any newer
- // regression from this run on top. `discardedSet` keeps the provider prompt
- // bounded exactly like the persisted marker.
- const avoidFindings = (current = [], active = []) => discardedSet(
- [
+ // Every blocker set THIS gate has already discarded, newest first. A
+ // rollback's evidence used to reach only the corrective retry that immediately
+ // followed it: the next ordinary resolve rebuilt its avoid list from scratch,
+ // so once a retry landed on a non-worse but still-blocked state the resolver
+ // was free to re-author the exact rewrite the gate had just reverted — the
+ // observed 2 → 1 → 5 (revert) → 1 → 2 (revert, out of retries) stall.
+ const runDiscarded = [];
+ // Builds the avoid list for ONE resolve call and banks that call's own newest
+ // evidence into the history above, so this is where a rejected candidate stops
+ // being the retry's private knowledge. Preserves cross-Resume evidence and this
+ // run's earlier rollbacks underneath. `discardedSet` keeps the provider prompt
+ // bounded exactly like the persisted marker — `current` leads so the newest
+ // evidence is never the part that gets cut at that bound.
+ const avoidFindings = (current = [], active = []) => {
+ const avoid = discardedSet([
+ // The caller's own discarded set stays whole because its restatements
+ // describe the exact candidate that was just rejected and are intentional
+ // retry evidence.
+ ...current,
// A latent defect from a rejected candidate can later be found in the
// restored checkpoint itself. Once it is a CURRENT target, telling the
- // resumed resolver both "fix this" and "avoid this" is contradictory;
- // filter only the stale cross-run evidence. The current transaction's
- // discarded set stays whole because its restatements describe the exact
- // candidate that was just rejected and are intentional retry evidence.
- ...priorAvoid.filter((candidate) => !active.some((target) => sameFinding(candidate, target))),
- ...current,
- ],
- );
+ // resolver both "fix this" and "avoid this" is contradictory, so the
+ // carried-over evidence is filtered against what this call is fixing —
+ // and against `current`, which routinely restates an earlier rollback's
+ // findings the history above already holds.
+ ...[...runDiscarded, ...priorAvoid].filter((candidate) => (
+ !containsFinding(active, candidate) && !containsFinding(current, candidate)
+ )),
+ ]);
+ runDiscarded.unshift(...current.filter((finding) => !containsFinding(runDiscarded, finding)));
+ return avoid;
+ };
let convergence = { best: null, sinceBest: 0 };
let changed = false;
// Lowest verified blocker set seen in this gate, paired with the exact arc /
diff --git a/server/services/pipeline/seriesAutopilot/convergence.js b/server/services/pipeline/seriesAutopilot/convergence.js
index bb54b9cc53..1b823496fc 100644
--- a/server/services/pipeline/seriesAutopilot/convergence.js
+++ b/server/services/pipeline/seriesAutopilot/convergence.js
@@ -182,6 +182,14 @@ export function sameFinding(a, b) {
&& score >= (corroborated ? FINDING_MATCH_MIN_OVERLAP_SAME_LOCATION : FINDING_MATCH_MIN_OVERLAP);
}
+// "Is this problem somewhere in that list?" — the membership question every
+// caller of `sameFinding` above is actually asking, spelled once. Argument order
+// is fixed here (list, then finding) because the sites that open-coded it each
+// picked their own, which is harmless only while the matcher stays symmetric.
+export const containsFinding = (list, finding) => (
+ Array.isArray(list) && list.some((candidate) => sameFinding(candidate, finding))
+);
+
/**
* True when the round that produced `after` REGRESSED: it left more blocking
* findings than the `before` set it was asked to close, AND at least one of
@@ -202,7 +210,7 @@ export function isResolveRegression(before, after) {
const targeted = Array.isArray(before) ? before : [];
const current = Array.isArray(after) ? after : [];
if (current.length <= targeted.length) return false;
- return targeted.some((t) => current.some((c) => sameFinding(t, c)));
+ return targeted.some((t) => containsFinding(current, t));
}
// The arc rollback guard's operational ordering. Total blockers remain the
@@ -249,7 +257,7 @@ export function isBlockingSetRegression(before, after) {
*/
export function isIsolatedFixSafe(target, before, after) {
const current = Array.isArray(after) ? after : [];
- if (current.some((c) => sameFinding(target, c))) return false;
+ if (containsFinding(current, target)) return false;
return !isBlockingSetRegression(before, current);
}