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

feat([issue-709]): live-refresh the Review Hub queue on cross-domain changes

[._.]/ Adam Eivyfd1477e9da54
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 467e9f0180..56c3500610 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -3,6 +3,7 @@
## Added
- **[issue-709] Review Hub "Needs Attention" queue** — the Review Hub now opens with a cross-domain queue that pulls everything currently waiting on you into one list: Brain inbox items that need classifying, Ask answers ready to promote, CoS tasks awaiting approval, unsent message drafts, critical/high health anomalies, and failed backups. The most urgent items sort to the top, each row opens straight to where you handle it, and you can dismiss anything you don't want to act on right now. A slow or unavailable source is noted instead of blocking the rest.
+- **[issue-709] Review Hub queue refreshes itself** — the "Needs Attention" queue now updates the moment you handle something anywhere: resolve a CoS task, send or approve a message draft, or classify an inbox item on its own page and the matching row disappears (or a new one appears) without waiting for a reload. A failed or finished backup updates its row the same way. Anything you've dismissed this session stays dismissed.
- **[issue-709] Act on Review Hub items in place** — rows in the "Needs Attention" queue now carry an inline action so you can clear them without leaving the page: mark a Brain inbox item done, or approve a waiting CoS task or message draft. The row drops away the moment it's handled. Items that need a choice or have no one-click resolution (promoting an Ask answer to a note/task/goal, health anomalies that clear when the condition does, a failed backup retried from Backup settings) keep their open-and-dismiss controls.
- **[issue-708] Digital Twin personas** — give your twin named contexts — Professional, Casual, Family, or your own — each with instructions for how it should modulate voice and behavior. Activate one from the new Personas tab and your CoS agents adopt that context when they act on your behalf, while building your base identity stays unaffected. Create, edit, switch, and clear personas at any time.
- **[issue-708] Digital Twin values-alignment tests** — the Digital Twin's Test tab gains a second test mode: instead of only checking whether your twin *sounds* like you, it poses ethical dilemmas and grades whether the twin's choice is consistent with your ranked values. Each dilemma names the values at stake and ships an "aligned" and "misaligned" reference, and runs score against the values hierarchy from your Identity tab — so you can see, per model, where your twin holds your values and where it drifts. Ships a starter dilemma suite you can customize.
diff --git a/client/src/pages/Review.jsx b/client/src/pages/Review.jsx
index ca6250df8e..19633132c7 100644
--- a/client/src/pages/Review.jsx
+++ b/client/src/pages/Review.jsx
@@ -28,9 +28,28 @@ import {
import BrailleSpinner from '../components/BrailleSpinner';
import MarkdownOutput from '../components/cos/MarkdownOutput';
import { timeAgo } from '../utils/formatters';
+import { coalesce } from '../utils/coalesce';
import * as api from '../services/api';
import socket from '../services/socket';
+// Producer-domain socket events that change what the cross-domain "Needs
+// Attention" queue (GET /api/review/queue) would return. The queue is derived
+// live from each producer, so when any of these fire — a draft sent, an inbox
+// item classified, a CoS task resolved, a backup finishing — we re-pull the
+// queue (debounced) instead of waiting for a manual reload. Ask is omitted
+// (no socket emit) and proactive alerts are live-computed (no event).
+const QUEUE_INVALIDATION_EVENTS = [
+ 'brain:classified', // inbox item classified / re-reviewed
+ 'cos:tasks:user:changed', // CoS user-task list changed
+ 'cos:tasks:cos:changed', // CoS internal-task list changed
+ 'messages:changed', // draft approved/deleted/status changed
+ 'messages:draft:created', // new draft awaiting review
+ 'messages:draft:sent', // draft sent (resolves a drafts row)
+ 'backup:started', // backup state transitioning
+ 'backup:completed', // backup succeeded (clears a failed-backup row)
+ 'backup:failed' // backup errored (surfaces a failed-backup row)
+];
+
// Cross-domain queue source → icon + accent (M42 P5 inbox-zero aggregator).
const QUEUE_SOURCE_CONFIG = {
brain: { icon: BrainIcon, color: 'text-purple-400' },
@@ -133,6 +152,20 @@ export default function Review() {
};
}, []);
+ // Live-invalidate the cross-domain queue. A burst of producer events (e.g.
+ // a draft sent fires both messages:draft:sent and messages:changed) coalesces
+ // into a single refetch on the trailing edge. dismissedQueueIds still filters
+ // the result, so a row the user dismissed this session won't pop back; a
+ // re-resolved item simply isn't returned by the server anymore.
+ useEffect(() => {
+ const refetch = coalesce(() => fetchQueue(), 400);
+ for (const evt of QUEUE_INVALIDATION_EVENTS) socket.on(evt, refetch);
+ return () => {
+ for (const evt of QUEUE_INVALIDATION_EVENTS) socket.off(evt, refetch);
+ refetch.cancel();
+ };
+ }, [fetchQueue]);
+
const handleCreateTodo = async (e) => {
e.preventDefault();
if (!newTodo.trim()) return;
diff --git a/server/services/backup.js b/server/services/backup.js
index 53f43bd7dc..f89dd57a30 100644
--- a/server/services/backup.js
+++ b/server/services/backup.js
@@ -170,6 +170,7 @@ export async function runBackup(destPath, io = null, { excludePaths = [], disabl
const fail = async (err) => {
isRunning = false;
await saveState({ lastRun: new Date().toISOString(), status: 'error', error: err.message });
+ if (io) io.emit('backup:failed', { snapshotId, error: err.message });
throw err;
};