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: promote a re-discarded finding trimmed past the bound, and filter foundation avoid evidence against the whole restored state (#3835)
[._.]/ Adam Eivy7b49b58cf5d6
diff --git a/server/services/pipeline/seriesAutopilot/childRuns.js b/server/services/pipeline/seriesAutopilot/childRuns.jsindex 2f4de7af73..3b2734e5c2 100644--- a/server/services/pipeline/seriesAutopilot/childRuns.js+++ b/server/services/pipeline/seriesAutopilot/childRuns.js@@ -1024,14 +1024,16 @@ async function runFoundationRounds(seriesId, record, { bank }) {// EVERY candidate this dimension has discarded, not just the last one — a// dimension that rejected two different repairs used to hand the third// evidence of only the second, leaving the repairer free to re-author the- // first. Filtered against the gap this call is being asked to close, which- // a rejected attempt's residual set routinely restates: telling the editor- // both "fix this" and "do not author this" is contradictory.- const avoidFindings = bank.avoid(- [],- residualFindings({ [weak.dimension]: snap.dimensions?.[weak.dimension] }),- weak.dimension,- );+ // first.+ //+ // A rejected attempt banks the whole judged consequence it produced, not+ // just its own dimension's gap — damage it did elsewhere is frequently WHY+ // it was rejected. So the filter is the whole restored state's residual, not+ // just the target's: every gap standing in the checkpoint is something the+ // gate still intends to close, and telling an editor both "this is the+ // state's problem" and "never author this" is contradictory. What survives+ // is what the rejected candidates INTRODUCED.+ const avoidFindings = bank.avoid([], residualFindings(snap.dimensions), weak.dimension);try {fix = await applyFoundationFix(seriesId, weak.dimension, {finding: repairFinding,diff --git a/server/services/pipeline/seriesAutopilot/discardedEvidence.js b/server/services/pipeline/seriesAutopilot/discardedEvidence.jsindex d9297e6cff..6fd1d122df 100644--- a/server/services/pipeline/seriesAutopilot/discardedEvidence.js+++ b/server/services/pipeline/seriesAutopilot/discardedEvidence.js@@ -55,15 +55,22 @@ export function createDiscardedBank(prior) {/*** Record a discarded set as this key's newest evidence. Called at the moment a* candidate is thrown away — a rollback, a rewind, an isolated patch's revert- * — so no exit has to remember to do it on that path's behalf. Findings the- * bank already holds are not re-banked: the verifier restates the same problem- * freely, and a bank of paraphrases would push the real history past the bound.+ * — so no exit has to remember to do it on that path's behalf.+ *+ * A finding the VISIBLE history already holds is not re-banked and does not+ * move: the verifier restates the same problem freely, and a bank of+ * paraphrases would push the real history past the bound. But identity is+ * checked against the bounded view, not the raw list — a candidate whose only+ * copy has already been trimmed out of the prompt is, on being discarded+ * again, the newest evidence there is, so it returns to the front and its+ * stale below-the-bound copy goes with it.*/const record = (findings, key = FLAT) => {const current = Array.isArray(findings) ? findings : [];const held = banked.get(key) || [];- held.unshift(...current.filter((finding) => !containsFinding(held, finding)));- banked.set(key, held);+ const visible = boundDiscarded(held);+ const fresh = current.filter((finding) => !containsFinding(visible, finding));+ banked.set(key, [...fresh, ...held.filter((finding) => !containsFinding(fresh, finding))]);};/**diff --git a/server/services/pipeline/seriesAutopilot/discardedEvidence.test.js b/server/services/pipeline/seriesAutopilot/discardedEvidence.test.jsindex 08b8f453c2..ece6dfe527 100644--- a/server/services/pipeline/seriesAutopilot/discardedEvidence.test.js+++ b/server/services/pipeline/seriesAutopilot/discardedEvidence.test.js@@ -23,6 +23,19 @@ describe('createDiscardedBank (#3835)', () => {expect(bank.history()).toHaveLength(1);});+ it('promotes a re-discarded candidate to the front instead of leaving it below the bound', () => {+ const bank = createDiscardedBank();+ bank.record([FIRST]);+ for (let i = 0; i < AUTOPILOT_DISCARDED_MAX; i += 1) {+ bank.record([finding(`alpha${i} beta${i} gamma${i} delta${i}`, `volume ${i}`)]);+ }+ // FIRST has been pushed past the cap. Discarding it AGAIN is the newest+ // evidence there is — it must reach the very next prompt, not stay trimmed.+ bank.record([FIRST]);+ expect(bank.history()[0].problem).toBe(FIRST.problem);+ expect(bank.history().filter((f) => f.problem === FIRST.problem)).toHaveLength(1);+ });+it('keeps each key\'s history separate', () => {const bank = createDiscardedBank();bank.record([FIRST], 'character');