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
fix(cos): improve agent UI error handling and add task form keyboard submit
Adam Eivye9e4f022083d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1bfa18405c..16df996ebd 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -4,11 +4,14 @@- Slash-do agent operations panel on app detail Overview tab — buttons for `/do:push`, `/do:review`, `/do:release`, `/do:better`, and `/do:better-swift` that queue CoS agent tasks with the full command instructions- Multi-line task context now renders as a dedicated `### Task Context` section in agent prompts instead of inline+- Enter key submits the task add form (Shift+Enter for newline)## Changed## Fixed+- Agent error handling in AgentsTab — API failures no longer trigger success toasts or state refreshes+- Resume agent modal now prevents double-submission with loading state and disabled button- Slash-do quick actions (`/do:push`, `/do:review`, etc.) no longer run in a worktree — they now execute on the app's active branch where they have the correct context- Feature-ideas prompt included "you are working in a git worktree on a feature branch" even when worktree was not configured — worktree context is now only injected by `agentPromptBuilder` when actually using a worktree- `app-improve-` task IDs were getting `task-` prefix added by `taskParser.js`, causing `updateTask` lookups to fail — tasks were never marked in_progress or completed after agent runsdiff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsxindex c7a593e336..39328e1fbd 100644--- a/client/src/components/cos/TaskAddForm.jsx+++ b/client/src/components/cos/TaskAddForm.jsx@@ -331,6 +331,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faplaceholder="Task description *"value={newTask.description}onChange={e => setNewTask(t => ({ ...t, description: e.target.value }))}+ onKeyDown={e => { if (e.key === 'Enter' && !e.shiftKey && !isSubmitting) { e.preventDefault(); handleAddTask(); } }}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm min-h-[44px]"aria-required="true"/>diff --git a/client/src/components/cos/tabs/AgentsTab.jsx b/client/src/components/cos/tabs/AgentsTab.jsxindex 5f24fe59df..c1e775080b 100644--- a/client/src/components/cos/tabs/AgentsTab.jsx+++ b/client/src/components/cos/tabs/AgentsTab.jsx@@ -55,13 +55,15 @@ export default function AgentsTab({ agents, onRefresh, liveOutputs, providers, a}, [dateBuckets, loadedDates]);const handleKill = async (agentId) => {- await api.killCosAgent(agentId).catch(err => toast.error(err.message));+ const result = await api.killCosAgent(agentId).catch(err => { toast.error(err.message); return null; });+ if (!result) return;toast.success('Agent force killed');onRefresh();};const handleDelete = useCallback(async (agentId) => {- await api.deleteCosAgent(agentId).catch(err => toast.error(err.message));+ const result = await api.deleteCosAgent(agentId).catch(err => { toast.error(err.message); return null; });+ if (!result) return;setLoadedAgents(prev => {const deleted = prev.find(a => a.id === agentId);if (deleted?.completedAt) {@@ -81,7 +83,7 @@ export default function AgentsTab({ agents, onRefresh, liveOutputs, providers, a};const handleResumeSubmit = async ({ description, context, model, provider, app, type = 'user', screenshots }) => {- await api.addCosTask({+ const result = await api.addCosTask({description,context,model: model || undefined,@@ -91,15 +93,17 @@ export default function AgentsTab({ agents, onRefresh, liveOutputs, providers, ascreenshots}).catch(err => {toast.error(err.message);- return;+ return null;});+ if (!result) return;toast.success(`Created ${type === 'internal' ? 'system ' : ''}resume task`);setResumingAgent(null);onRefresh();};const handleClearCompleted = async () => {- await api.clearCompletedCosAgents().catch(err => toast.error(err.message));+ const result = await api.clearCompletedCosAgents().catch(err => { toast.error(err.message); return null; });+ if (!result) return;setLoadedAgents([]);setLoadedDates(new Set());setDateBuckets([]);diff --git a/client/src/components/cos/tabs/ResumeAgentModal.jsx b/client/src/components/cos/tabs/ResumeAgentModal.jsxindex 953935f6ed..5731adc30e 100644--- a/client/src/components/cos/tabs/ResumeAgentModal.jsx+++ b/client/src/components/cos/tabs/ResumeAgentModal.jsx@@ -1,5 +1,5 @@import { useState, useRef } from 'react';-import { X, CheckCircle, AlertCircle, RotateCcw, Image } from 'lucide-react';+import { X, CheckCircle, AlertCircle, RotateCcw, Image, Loader2 } from 'lucide-react';import { processScreenshotUploads } from '../../../utils/fileUpload';import toast from '../../ui/Toast';@@ -27,6 +27,7 @@ export default function ResumeAgentModal({ agent, taskType = 'user', providers,app: agent.metadata?.taskApp || agent.metadata?.app || ''});const [screenshots, setScreenshots] = useState([]);+ const [isSubmitting, setIsSubmitting] = useState(false);const fileInputRef = useRef(null);const handleFileSelect = async (e) => {@@ -44,13 +45,16 @@ export default function ResumeAgentModal({ agent, taskType = 'user', providers,const selectedProvider = providers?.find(p => p.id === formData.provider);const availableModels = selectedProvider?.models || [];- const handleSubmit = (e) => {+ const handleSubmit = async (e) => {e.preventDefault();+ if (isSubmitting) return;+ setIsSubmitting(true);+const fullContext = formData.refinedInstructions.trim()? `## Additional Instructions\n${formData.refinedInstructions}\n\n${initialContext}`: initialContext;- onSubmit({+ await onSubmit({description: `[Resume] ${taskDescription}`,context: fullContext,model: formData.model,@@ -58,7 +62,8 @@ export default function ResumeAgentModal({ agent, taskType = 'user', providers,app: formData.app,type: taskType,screenshots: screenshots.length > 0 ? screenshots.map(s => s.path) : undefined- });+ }).catch(() => {});+ setIsSubmitting(false);};return (@@ -222,10 +227,11 @@ export default function ResumeAgentModal({ agent, taskType = 'user', providers,</button><buttontype="submit"- className="flex items-center gap-2 px-4 py-2 bg-port-accent/20 hover:bg-port-accent/30 text-port-accent rounded-lg text-sm transition-colors"+ disabled={isSubmitting}+ className="flex items-center gap-2 px-4 py-2 bg-port-accent/20 hover:bg-port-accent/30 text-port-accent rounded-lg text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed">- <RotateCcw size={14} />- Queue Resume Task+ {isSubmitting ? <Loader2 size={14} className="animate-spin" /> : <RotateCcw size={14} />}+ {isSubmitting ? 'Queuing...' : 'Queue Resume Task'}</button></div></form>