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: add queue completion time estimate to QuickSummary
Adam Eivy684f44a860d6
diff --git a/.changelog/v0.17.8.md b/.changelog/v0.17.8.mdindex 4152f0099c..328d7c2b08 100644--- a/.changelog/v0.17.8.md+++ b/.changelog/v0.17.8.md@@ -40,6 +40,13 @@ JIRA integration improvements and token lifecycle management.- Each accomplishment shows the task description with a success checkmark- Helps users quickly see what was done without navigating to the Agents tab+### Queue completion time estimate in QuickSummary+- **ETA indicator** predicts when pending tasks will complete based on historical task durations+- Uses learning data to match task types to their average completion times+- Falls back to overall average for unknown task types+- Accounts for currently running agents (assumes half completion time remaining)+- Shows formatted time (e.g., "~15m", "~2h 30m") with hover tooltip showing data confidence+### Enhanced learning-based model selection- Model selection now uses the full routing accuracy data from task learning- Supports tier-specific recommendations (not just upgrades to heavy)diff --git a/client/src/components/cos/QuickSummary.jsx b/client/src/components/cos/QuickSummary.jsxindex 120f1357c4..a70f4466ea 100644--- a/client/src/components/cos/QuickSummary.jsx+++ b/client/src/components/cos/QuickSummary.jsx@@ -11,7 +11,8 @@ import {Minus,ChevronDown,ChevronRight,- Award+ Award,+ Hourglass} from 'lucide-react';import * as api from '../../services/api';@@ -162,6 +163,22 @@ export default function QuickSummary() {</div>)}+ {/* Queue Estimate */}+ {queue.estimate?.taskCount > 0 && (+ <div className="flex items-center gap-1.5" title={`Based on ${queue.estimate.confidence}% historical data`}>+ <Hourglass size={14} className="text-purple-400" />+ <span className="text-gray-400">ETA:</span>+ <span className="font-medium text-purple-300">+ {queue.estimate.formatted}+ </span>+ {queue.estimate.runningCount > 0 && (+ <span className="text-gray-500 text-xs">+ ({queue.estimate.runningCount} active)+ </span>+ )}+ </div>+ )}+{/* Next Job */}{nextJob && (<div className="flex items-center gap-1.5">diff --git a/server/routes/cos.js b/server/routes/cos.jsindex 2290dc29b8..6817c74bfb 100644--- a/server/routes/cos.js+++ b/server/routes/cos.js@@ -1069,6 +1069,18 @@ router.get('/quick-summary', asyncHandler(async (req, res) => {// Count pending user tasksconst pendingUserTasks = tasksData.user?.grouped?.pending?.length || 0;+ // Combine all pending tasks for queue estimate+ const allPendingTasks = [+ ...(tasksData.user?.grouped?.pending || []),+ ...(tasksData.cos?.grouped?.pending || [])+ ];++ // Get queue completion estimate+ const queueEstimate = await taskLearning.estimateQueueCompletion(+ allPendingTasks,+ todayActivity.stats.running+ );+res.json({today: {completed: todayActivity.stats.completed,@@ -1095,7 +1107,8 @@ router.get('/quick-summary', asyncHandler(async (req, res) => {queue: {pendingApprovals,pendingUserTasks,- total: pendingApprovals + pendingUserTasks+ total: pendingApprovals + pendingUserTasks,+ estimate: queueEstimate},status: {running: todayActivity.isRunning,diff --git a/server/services/taskLearning.js b/server/services/taskLearning.jsindex f91f463774..74aa99c75e 100644--- a/server/services/taskLearning.js+++ b/server/services/taskLearning.js@@ -1145,6 +1145,82 @@ export async function recalculateModelTierMetrics() {return { recalculated: changes.length > 0, changes };}+/**+ * Estimate queue completion time based on historical duration data+ * @param {Array} pendingTasks - List of pending tasks with descriptions+ * @param {number} runningCount - Number of currently running agents+ * @returns {Object} Estimate with totalMs, formatted string, and confidence+ */+export async function estimateQueueCompletion(pendingTasks = [], runningCount = 0) {+ const durations = await getAllTaskDurations();+ const overallAvg = durations._overall?.avgDurationMs || 300000; // Default 5 min++ let totalEstimateMs = 0;+ let tasksWithEstimates = 0;+ let tasksWithoutEstimates = 0;++ for (const task of pendingTasks) {+ // Try to match task type from description patterns+ const desc = (task.description || '').toLowerCase();+ let matchedDuration = null;++ // Check for specific task type patterns+ for (const [taskType, durationInfo] of Object.entries(durations)) {+ if (taskType === '_overall') continue;++ // Match by task type keywords in description+ const typeKey = taskType.replace(/^(self-improve:|app-improve:)/, '').toLowerCase();+ if (desc.includes(typeKey) || desc.includes(taskType.toLowerCase())) {+ matchedDuration = durationInfo.avgDurationMs;+ break;+ }+ }++ if (matchedDuration) {+ totalEstimateMs += matchedDuration;+ tasksWithEstimates++;+ } else {+ // Use overall average for unknown tasks+ totalEstimateMs += overallAvg;+ tasksWithoutEstimates++;+ }+ }++ // Account for currently running tasks (assume half done on average)+ if (runningCount > 0) {+ totalEstimateMs += (overallAvg * runningCount * 0.5);+ }++ // Format the estimate+ const totalMinutes = Math.round(totalEstimateMs / 60000);+ let formatted = '';+ if (totalMinutes === 0) {+ formatted = 'under 1m';+ } else if (totalMinutes < 60) {+ formatted = `~${totalMinutes}m`;+ } else {+ const hours = Math.floor(totalMinutes / 60);+ const mins = totalMinutes % 60;+ formatted = mins > 0 ? `~${hours}h ${mins}m` : `~${hours}h`;+ }++ // Calculate confidence based on data quality+ const totalTasks = pendingTasks.length + runningCount;+ const confidence = totalTasks > 0+ ? Math.round((tasksWithEstimates / totalTasks) * 100)+ : 0;++ return {+ totalMs: totalEstimateMs,+ totalMinutes,+ formatted,+ taskCount: pendingTasks.length,+ runningCount,+ confidence,+ basedOnHistory: tasksWithEstimates > 0+ };+}+/*** Initialize learning system - listen for agent completions*/