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: keep modern checkout seed refusals authoritative

Adam Eivy333905993aef
diff --git a/server/services/branchCompletionPolicy.js b/server/services/branchCompletionPolicy.js
index e6c1fca72e..885ecd0e34 100644
--- a/server/services/branchCompletionPolicy.js
+++ b/server/services/branchCompletionPolicy.js
@@ -175,7 +175,11 @@ function reviewedIncarnation(input, policies) {
function completedCleanupForRetirement(policy, input) {
const agent = policy.agent;
const result = agent.result;
- const integratedLegacyCleanup = result?.executionSuccess === true
+ const metadata = agent.metadata || {};
+ const legacyCapture = metadata.completionCleanup === undefined && metadata.checkoutSeeds === undefined
+ && metadata.checkoutCapture === undefined && (metadata.completedCheckouts === undefined
+ || (Array.isArray(metadata.completedCheckouts) && metadata.completedCheckouts.every(row => row?.version === 1)));
+ const integratedLegacyCleanup = legacyCapture && result?.executionSuccess === true
&& input.verifiedPrHead === input.tip && /^[a-f0-9]{40}(?:[a-f0-9]{24})?$/.test(input.integratedCleanupHead || '');
return (result?.cleanupPending === true || integratedLegacyCleanup)
&& (result.executionSuccess === true || result.cleanupDeliveryVerified === true) && result.validationPassed !== false
diff --git a/server/services/branchCompletionPolicy.test.js b/server/services/branchCompletionPolicy.test.js
index 072383fcec..87f560eab4 100644
--- a/server/services/branchCompletionPolicy.test.js
+++ b/server/services/branchCompletionPolicy.test.js
@@ -321,6 +321,10 @@ describe('reviewed reused-branch checkout incarnation', () => {
taskOutcome: { status: 'incomplete', recovery: { mode: 'cleanup' } } };
const integrated = { ...input(), agents: [current], integratedCleanupHead: 'c'.repeat(40) };
expect(reviewedRetirementPolicy(integrated).reason).toBeNull();
+ // Modern replay/seed failures cannot be reclassified as legacy evidence.
+ current.metadata.checkoutSeeds = [];
+ expect(reviewedRetirementPolicy(integrated).reason).toBeTruthy();
+ delete current.metadata.checkoutSeeds;
for (const patch of [{ integratedCleanupHead: null }, { verifiedPrHead: 'b'.repeat(40) }]) {
expect(reviewedRetirementPolicy({ ...integrated, ...patch }).reason).toBeTruthy();
}