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(cos): show task delete confirmation next to trash icon, not card bottom

[._.]/ Adam Eivy44e75731ee16
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 538c1792c2..a8a8c0eab8 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -43,6 +43,7 @@
## CoS / task learning
+- **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`)
## Local model stack
diff --git a/client/src/components/cos/tabs/TaskItem.jsx b/client/src/components/cos/tabs/TaskItem.jsx
index f62c97f071..6a71ffdb00 100644
--- a/client/src/components/cos/tabs/TaskItem.jsx
+++ b/client/src/components/cos/tabs/TaskItem.jsx
@@ -21,7 +21,7 @@ import toast from '../../ui/Toast';
import * as api from '../../../services/api';
import { filterSelectableModels } from '../../../utils/providers';
import { formatDurationMin, formatBytes } from '../../../utils/formatters';
-import InlineConfirmRow from '../../ui/InlineConfirmRow';
+import ConfirmButtonPair from '../../ui/ConfirmButtonPair';
import { useConfirmDelete } from '../../../hooks/useConfirmDelete';
const statusIcons = {
@@ -388,66 +388,69 @@ export default function TaskItem({ task, isSystem, awaitingApproval, onRefresh,
)}
</div>
- {/* Action buttons */}
- <div className="flex items-center gap-1 md:opacity-0 md:group-hover:opacity-100 transition-opacity">
+ {/* Action buttons. Keep the delete confirmation here, next to the trash
+ icon, rather than at the bottom of the card — a task with a lot of
+ context would otherwise push the confirm row far below the fold. */}
+ <div className={`flex items-center gap-1 transition-opacity ${
+ isConfirming(task.id) ? '' : 'md:opacity-0 md:group-hover:opacity-100'
+ }`}>
{!editing && (
- <>
- {task.status === 'pending' && !task.approvalRequired && (
+ isConfirming(task.id) ? (
+ <ConfirmButtonPair
+ prompt="Delete?"
+ confirmText="Delete"
+ ariaLabel="Confirm delete task"
+ onConfirm={() => confirmDelete(handleDelete)}
+ onCancel={cancelDelete}
+ />
+ ) : (
+ <>
+ {task.status === 'pending' && !task.approvalRequired && (
+ <button
+ onClick={async () => {
+ const result = await api.forceSpawnTask(task.id).catch(err => { toast.error(err.message); return null; });
+ if (result?.success) toast.success(`Spawning ${task.id}`);
+ if (onRefresh) onRefresh();
+ }}
+ className="p-1 text-gray-500 hover:text-port-success transition-colors"
+ title="Process now"
+ aria-label="Process task now"
+ >
+ <Play size={14} aria-hidden="true" />
+ </button>
+ )}
+ {task.status !== 'blocked' && task.status !== 'completed' && (
+ <button
+ onClick={handleMarkBlocked}
+ className="p-1 text-gray-500 hover:text-port-error transition-colors"
+ title="Mark as blocked"
+ aria-label="Mark task as blocked"
+ >
+ <Ban size={14} aria-hidden="true" />
+ </button>
+ )}
<button
- onClick={async () => {
- const result = await api.forceSpawnTask(task.id).catch(err => { toast.error(err.message); return null; });
- if (result?.success) toast.success(`Spawning ${task.id}`);
- if (onRefresh) onRefresh();
- }}
- className="p-1 text-gray-500 hover:text-port-success transition-colors"
- title="Process now"
- aria-label="Process task now"
+ onClick={() => setEditing(true)}
+ className="p-1 text-gray-500 hover:text-white transition-colors"
+ title="Edit"
+ aria-label="Edit task"
>
- <Play size={14} aria-hidden="true" />
+ <Edit3 size={14} aria-hidden="true" />
</button>
- )}
- {task.status !== 'blocked' && task.status !== 'completed' && (
<button
- onClick={handleMarkBlocked}
+ onClick={() => requestDelete(task.id)}
className="p-1 text-gray-500 hover:text-port-error transition-colors"
- title="Mark as blocked"
- aria-label="Mark task as blocked"
+ title="Delete"
+ aria-label="Delete task"
>
- <Ban size={14} aria-hidden="true" />
+ <Trash2 size={14} aria-hidden="true" />
</button>
- )}
- <button
- onClick={() => setEditing(true)}
- className="p-1 text-gray-500 hover:text-white transition-colors"
- title="Edit"
- aria-label="Edit task"
- >
- <Edit3 size={14} aria-hidden="true" />
- </button>
- <button
- onClick={() => requestDelete(task.id)}
- className="p-1 text-gray-500 hover:text-port-error transition-colors"
- title="Delete"
- aria-label="Delete task"
- >
- <Trash2 size={14} aria-hidden="true" />
- </button>
- </>
+ </>
+ )
)}
</div>
</div>
- {isConfirming(task.id) && (
- <InlineConfirmRow
- className="mt-2"
- question="Delete this task? This cannot be undone."
- confirmTitle="Confirm delete"
- cancelTitle="Cancel delete"
- onConfirm={() => confirmDelete(handleDelete)}
- onCancel={cancelDelete}
- />
- )}
-
{/* Blocked Reason Modal */}
{showBlockedModal && (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50" onClick={() => setShowBlockedModal(false)}>