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: address action queue review findings

[._.]/ Adam Eivy1230abd9cb4d
diff --git a/server/services/cosTaskStore.js b/server/services/cosTaskStore.js
index 2ca6965984..08b28f96b7 100644
--- a/server/services/cosTaskStore.js
+++ b/server/services/cosTaskStore.js
@@ -1112,7 +1112,7 @@ export async function approveTask(taskId, { now = Date.now() } = {}) {
cosEvents.emit('tasks:changed', { type: taskType, action: 'approved', task: tasks[taskIndex] });
const { removeByMetadata } = await import('./notifications.js');
- await removeByMetadata('taskId', taskId);
+ await removeByMetadata('taskId', taskId).catch(() => {});
return tasks[taskIndex];
});
diff --git a/server/services/notifications.test.js b/server/services/notifications.test.js
index 2b2f15b347..082fa00a00 100644
--- a/server/services/notifications.test.js
+++ b/server/services/notifications.test.js
@@ -94,7 +94,7 @@ describe('notifications', () => {
await clearAll()
expect(await getNotifications()).toEqual([])
const retained = await getNotifications({ includeHidden: true })
- expect(retained.map(adaptNotification).filter(Boolean).map(item => item.id)).toEqual(['memory:mem-1', 'content:42'])
+ expect(retained.map(adaptNotification).filter(Boolean).map(item => item.id)).toEqual([])
expect(await exists(NOTIFICATION_TYPES.MEMORY_APPROVAL, { memoryId: 'mem-1' })).toBe(true)
await removeByMetadata('memoryId', 'mem-1')
expect((await getNotifications({ includeHidden: true })).map(n => n.id)).toEqual(['n2'])
diff --git a/server/services/reviewActionAdapters.js b/server/services/reviewActionAdapters.js
index c74b379edc..ce2f37e4b8 100644
--- a/server/services/reviewActionAdapters.js
+++ b/server/services/reviewActionAdapters.js
@@ -194,6 +194,7 @@ const notificationReference = (notification, policy) => {
export function adaptNotification(notification) {
// Read and clear apply to event history, never to the source obligation.
if (!notification) return null;
+ if (notification.historyHidden === true) return null;
const policy = NOTIFICATION_ACTION_POLICY[notification.type];
if (!policy) return null;
diff --git a/server/services/reviewQueue.js b/server/services/reviewQueue.js
index aee97e4769..727480a71c 100644
--- a/server/services/reviewQueue.js
+++ b/server/services/reviewQueue.js
@@ -1305,13 +1305,22 @@ async function readQueueTriageForProjection({
const currentKeys = pruneOrphans
? new Set(currentItems.map((item) => reviewQueueTriageStore.triageIdentityKey(queueActionIdentity(item))))
: null;
+ const currentDeliveryIds = pruneOrphans
+ ? new Set(currentItems.map((item) => String(item.id)))
+ : null;
const removableKeys = new Set();
for (const entry of entries) {
const key = reviewQueueTriageStore.triageIdentityKey(entry);
const expired = entry.snoozedUntil && Date.parse(entry.snoozedUntil) <= nowMs;
const unused = expired && entry.dismissed !== true && entry.deliveryGeneration === 0;
const actionKind = typeof entry.actionKey === 'string' ? entry.actionKey.split(':')[0] : null;
- const orphaned = currentKeys && !entry.delivery && !currentKeys.has(key) && !preservedKinds.has(actionKind);
+ const deliveryId = entry.delivery && typeof entry.actionKey === 'string'
+ ? entry.actionKey.startsWith('delivery:') ? entry.actionKey.slice('delivery:'.length) : null
+ : null;
+ const orphaned = currentKeys && (
+ (entry.delivery && deliveryId && !currentDeliveryIds.has(deliveryId))
+ || (!entry.delivery && !currentKeys.has(key) && !preservedKinds.has(actionKind))
+ );
if (unused || orphaned) removableKeys.add(key);
}
for (const entry of entries) {