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

address review (codex): keep the inbox row when a bundled outline merge fails

[._.]/ Adam Eivya9be617b7026
diff --git a/server/services/sharing/importer.js b/server/services/sharing/importer.js
index 9ca68363ec..b7fde87168 100644
--- a/server/services/sharing/importer.js
+++ b/server/services/sharing/importer.js
@@ -1255,6 +1255,14 @@ export async function promoteInboxItem(bucketId, manifestId) {
reviewMergeFailures: outcome.reviewMergeFailures,
});
}
+ // Same for a transient reverse-outline merge failure (#1348) — the outline has
+ // no independent reconciliation cycle either, so keep the inbox row for retry.
+ if (outcome.outlineMergeFailures) {
+ throw Object.assign(new Error(`Reverse-outline merge failed for ${outcome.outlineMergeFailures.join(', ')} — retry after resolving the underlying error`), {
+ code: 'SHARING_OUTLINE_MERGE_FAILED',
+ outlineMergeFailures: outcome.outlineMergeFailures,
+ });
+ }
// Drop from inbox.
inbox.items.splice(idx, 1);
await writeInbox(bucketId, inbox);
diff --git a/server/services/sharing/integration.test.js b/server/services/sharing/integration.test.js
index 553a4ab9f8..f5bdbf934b 100644
--- a/server/services/sharing/integration.test.js
+++ b/server/services/sharing/integration.test.js
@@ -427,6 +427,30 @@ describe('sharing round-trip', () => {
expect((await manuscriptReview.getReview(s.id)).comments).toHaveLength(1);
});
+ it('promoteInboxItem keeps the inbox row when the bundled outline merge fails', async () => {
+ const bucket = await buckets.createBucket({ name: 'PromoteOutlineFailBucket', path: tempBucket, mode: 'inbox' });
+ const s = await series.createSeries({ name: 'Promote Outline Fail Series', logline: 'A' });
+ await issues.createIssue({ seriesId: s.id, title: 'Issue 1' });
+ seedOutline(s.id);
+ const exp = await exporter.exportSeries(s.id, bucket.id);
+ simulateRemoteSender(tempBucket, exp.filename);
+ await importer.processManifest(bucket.id, exp.filename); // queues to inbox
+ expect(await importer.listInbox(bucket.id)).toHaveLength(1);
+
+ // Force a transient outline-merge failure during the manual promote.
+ const spy = vi.spyOn(reverseOutline, 'mergeOutlineFromSync').mockRejectedValueOnce(new Error('disk full'));
+ await expect(importer.promoteInboxItem(bucket.id, exp.manifestId)).rejects.toMatchObject({
+ code: 'SHARING_OUTLINE_MERGE_FAILED',
+ });
+ spy.mockRestore();
+ // Inbox row preserved so the user can re-promote.
+ expect(await importer.listInbox(bucket.id)).toHaveLength(1);
+
+ // Re-promote now succeeds and the outline lands.
+ await importer.promoteInboxItem(bucket.id, exp.manifestId);
+ expect((await reverseOutline.getStoredOutline(s.id)).status).toBe('complete');
+ });
+
it('keeps a manifest retryable when the bundled review merge fails (no silent drop)', async () => {
const bucket = await buckets.createBucket({ name: 'ReviewFailBucket', path: tempBucket, mode: 'auto-merge' });
const s = await series.createSeries({ name: 'Review Fail Series', logline: 'A' });