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

Merge pull request #13395 from atomantic/fix/reconcile-recovery-dispatch-status

[._.]/01187b45aec9
diff --cc client/src/components/cos/tabs/schedule/BranchReconcileOutcome.jsx
index 9a2b071e53,1ee994f090..befd634689
--- a/client/src/components/cos/tabs/schedule/BranchReconcileOutcome.jsx
+++ b/client/src/components/cos/tabs/schedule/BranchReconcileOutcome.jsx
@@@ -111,9 -108,19 +111,20 @@@ export default function BranchReconcile
</summary>
<div className="mt-2 space-y-2 text-gray-400">
<p>{outcome.observedAt ? `Last inventory: ${formatDateTime(outcome.observedAt)}` : 'No readable inventory yet.'}</p>
+ {incompleteEmptyInventory && <p>Last sweep: Incomplete</p>}
{outcome.reason && <p className="break-words">Reason: {outcome.reason}</p>}
{outcome.nextAction && <p>{outcome.nextAction}</p>}
+ {outcome.remoteInventory?.reported?.length > 0 && (
+ <details>
+ <summary className="cursor-pointer">Remote-only inventory · {formatCount(outcome.remoteInventory.reported.length)} informational</summary>
+ <p>Local cleanup status covers this machine’s branches and checkouts. Remote-only refs may belong to another instance.</p>
+ <ul className="max-h-48 overflow-y-auto">
+ {outcome.remoteInventory.reported.map((entry, index) => <li key={index} className="break-all">
+ {typeof entry === 'string' ? entry : `${entry.branch}: ${entry.reason}`}
+ </li>)}
+ </ul>
+ </details>
+ )}
{!remaining && <p>Remaining work is unknown.</p>}
<ul className="space-y-2 max-h-64 overflow-y-auto">
{(remaining || []).map((entry, index) => (
diff --cc server/services/taskSchedule.js
index 04c34f57b8,c7043d1bab..a9aed0ea14
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@@ -775,39 -774,21 +775,40 @@@ export async function recordBranchRecon
const record = ensureExecutionRecord(schedule, 'branch-reconcile', appId);
const now = new Date().toISOString();
const previous = record.branchReconcileOutcome;
+ const existing = unresolvedRetirements(previous);
+ const admitted = [];
+ const rejected = [];
+ for (const row of [...(remaining || []), ...additionalObligations]) {
+ if (!isObligationRow(row)) continue;
+ if (existing.some(entry => sameRetirementObservation(entry, row))) continue;
+ const previousIncarnation = existing.some(entry => sameRetirementCheckout(entry, row));
+ const receipts = matchingRetirementReceipts(previous, row);
+ // Legacy rows without observation identity cannot claim to be recreations.
+ if (hasRetirementReceipt(previous, row)
+ || ((receipts.length || previousIncarnation) && !Number.isFinite(Date.parse(row.createdAt))
+ && (!row.checkoutIdentity || !await isCurrentRetirementCheckout(row).catch(() => false)))) {
+ rejected.push(row);
+ } else admitted.push(row);
+ }
// A fresh empty scan must not erase the last observation of vanished source.
const omitted = remaining === undefined ? [] : (previous?.remaining || [])
- .filter(row => !remaining.some(current => sameRetirementCheckout(current, row)));
+ .filter(row => !remaining.some(current => sameRetirementCheckout(current, row))
+ && !rejected.some(entry => sameRetirementObservation(entry, row)));
const missing = await missingInventoryRows(appId, omitted);
const retirementObligations = retainRetirementObligations(previous,
- [...(remaining || []), ...additionalObligations, ...missing.map(missingPreservationObligation)], now);
- const inventory = remaining === undefined ? previous?.remaining ?? null : remaining;
+ [...admitted, ...missing.map(missingPreservationObligation)], now);
+ const inventory = (remaining === undefined ? previous?.remaining ?? null : remaining)
+ ?.filter(row => !rejected.some(entry => sameRetirementObservation(entry, row))) ?? null;
const current = inventory?.map(row => {
- const obligation = retirementObligations.find(entry => sameRetirementCheckout(entry, row));
- return obligation ? { ...row, createdAt: obligation.createdAt } : row;
+ const obligation = retirementObligations.find(entry => sameRetirementObservation(entry, row));
+ return obligation ? { ...row, createdAt: obligation.createdAt,
+ ...(obligation.checkoutIdentity && { checkoutIdentity: obligation.checkoutIdentity }),
+ ...(obligation.observedAt && { observedAt: obligation.observedAt }) } : row;
}) ?? null;
- const retained = retirementObligations.filter(obligation => !current?.some(row => sameRetirementCheckout(row, obligation)));
+ const retained = retirementObligations.filter(obligation => !current?.some(row => sameRetirementObservation(row, obligation)));
record.branchReconcileOutcome = {
...previous, status, reason, nextAction, updatedAt: now, retirementObligations,
+ ...(remoteInventory !== undefined && { remoteInventory }),
remaining: retained.length ? [...(current || []), ...retained] : current,
observedAt: remaining === undefined ? record.branchReconcileOutcome?.observedAt ?? null : now,
...(retirementObligations.some(row => row.reason === 'retirement-provenance-unverified') && missingPreservationStatus),