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

Preserve remote-only reconciliation holds in status inventory (#13344)

[._.]/4f65c3716ce3
diff --git a/server/services/branchReconcileInventoryPrune.js b/server/services/branchReconcileInventoryPrune.js
index efdbdad2d6..aed244c5a3 100644
--- a/server/services/branchReconcileInventoryPrune.js
+++ b/server/services/branchReconcileInventoryPrune.js
@@ -32,6 +32,9 @@ export async function findGoneInventoryRows(repoPath, rows, { includeObligations
const registered = await registeredPaths(repoPath);
const gone = [];
for (const row of rows) {
+ // A remote-only hold has no local ref by definition. Only a new forge scan
+ // can establish that its remote preservation obligation is gone.
+ if (row?.reason === 'remote-branch-held') continue;
if (!includeObligations && isObligationRow(row)) continue;
if (typeof row?.path === 'string' && row.path) {
if (!registered.has(row.path) && !await pathExists(row.path)) gone.push(row);
diff --git a/server/services/branchReconcileInventoryPrune.test.js b/server/services/branchReconcileInventoryPrune.test.js
index 1e73225594..241974502f 100644
--- a/server/services/branchReconcileInventoryPrune.test.js
+++ b/server/services/branchReconcileInventoryPrune.test.js
@@ -6,6 +6,15 @@ import { execGit } from '../lib/execGit.js';
import { pathExists } from '../lib/fileCore.js';
describe('historical checkout inventory', () => {
+ it('keeps remote-only holds when their local branch is absent, while pruning missing local branches', async () => {
+ const remote = { branch: 'fix/remote-only', reason: 'remote-branch-held' };
+ const local = { branch: 'fix/gone', reason: 'actionable' };
+ execGit.mockImplementation(async (args) => args[0] === 'worktree'
+ ? { stdout: 'worktree /repo\nbranch refs/heads/main\n\n', exitCode: 0 }
+ : { stdout: '', exitCode: 1 });
+ expect(await findGoneInventoryRows('/repo', [remote, local], { includeObligations: true })).toEqual([local]);
+ });
+
it('reports missing obligation originals only for display, preserving the default pruning contract', async () => {
const primary = { path: '/repo', branch: 'main' };
const obligation = { path: '/old', branch: 'fix/example', reason: 'retirement-receipt-unverified' };