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
feat(cos): surface hidden decision context in DecisionLogWidget
Adam Eivyb6a878582461
diff --git a/.changelog/v0.20.x.md b/.changelog/v0.20.x.mdindex 200f75b05c..2b5191c601 100644--- a/.changelog/v0.20.x.md+++ b/.changelog/v0.20.x.md@@ -18,3 +18,12 @@ Productivity insights, worktree control for task creation.- Displays "Peak Hour" (top 25% hours), "Good" (above average), or next peak hour time when suboptimal- Requires 3+ hours of historical data with 3+ tasks each before activating- Hover tooltip shows current success rate or next peak time for quick context++### Enhanced decision log transparency+- **Capacity details** now shown when agent slots are full — displays current/max agent count and per-project limits+- **Cooldown context** surfaces the app name and cooldown window duration so users can see why a task was deferred+- **Task switch flow** renders from→to task type with arrow for switch decisions, replacing opaque reason-only text+- **Idle breakdown** shows running agent count and pending approval count when CoS has no work+- **Attempt count** displayed for skipped tasks alongside success rate, giving full context on learning decisions+- **Quick stats row** now includes "deferred" (capacity) and "cooldowns" badges — previously only showed skipped/switched/selected/adjusted+- **Color-coded success rates** in decision entries (red <30%, yellow <60%, green 60%+) for at-a-glance healthdiff --git a/client/src/components/DecisionLogWidget.jsx b/client/src/components/DecisionLogWidget.jsxindex bf93b336db..fff28649de 100644--- a/client/src/components/DecisionLogWidget.jsx+++ b/client/src/components/DecisionLogWidget.jsx@@ -9,14 +9,19 @@ import {ArrowRight,Clock,RefreshCw,- Zap+ Zap,+ Users,+ Pause,+ Moon} from 'lucide-react';import * as api from '../services/api';import { useAutoRefetch } from '../hooks/useAutoRefetch';/*** DecisionLogWidget - Shows transparency into CoS decision-making- * Displays why tasks were skipped, intervals adjusted, or alternatives chosen+ * Displays why tasks were skipped, intervals adjusted, or alternatives chosen.+ * Surfaces rich context for each decision type so the user can understand+ * exactly why the CoS took (or didn't take) action.*/const DecisionLogWidget = memo(function DecisionLogWidget() {const { data: summary, loading } = useAutoRefetch(@@ -50,6 +55,12 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {return { icon: RefreshCw, color: 'text-port-success', bg: 'bg-port-success/10' };case 'task_selected':return { icon: CheckCircle, color: 'text-port-success', bg: 'bg-port-success/10' };+ case 'capacity_full':+ return { icon: Users, color: 'text-orange-400', bg: 'bg-orange-400/10' };+ case 'cooldown_active':+ return { icon: Pause, color: 'text-cyan-400', bg: 'bg-cyan-400/10' };+ case 'idle':+ return { icon: Moon, color: 'text-gray-400', bg: 'bg-gray-400/10' };default:return { icon: Eye, color: 'text-gray-400', bg: 'bg-gray-400/10' };}@@ -64,8 +75,10 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {cooldown_active: 'Cooldown',not_due: 'Not Due',queue_full: 'Queue Full',+ capacity_full: 'At Capacity',task_selected: 'Selected',- rehabilitation: 'Retried'+ rehabilitation: 'Retried',+ idle: 'Idle'};return labels[type] || type;};@@ -84,6 +97,110 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {return 'yesterday';};+ // Render context-specific detail pills for a decision+ const renderContextDetails = (decision) => {+ const ctx = decision.context;+ if (!ctx) return null;++ const pills = [];++ switch (decision.type) {+ case 'capacity_full':+ if (ctx.running !== undefined && ctx.max !== undefined) {+ pills.push(+ <span key="slots" className="text-xs px-1.5 py-0.5 rounded bg-orange-400/15 text-orange-300">+ {ctx.running}/{ctx.max} agents+ </span>+ );+ }+ if (ctx.project && ctx.project !== '_self') {+ pills.push(+ <span key="project" className="text-xs px-1.5 py-0.5 rounded bg-gray-500/15 text-gray-300">+ {ctx.project}+ </span>+ );+ }+ if (ctx.limit) {+ pills.push(+ <span key="limit" className="text-xs px-1.5 py-0.5 rounded bg-orange-400/15 text-orange-300">+ limit: {ctx.limit}/project+ </span>+ );+ }+ break;++ case 'cooldown_active':+ if (ctx.appId) {+ pills.push(+ <span key="app" className="text-xs px-1.5 py-0.5 rounded bg-cyan-400/15 text-cyan-300">+ {ctx.appId}+ </span>+ );+ }+ if (ctx.cooldownMs) {+ pills.push(+ <span key="cooldown" className="text-xs px-1.5 py-0.5 rounded bg-cyan-400/15 text-cyan-300">+ {Math.round(ctx.cooldownMs / 60000)}min window+ </span>+ );+ }+ break;++ case 'task_switched':+ if (ctx.fromTask && ctx.toTask) {+ pills.push(+ <span key="switch" className="text-xs px-1.5 py-0.5 rounded bg-purple-400/15 text-purple-300 inline-flex items-center gap-1">+ {ctx.fromTask} <ArrowRight size={10} /> {ctx.toTask}+ </span>+ );+ }+ break;++ case 'task_skipped':+ if (ctx.attempts) {+ pills.push(+ <span key="attempts" className="text-xs px-1.5 py-0.5 rounded bg-port-warning/15 text-yellow-300">+ {ctx.attempts} attempts+ </span>+ );+ }+ break;++ case 'idle':+ if (ctx.runningAgents !== undefined) {+ pills.push(+ <span key="running" className="text-xs px-1.5 py-0.5 rounded bg-gray-500/15 text-gray-300">+ {ctx.runningAgents} running+ </span>+ );+ }+ if (ctx.awaitingApproval > 0) {+ pills.push(+ <span key="approval" className="text-xs px-1.5 py-0.5 rounded bg-port-warning/15 text-yellow-300">+ {ctx.awaitingApproval} awaiting approval+ </span>+ );+ }+ break;++ default:+ break;+ }++ // Always show taskType if present and not already shown by type-specific pills+ if (ctx.taskType && decision.type !== 'task_switched') {+ pills.unshift(+ <span key="taskType" className="text-xs text-gray-400">+ {ctx.taskType}+ </span>+ );+ }++ if (pills.length === 0) return null;++ return <div className="flex flex-wrap items-center gap-1.5 mt-1">{pills}</div>;+ };+return (<div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">{/* Header */}@@ -124,6 +241,18 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {<span>{last24Hours.switched} switched</span></div>)}+ {last24Hours.capacityFull > 0 && (+ <div className="flex items-center gap-1.5 px-2 py-1 rounded bg-orange-400/10 text-orange-400 text-xs">+ <Users size={12} />+ <span>{last24Hours.capacityFull} deferred</span>+ </div>+ )}+ {last24Hours.cooldownActive > 0 && (+ <div className="flex items-center gap-1.5 px-2 py-1 rounded bg-cyan-400/10 text-cyan-400 text-xs">+ <Pause size={12} />+ <span>{last24Hours.cooldownActive} cooldowns</span>+ </div>+ )}{last24Hours.selected > 0 && (<div className="flex items-center gap-1.5 px-2 py-1 rounded bg-port-success/10 text-port-success text-xs"><CheckCircle size={12} />@@ -175,15 +304,11 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {<span className={`text-xs font-medium ${style.color}`}>{formatDecisionType(decision.type)}</span>- {decision.context?.taskType && (- <span className="text-xs text-gray-400">- {decision.context.taskType}- </span>- )}</div><p className="text-sm text-gray-300 truncate" title={decision.reason}>{decision.reason}</p>+ {renderContextDetails(decision)}<div className="text-xs text-gray-500 mt-0.5">{formatRelativeTime(decision.lastTimestamp || decision.timestamp)}{(decision.count || 1) > 1 && (@@ -192,8 +317,11 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {</span>)}{decision.context?.successRate !== undefined && (- <span className="ml-2">- Success rate: {decision.context.successRate}%+ <span className={`ml-2 ${+ decision.context.successRate < 30 ? 'text-port-error' :+ decision.context.successRate < 60 ? 'text-port-warning' : 'text-port-success'+ }`}>+ {decision.context.successRate}% success</span>)}</div>diff --git a/server/services/decisionLog.js b/server/services/decisionLog.jsindex 15078444a8..1c9d998a88 100644--- a/server/services/decisionLog.js+++ b/server/services/decisionLog.js@@ -202,7 +202,10 @@ export async function getDecisionSummary() {skipped: byType[DECISION_TYPES.TASK_SKIPPED] || 0,switched: byType[DECISION_TYPES.TASK_SWITCHED] || 0,adjusted: byType[DECISION_TYPES.INTERVAL_ADJUSTED] || 0,- selected: byType[DECISION_TYPES.TASK_SELECTED] || 0+ selected: byType[DECISION_TYPES.TASK_SELECTED] || 0,+ capacityFull: byType[DECISION_TYPES.CAPACITY_FULL] || 0,+ cooldownActive: byType[DECISION_TYPES.COOLDOWN_ACTIVE] || 0,+ idle: byType[DECISION_TYPES.IDLE] || 0},impactfulDecisions,transparencyScore,