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

feat: keep CoS task queues visible with compact capture and configuration drawers (#7796)

[._.]/ Adam Eivy006448f9f997
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index 86b3f3be1b..c4960aa36b 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -1,4 +1,6 @@
import { useState, useEffect, useRef, useMemo, useCallback } from 'react';
+import Drawer from '../Drawer';
+import useDrawerTab from '../../hooks/useDrawerTab';
import ProviderModelSelector from '../ProviderModelSelector';
import { Plus, Image, X, ChevronDown, ChevronRight, Sparkles, Loader2, Paperclip, FileText, Zap, Bookmark, Ticket, GitBranch, GitPullRequest, Wand2 } from 'lucide-react';
import toast from '../ui/Toast';
@@ -78,7 +80,7 @@ const readTaskDescriptionDraft = (defaultApp) => {
};
};
-export default function TaskAddForm({ providers, providersLoaded = true, apps, onTaskAdded, compact = false, defaultExpanded = false, defaultApp = '' }) {
+export default function TaskAddForm({ providers, providersLoaded = true, apps, onTaskAdded, compact = false, defaultExpanded = false, defaultApp = '', queueFirst = false }) {
const [initialDraft] = useState(() => readTaskDescriptionDraft(defaultApp));
const [newTask, setNewTask] = useState(() => {
return {
@@ -137,6 +139,7 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
// tall container (the dashboard Quick Task widget) pass defaultExpanded
// so the card paints as a complete capture form on first render.
const [expanded, setExpanded] = useState(defaultExpanded);
+ const [configurationOpen, setConfigurationOpen] = useState(false);
const [templateNameInput, setTemplateNameInput] = useState('');
const [showTemplateSave, setShowTemplateSave] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
@@ -793,6 +796,63 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
onTaskAdded?.(result, { position: addToTop ? 'top' : 'bottom' });
};
+ if (queueFirst) {
+ const reviewers = reviewOverrides.reviewers ?? reviewDefaults.reviewers;
+ const completion = planOnly ? 'Plan and file issue'
+ : useWorktree ? (openPR ? prCompletionOption(prCompletion)?.label : 'Auto-merge on completion')
+ : whenDone === 'commit-push' ? 'Commit and push to default branch' : 'Leave code uncommitted';
+ return (
+ <section className="@container bg-port-card border border-port-border rounded-lg p-3 mb-3 space-y-2" aria-label="Add new task">
+ <label htmlFor="task-description" className="sr-only">Task description (required)</label>
+ <AutoSizeTextarea
+ id="task-description"
+ ref={descriptionRef}
+ placeholder="What needs doing?"
+ value={newTask.description}
+ onChange={e => setNewTask(t => ({ ...t, description: e.target.value }))}
+ onKeyDown={e => {
+ if (e.key === 'Enter' && !e.shiftKey && !e.repeat && !isSubmitting) {
+ e.preventDefault();
+ handleAddTask();
+ }
+ }}
+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-base min-h-[44px]"
+ aria-required="true"
+ />
+ <p className="text-xs text-gray-400 break-words" aria-label="Task execution summary">
+ {selectedApp?.name || 'PortOS'} · {orchestrationMode === 'orchestrated'
+ ? `Orchestrated: ${ORCHESTRATION_ROLES_META.map(({ key, label }) => {
+ const role = orchestrationProfile[key];
+ return `${label} ${role.provider || 'default'}/${role.model || 'default'}`;
+ }).join(' · ')}`
+ : [selectedProvider?.name || newTask.provider || 'Default provider', selectedModelOrSole || 'default model', newTask.effort].filter(Boolean).join(' / ')}
+ {' · '}{planOnly ? 'Read-only planning' : useWorktree ? 'Worktree' : 'Direct checkout'}
+ {' · '}{completion}
+ {!planOnly && openPR && prCompletion === 'review-then-merge' && ` · Review: ${[...reviewers, ...(reviewOverrides.usernames ?? reviewDefaults.usernames).map(name => '@' + name)].join(', ') || 'None'}`}
+ {isFederated && ` · Instance: ${assignableInstances.find(instance => instance.id === targetInstanceId)?.name || targetInstanceId || 'Any'}`}
+ {planOnly && ` · Issue: ${issueTarget}`}
+ {createJiraTicket && !planOnly && ' · JIRA ticket'}
+ {enhancePrompt && ' · Enhance prompt'}
+ {addToTop && ' · Queue at top'}
+ </p>
+ {renderPreviews()}
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <button type="button" onClick={() => setConfigurationOpen(true)}
+ className="min-h-[44px] px-3 py-2 text-sm text-port-accent border border-port-border rounded-lg">
+ Task configuration
+ </button>
+ <button type="button" onClick={handleAddTask} disabled={isSubmitting || isEnhancing}
+ className="min-h-[44px] flex items-center gap-1 px-3 py-2 text-sm bg-port-accent/20 text-port-accent rounded-lg disabled:opacity-50">
+ {isSubmitting || isEnhancing ? <Loader2 size={14} className="animate-spin" aria-hidden="true" /> : <Plus size={14} aria-hidden="true" />}
+ {isSubmitting ? 'Adding...' : planOnly ? 'Plan & File Issue' : enhancePrompt ? 'Enhance & Add task' : 'Add task'}
+ </button>
+ </div>
+ <TaskConfigurationDrawer open={configurationOpen} onClose={() => setConfigurationOpen(false)}
+ renderFields={renderFullFormFields} renderTemplates={renderTemplates} renderUploads={() => <>{renderUploadControls()}{renderPreviews()}</>} />
+ </section>
+ );
+ }
+
// Compact mode: single row with description + app + add, expandable.
// Every breakpoint below is a CONTAINER query, not a viewport one: compact
// mode renders inside a dashboard tile that can be ~250px wide on a 2560px
@@ -863,6 +923,34 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
// Full mode: identical to original TasksTab form
return (
<div className="@container bg-port-card border border-port-accent/50 rounded-lg p-4 mb-4" role="form" aria-label="Add new task">
+ {renderTemplates()}
+
+ <div className="space-y-2">
+ <div className="flex flex-col @sm:flex-row gap-2 items-start">
+ <div className="flex-1 min-w-0 w-full">
+ <label htmlFor="task-description" className="sr-only">Task description (required)</label>
+ <AutoSizeTextarea
+ id="task-description"
+ ref={descriptionRef}
+ placeholder="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"
+ />
+ </div>
+ {renderUploadControls()}
+ </div>
+ {renderPreviews()}
+ {renderFullFormFields()}
+ </div>
+ </div>
+ );
+
+ function renderTemplates() {
+ return (
+ <>
{/* Quick Templates */}
{templates.length > 0 && (
<div className="mb-4">
@@ -913,29 +1001,9 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
)}
</div>
)}
-
- <div className="space-y-2">
- <div className="flex flex-col @sm:flex-row gap-2 items-start">
- <div className="flex-1 min-w-0 w-full">
- <label htmlFor="task-description" className="sr-only">Task description (required)</label>
- <AutoSizeTextarea
- id="task-description"
- ref={descriptionRef}
- placeholder="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"
- />
- </div>
- {renderUploadControls()}
- </div>
- {renderPreviews()}
- {renderFullFormFields()}
- </div>
- </div>
- );
+ </>
+ );
+ }
function renderUploadControls() {
return (
@@ -1032,9 +1100,10 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
);
}
- function renderFullFormFields() {
+ function renderFullFormFields(section = 'all') {
return (
<>
+ {(section === 'all' || section === 'execution') && <>
<div className="flex flex-wrap items-center justify-between gap-2 pt-1 border-t border-port-border/40">
<div className="flex flex-wrap items-center gap-1.5 text-xs text-gray-400">
<span>Execution:</span>
@@ -1239,6 +1308,8 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
instances={assignableInstances}
/>
)}
+ </>}
+ {(section === 'all' || section === 'completion') && <>
<div className="grid grid-cols-1 @sm:flex @sm:items-center gap-x-4 gap-y-1 @sm:flex-wrap">
<label className="flex items-center gap-2 cursor-pointer select-none py-1">
<input
@@ -1417,6 +1488,8 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
</>
)}
</div>
+ </>}
+ {(section === 'all' || section === 'templates') && <>
{/* Template Save Inline Input */}
{showTemplateSave && (
<div className="flex flex-wrap gap-2 items-center">
@@ -1471,7 +1544,7 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
<Bookmark size={14} aria-hidden="true" />
<span className="hidden @sm:inline">Save Template</span>
</button>
- <button
+ {!queueFirst && <button
onClick={handleAddTask}
disabled={isSubmitting || isEnhancing}
className="flex items-center gap-1 px-3 py-1.5 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 min-h-[44px]"
@@ -1487,10 +1560,30 @@ export default function TaskAddForm({ providers, providersLoaded = true, apps, o
{planOnly ? (enhancePrompt ? 'Enhance & Plan' : 'Plan & File Issue') : enhancePrompt ? 'Enhance & Add' : 'Add'}
</>
)}
- </button>
+ </button>}
</div>
)}
+ </>}
</>
);
}
}
+
+
+// The form owns all drafts; changing a drawer tab only remounts its controls.
+function TaskConfigurationDrawer({ open, onClose, renderFields, renderTemplates, renderUploads }) {
+ const [tab, setTab] = useDrawerTab('taskConfig', 'execution', ['execution', 'completion', 'templates']);
+ return (
+ <Drawer open={open} onClose={onClose} title="Task configuration" size="lg"
+ closeLabel="Close task configuration"
+ tabs={[
+ { id: 'execution', label: 'Execution', icon: Zap },
+ { id: 'completion', label: 'Completion & review', icon: GitPullRequest },
+ { id: 'templates', label: 'Templates & attachments', icon: Paperclip },
+ ]}
+ activeTab={tab} onTabChange={setTab} bodyClassName="@container space-y-3">
+ {tab === 'templates' && <>{renderTemplates()}{renderUploads()}</>}
+ {renderFields(tab)}
+ </Drawer>
+ );
+}
diff --git a/client/src/components/cos/TaskAddForm.test.jsx b/client/src/components/cos/TaskAddForm.test.jsx
index 800f0689e7..7a490c2e9a 100644
--- a/client/src/components/cos/TaskAddForm.test.jsx
+++ b/client/src/components/cos/TaskAddForm.test.jsx
@@ -1,6 +1,7 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
import { render, screen, waitFor, act } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import { MemoryRouter } from 'react-router';
import TaskAddForm from './TaskAddForm';
import { __resetToolUseModelIdsCache } from '../../hooks/useToolUseModelIds.js';
import { findEnabledByLabelText } from '../../test/enabledBarrier.js';
@@ -73,6 +74,48 @@ describe('TaskAddForm responsive layout', () => {
apiLocalLlm.getToolUseModels.mockResolvedValue({ models: [] });
});
+ // #7796: hiding configuration must not reset the draft or silently change
+ // app completion defaults, and a failed submission must remain retryable.
+ it('retains configured queue drafts across drawer tabs, close, and a failed submit', async () => {
+ localStorage.clear();
+ const user = userEvent.setup();
+ const added = vi.fn();
+ api.getCodeReviewDefaults.mockResolvedValue({ reviewers: ['codex'] });
+ api.addCosTask.mockRejectedValueOnce(new Error('Queue unavailable'))
+ .mockResolvedValueOnce({ id: 'example-task', status: 'pending' });
+ render(<MemoryRouter><TaskAddForm queueFirst providers={[]} defaultApp="example-app"
+ apps={[{ id: 'example-app', name: 'Example App', defaultUseWorktree: true, defaultOpenPR: true, defaultPrCompletion: 'review-then-merge' }]}
+ onTaskAdded={added} /></MemoryRouter>);
+ await waitFor(() => expect(screen.getByLabelText('Task execution summary')).toHaveTextContent('Review: codex'));
+ expect(screen.queryByLabelText('AI provider')).not.toBeInTheDocument();
+ await user.type(screen.getByRole('textbox', { name: /Task description/ }), 'Inspect synthetic queue');
+ await user.click(screen.getByRole('button', { name: 'Task configuration' }));
+ await user.click(screen.getByRole('tab', { name: 'Completion & review' }));
+ expect(openPrToggle()).toBeChecked();
+ expect(worktreeToggle()).toBeChecked();
+ await user.click(worktreeToggle());
+ await user.selectOptions(screen.getByLabelText('When done'), 'commit-push');
+ await user.click(screen.getByRole('tab', { name: 'Templates & attachments' }));
+ await user.click(screen.getByRole('tab', { name: 'Completion & review' }));
+ expect(screen.getByLabelText('When done')).toHaveValue('commit-push');
+ await user.click(screen.getByRole('button', { name: 'Close task configuration' }));
+ expect(screen.getByLabelText('Task execution summary')).toHaveTextContent('Direct checkout · Commit and push to default branch');
+ await user.click(screen.getByRole('button', { name: 'Add task' }));
+ await waitFor(() => expect(toast.error).toHaveBeenCalledWith('Queue unavailable'));
+ expect(screen.getByRole('textbox', { name: /Task description/ })).toHaveValue('Inspect synthetic queue');
+ expect(added).not.toHaveBeenCalled();
+ await user.click(screen.getByRole('button', { name: 'Task configuration' }));
+ expect(screen.getByLabelText('When done')).toHaveValue('commit-push');
+ await user.click(screen.getByRole('button', { name: 'Close task configuration' }));
+ await user.click(screen.getByRole('button', { name: 'Add task' }));
+ await waitFor(() => expect(added).toHaveBeenCalledWith({ id: 'example-task', status: 'pending' }, { position: 'bottom' }));
+ expect(api.addCosTask).toHaveBeenLastCalledWith(expect.objectContaining({
+ app: 'example-app', description: 'Inspect synthetic queue', useWorktree: false,
+ openPR: false, whenDone: 'commit-push',
+ }), { silent: true });
+ expect(screen.getByRole('textbox', { name: /Task description/ })).toHaveValue('');
+ });
+
it('keeps PR completion controls full-width on mobile', async () => {
render(
<TaskAddForm
diff --git a/client/src/components/cos/tabs/TasksTab.jsx b/client/src/components/cos/tabs/TasksTab.jsx
index 714653dc2e..fdd1fd94a3 100644
--- a/client/src/components/cos/tabs/TasksTab.jsx
+++ b/client/src/components/cos/tabs/TasksTab.jsx
@@ -22,6 +22,7 @@ import SortableTaskItem from './SortableTaskItem';
import TaskAddForm from '../TaskAddForm';
import { MicroGlyph, SchematicLabel } from '../../micrographics';
import useAssignableInstances from '../../../hooks/useAssignableInstances';
+import { formatCount } from '../../../utils/formatters';
import { runningAgentsByTaskId, isSpawningTask } from '../../../lib/cosSpawnWindow';
// Maps a task-section status → micrographic glyph spec. Animation only on
@@ -211,7 +212,7 @@ export default function TasksTab({ tasks, agents = [], liveOutputs = {}, onRefre
{/* User Tasks */}
<div>
<div className="flex items-center justify-between mb-3">
- <h3 className="text-lg font-semibold text-white">User Tasks (TASKS.md)</h3>
+ <h3 className="text-lg font-semibold text-white">Task queue</h3>
<button
onClick={async () => {
// Only toast success after the evaluate request resolves.
@@ -222,7 +223,7 @@ export default function TasksTab({ tasks, agents = [], liveOutputs = {}, onRefre
toast.error(err.message);
}
}}
- className="flex items-center gap-1 text-sm bg-emerald-500/20 hover:bg-emerald-500/30 text-emerald-400 px-3 py-1.5 rounded-lg transition-colors"
+ className="flex items-center gap-1 text-sm bg-port-success/20 hover:bg-port-success/30 text-port-success px-3 py-1.5 rounded-lg transition-colors"
aria-label="Run tasks now"
>
<Play size={16} aria-hidden="true" />
@@ -230,8 +231,13 @@ export default function TasksTab({ tasks, agents = [], liveOutputs = {}, onRefre
</button>
</div>
- {/* Add Task Form */}
- <TaskAddForm providers={providers} providersLoaded={providersLoaded} apps={apps} onTaskAdded={handleTaskAdded} />
+ <p className="mb-3 text-sm text-gray-400" aria-label="Queue status">
+ {formatCount(pendingUserTasksLocal.length + pendingSystemTasks.length)} pending
+ {' · '}{formatCount(activeUserTasksLocal.length + activeSystemTasks.length)} active
+ {' · '}{formatCount(blockedUserTasksLocal.length + blockedSystemTasks.length)} blocked
+ </p>
+ {/* Compact capture keeps the queue above detailed configuration. */}
+ <TaskAddForm queueFirst providers={providers} providersLoaded={providersLoaded} apps={apps} onTaskAdded={handleTaskAdded} />
{/* User Tasks Sections */}
{pendingUserTasksLocal.length === 0 && activeUserTasksLocal.length === 0 && blockedUserTasksLocal.length === 0 && completedUserTasksLocal.length === 0 ? (
@@ -244,8 +250,8 @@ export default function TasksTab({ tasks, agents = [], liveOutputs = {}, onRefre
{/* Pending Section */}
{pendingUserTasksLocal.length > 0 && (
<div className="bg-port-card border border-port-border rounded-lg overflow-hidden">
- <div className="px-3 py-2 bg-yellow-500/10 border-b border-port-border flex items-center justify-between">
- <span className="text-sm font-medium text-yellow-500 flex items-center gap-2">
+ <div className="px-3 py-2 bg-port-warning/10 border-b border-port-border flex items-center justify-between">
+ <span className="text-sm font-medium text-port-warning flex items-center gap-2">
<SectionGlyph status="pending" />
Pending ({pendingUserTasksLocal.length})
</span>
@@ -347,8 +353,8 @@ export default function TasksTab({ tasks, agents = [], liveOutputs = {}, onRefre
{/* Pending Section */}
{pendingSystemTasks.length > 0 && (
<div className="bg-port-card border border-port-border rounded-lg overflow-hidden">
- <div className="px-3 py-2 bg-yellow-500/10 border-b border-port-border flex items-center justify-between">
- <span className="text-sm font-medium text-yellow-500 flex items-center gap-2">
+ <div className="px-3 py-2 bg-port-warning/10 border-b border-port-border flex items-center justify-between">
+ <span className="text-sm font-medium text-port-warning flex items-center gap-2">
<SectionGlyph status="pending" />
Pending ({pendingSystemTasks.length})
</span>
diff --git a/client/src/components/cos/tabs/TasksTab.test.jsx b/client/src/components/cos/tabs/TasksTab.test.jsx
index d14546bb58..186c1e4904 100644
--- a/client/src/components/cos/tabs/TasksTab.test.jsx
+++ b/client/src/components/cos/tabs/TasksTab.test.jsx
@@ -4,6 +4,7 @@ import { MemoryRouter } from 'react-router';
// Regression coverage for #2519 — the "Run Now" evaluate button must only toast
// success after the request resolves.
+vi.mock('../../../hooks/useAssignableInstances', () => ({ default: () => ({ instances: [], isFederated: false }) }));
const api = vi.hoisted(() => ({
forceCosEvaluate: vi.fn(),
getCosLearningDurations: vi.fn(),
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index f8221695a2..a1ee281086 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -135,7 +135,7 @@ export default function ChiefOfStaff() {
const [statusMessage, setStatusMessage] = useState("Idle - waiting for tasks...");
const [liveOutputs, setLiveOutputs] = useState({});
const [eventLogs, setEventLogs] = useState([]);
- const [agentPanelCollapsed, setAgentPanelCollapsed] = useState(false);
+ const [agentPanelCollapsed, setAgentPanelCollapsed] = useState(() => activeTab === 'tasks');
const [desktopPanelCollapsed, setDesktopPanelCollapsed] = useLocalStorageBool(
'cos-panel-collapsed',
false,
@@ -911,18 +911,6 @@ export default function ChiefOfStaff() {
return (
<div className={`relative flex flex-col lg:grid ${desktopPanelCollapsed ? 'lg:grid-cols-[0px_1fr]' : 'lg:grid-cols-[320px_1fr]'} h-full overflow-hidden transition-[grid-template-columns] duration-200`}>
- {/* Floating expand button - flush with nav edge when panel is collapsed */}
- {desktopPanelCollapsed && (
- <button
- onClick={toggleDesktopPanel}
- className="min-h-[44px] min-w-[44px] items-center justify-center hidden lg:flex absolute left-0 top-2 z-20 p-1.5 text-port-text-muted hover:text-port-text transition-colors rounded-r-md hover:bg-port-border/80 bg-port-card/60 border border-l-0 border-port-accent-2/20"
- aria-label="Expand CoS panel"
- title="Expand CoS panel"
- >
- <PanelLeftOpen size={16} />
- </button>
- )}
-
{/* Agent Panel */}
{avatarStyle === 'ascii' ? (
<>
@@ -951,8 +939,15 @@ export default function ChiefOfStaff() {
/>
</div>
)}
- {/* Mobile: always show the terminal panel (it has its own compact layout) */}
+ {/* Keep the mobile queue reachable while retaining terminal identity. */}
<div className="lg:hidden">
+ <button onClick={() => setAgentPanelCollapsed(value => !value)}
+ className="flex items-center justify-between gap-2 w-full px-3 py-2 min-h-[44px]"
+ aria-expanded={!agentPanelCollapsed} aria-controls="cos-terminal-mobile">
+ <span>CoS <StatusIndicator running={status?.running} paused={status?.paused} /></span>
+ {agentPanelCollapsed ? <ChevronDown size={18} /> : <ChevronUp size={18} />}
+ </button>
+ <div id="cos-terminal-mobile" hidden={agentPanelCollapsed}>
<TerminalCoSPanel
state={agentState}
speaking={speaking}
@@ -963,6 +958,7 @@ export default function ChiefOfStaff() {
onStop={handleStop}
stats={status?.stats}
/>
+ </div>
</div>
</>
) : desktopPanelCollapsed ? (
@@ -1132,6 +1128,16 @@ export default function ChiefOfStaff() {
on desktop (its chat pane owns the internal scroll); other tabs still
grow this region and scroll here as before. */}
<div className="flex flex-1 min-h-0 min-w-0 flex-col overflow-y-auto overflow-x-hidden p-3 lg:p-4">
+ {desktopPanelCollapsed && (
+ <div className="hidden lg:flex items-center flex-wrap gap-3 mb-3">
+ <button onClick={toggleDesktopPanel} aria-label="Expand CoS panel"
+ className="min-h-[44px] flex items-center gap-2 px-2 text-sm text-port-text">
+ <PanelLeftOpen size={16} aria-hidden="true" /> CoS
+ </button>
+ <StatusIndicator running={status?.running} paused={status?.paused} />
+ <StateLabel state={agentState} compact />
+ </div>
+ )}
{/* Stats Bar - hidden for SVG/canvas modes (now integrated into CoS sidebar);
ascii/terminal mode keeps it because TerminalCoSPanel doesn't host the cards. */}
<div className={`grid shrink-0 grid-cols-3 gap-1.5 sm:grid-cols-5 sm:gap-2 lg:gap-3 mb-3 sm:mb-4 lg:mb-6 ${avatarStyle !== 'ascii' ? 'hidden' : ''}`}>
diff --git a/client/src/pages/ChiefOfStaff.test.jsx b/client/src/pages/ChiefOfStaff.test.jsx
index 26d9351f0b..8bdc7ef39b 100644
--- a/client/src/pages/ChiefOfStaff.test.jsx
+++ b/client/src/pages/ChiefOfStaff.test.jsx
@@ -5,6 +5,7 @@ import { MemoryRouter, Routes, Route } from 'react-router';
// Regression coverage for #2519 — the page-level Force Evaluate handler must
// only toast success after the request resolves, and must toast the error
// (not a success) when it rejects.
+vi.mock('../hooks/useAssignableInstances', () => ({ default: () => ({ instances: [], isFederated: false }) }));
const api = vi.hoisted(() => ({
getCosStatus: vi.fn(),
getCosTasks: vi.fn(),
@@ -993,6 +994,18 @@ describe('Rigged avatar style', () => {
});
});
+it('retains the saved persona collapse preference and exposes operational identity', async () => {
+ localStorage.setItem('cos-panel-collapsed', 'true');
+ await renderSettledAt('tasks');
+ fireEvent.click(screen.getByRole('button', { name: 'Expand CoS panel' }));
+ expect(localStorage.getItem('cos-panel-collapsed')).toBe('false');
+ expect(screen.getByRole('button', { name: 'Collapse CoS panel' })).toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button', { name: 'Collapse CoS panel' }));
+ expect(localStorage.getItem('cos-panel-collapsed')).toBe('true');
+ expect(screen.getByRole('button', { name: 'Expand CoS panel' })).toHaveTextContent('CoS');
+ localStorage.removeItem('cos-panel-collapsed');
+});
+
describe('CoS agent panel layout sizing', () => {
it('constrains panel container width with w-full and min-w-0 for non-canvas avatar styles', async () => {
api.getCosStatus.mockResolvedValue({