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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
dismiss review-hub alert when its CoS task is deleted
[._.]/ Adam Eivy1dd03b2e630a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex a8a8c0eab8..50750f3388 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -43,6 +43,7 @@## CoS / task learning+- **Fix: deleting a blocked/pending task now clears the review-hub alert it raised, instead of leaving an orphan whose "Review" button does nothing.** When a task surfaced a review item (via `task:ready`) and you then deleted the task, the alert lingered in the Review Hub forever — the task it pointed at was gone, so its approve/review action resolved nothing. Task deletion now dismisses any pending review items referencing the deleted task, mirroring the existing `memory:approved`/`memory:rejected` cleanup. (`server/services/review.js`)- **Fix: the delete confirmation for a CoS task now appears next to the trash icon instead of at the bottom of the card.** Deleting a pending/blocked task armed an inline confirm row that rendered *below* the task's full content — so for a task with a long description or context, the trash icon sat at the top while the "Delete this task?" confirm landed far down the card, off-screen and hard to find. The confirmation now swaps in compactly right where the trash icon lives (`<ConfirmButtonPair>`, mirroring `AgentCard`'s pattern), so confirm/cancel are always next to the action you just clicked. (`client/src/components/cos/tabs/TaskItem.jsx`)- **Learning-based model routing now prefers the lightest tier that succeeds, instead of the marginally-highest-success tier.** `suggestModelTier` sorted candidate tiers by success rate and returned the top one, so a `heavy` tier at 85% would beat a `light` tier at 82% — silently over-allocating compute for the same outcome, despite an inline comment that said "if a lighter tier has high success, no need to upgrade." It now picks the **lightest** tier among all that clear the high-success threshold (≥80%), realizing that intent and saving the heavier model for task types that actually need it. The cost-ranking covers the full tier namespace that actually lands in `routingAccuracy` — not just `light`/`default`/`medium`/`heavy` but the thinking-level names (`minimal`/`low`/`high`/`xhigh`) recorded by `selectModelForTask`, with `minimal`/`low` (local models) cheapest and `xhigh` (opus) heaviest; an unknown/future tier name (e.g. `user-specified`) ranks as heaviest so it can never masquerade as the cheapest option. Failing-tier avoidance and the insufficient-data short-circuit are unchanged. The model selector now resolves a learned thinking-level suggestion (`high`/`xhigh`/`off`) through `getModelForLevel` instead of only its four-entry static map, so a proven thinking-level tier is actually used rather than silently falling through to the provider default. Local-preferred thinking levels (`minimal`/`low`) are excluded from suggestion candidates because the learning→selection path can't switch the active provider to a local one — so the recommender never suggests a tier nothing can run, and the lightest tier the runtime *can* run (e.g. `light`) wins instead of falling through to default. (`server/services/taskLearning/routing.js`, `server/services/agentModelSelection.js`)diff --git a/server/services/review.js b/server/services/review.jsindex 33beb5bbbc..bbadc1b76c 100644--- a/server/services/review.js+++ b/server/services/review.js@@ -323,3 +323,14 @@ cosEvents.on('agent:completed', (agent) => {);}});++// When a task is deleted, dismiss any pending review items still pointing at it.+// Otherwise the user is left staring at an orphaned alert for a task that no+// longer exists — and its "Review"/approve action resolves nothing because the+// underlying task is gone. Mirrors the memory:approved/rejected cleanup.+cosEvents.on('tasks:changed', (data) => {+ if (data?.action !== 'deleted' || !data?.taskId) return;+ dismissByReferenceId(data.taskId).catch(err =>+ console.error(`❌ Failed to dismiss review items for deleted task ${data.taskId}: ${err.message}`)+ );+});diff --git a/server/services/review.test.js b/server/services/review.test.jsindex 52c12f1b34..d357c87ccc 100644--- a/server/services/review.test.js+++ b/server/services/review.test.js@@ -273,5 +273,35 @@ describe('review service', () => {expect(atomicWrite).not.toHaveBeenCalled();});++ it('dismisses pending review items when their task is deleted', async () => {+ const handler = registeredHandlers['tasks:changed'];+ expect(handler).toBeDefined();++ const items = [+ { id: 'r1', type: 'cos', status: 'pending', metadata: { referenceId: 'task-42', taskId: 'task-42' } },+ { id: 'r2', type: 'cos', status: 'pending', metadata: { referenceId: 'task-99', taskId: 'task-99' } }+ ];+ readFile.mockResolvedValue(JSON.stringify(items));++ handler({ type: 'user', action: 'deleted', taskId: 'task-42' });+ await new Promise(r => setImmediate(r));++ const written = atomicWrite.mock.calls[0][1];+ expect(written.find(i => i.id === 'r1').status).toBe('dismissed');+ expect(written.find(i => i.id === 'r2').status).toBe('pending');+ });++ it('ignores non-deletion task changes', async () => {+ const handler = registeredHandlers['tasks:changed'];+ readFile.mockResolvedValue(JSON.stringify([+ { id: 'r1', type: 'cos', status: 'pending', metadata: { referenceId: 'task-42', taskId: 'task-42' } }+ ]));++ handler({ type: 'user', action: 'updated', task: { id: 'task-42' } });+ await new Promise(r => setImmediate(r));++ expect(atomicWrite).not.toHaveBeenCalled();+ });});});