fix(desktop): make inbound 30177 frozen-linkage convergence observable and retryable

The §2.8 canonical-linkage freeze path retained the inbound event as the
head before attempting the corrective library-authoritative re-retain, then
swallowed a failed re-retain to stderr and returned Ok. That left the
non-authoritative head retained with no recovery: replay is dead because the
same event re-arriving is Skipped at the equal-created_at guard before the
convergence branch runs.

Propagate the corrective re-retain failure (converge_frozen_linkage) so the
command cannot report success over a divergent head. The durable retry owner
is the boot-time reconcile_agents_to_events pass, which re-diffs the
still-authoritative on-disk record against the retained head every launch and
re-queues the corrective row at a monotonic bump. Surface the freeze reason
as a typed InboundReconcileOutcome (reconcile_inbound_persona_event now
returns it) instead of stderr-only, and consume it in usePersonaSync.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
Duncan
2026-08-13 16:34:25 -04:00
co-authored by Will Pfleger
parent 49c027541f
commit 1d74aa558c
6 changed files with 281 additions and 32 deletions
@@ -37,11 +37,24 @@ export function startPersonaSync(
): () => Promise<void> {
const reconcile = (event: RelayEvent) => {
if (event.pubkey !== pubkey) return;
void reconcileInboundPersonaEvent(JSON.stringify(event), relayUrl).catch(
(error) => {
void reconcileInboundPersonaEvent(JSON.stringify(event), relayUrl)
.then((outcome) => {
// §2.8 interim posture: a frozen-linkage reconcile re-retained the
// local head to converge the relay back. Surface the typed degradation
// rather than letting it vanish — no UI is wired in this phase, so a
// console warning is the minimal observable surface. A rejected invoke
// (below) means the corrective re-retain FAILED and the non-authoritative
// head is still retained; the boot-time reconcile is the durable retry.
if (outcome.degradation) {
console.warn(
"[usePersonaSync] inbound linkage frozen (§2.8):",
outcome.degradation.message,
);
}
})
.catch((error) => {
console.warn("[usePersonaSync] reconcile failed:", error);
},
);
});
};
// One-shot backfill of existing heads + tombstones (closes the fresh-start