ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(portal): keep the reply mascot and Tasks card calm while work goes on (#8187)
Mike Bradley09b27423ec4d
diff --git a/ods/extensions/services/dashboard/src/components/PixelMascot.test.jsx b/ods/extensions/services/dashboard/src/components/PixelMascot.test.jsxindex f0dec301b..e9ec948b2 100644--- a/ods/extensions/services/dashboard/src/components/PixelMascot.test.jsx+++ b/ods/extensions/services/dashboard/src/components/PixelMascot.test.jsx@@ -36,10 +36,21 @@ it('maps waiting, actual work, errors and historical replies coherently', () =>expect(pixelReplyPose({status:'streaming'},true)).toBe('thinking')expect(pixelReplyPose({status:'streaming',task:{state:'running',calls:1}},true)).toBe('working')expect(pixelReplyPose({content:'Done'})).toBe('done')- expect(pixelReplyPose({content:'Error',task:{state:'failed'}})).toBe('blocked')expect(pixelReplyPose({status:'stopped'})).toBe('idle')})+it('lets only a reply that really failed end early, never a delivered answer', () => {+ // The run's receipt can record a failed attempt beside a delivered answer.+ expect(pixelReplyPose({status:'done',content:'Here is the page.',task:{state:'failed',calls:3}})).toBe('done')+ expect(pixelReplyPose({content:'Here is the page.',task:{state:'failed'}})).toBe('done')+ expect(pixelReplyPose({status:'error',content:'Portal could not complete the response.',task:{state:'running',calls:2}})).toBe('blocked')+ expect(pixelReplyPose({status:'error',content:'Request failed'})).toBe('blocked')+ // A goal reply's outcome is its team's state, whatever the receipt says.+ expect(pixelReplyPose({status:'done',content:'No result was produced.',goalMode:true,goalState:'failed',task:{state:'completed'}})).toBe('blocked')+ expect(pixelReplyPose({status:'done',content:'Partial page',goalMode:true,goalState:'cancelled',task:{state:'failed'}})).toBe('idle')+ expect(pixelReplyPose({status:'done',content:'Built and checked.',goalMode:true,goalState:'completed',task:{state:'failed'}})).toBe('done')+})+function loadRenderer(reduced = false) {let framelet now=0diff --git a/ods/extensions/services/dashboard/src/components/PortalGoalPlan.jsx b/ods/extensions/services/dashboard/src/components/PortalGoalPlan.jsxindex a161a1709..ebdb3bfd9 100644--- a/ods/extensions/services/dashboard/src/components/PortalGoalPlan.jsx+++ b/ods/extensions/services/dashboard/src/components/PortalGoalPlan.jsx@@ -1,17 +1,29 @@import {useId, useState} from 'react'-import {CheckCircle2, Circle, CircleDot, ListChecks, AlertCircle, PauseCircle, ChevronDown} from 'lucide-react'+import {CheckCircle2, Circle, CircleDot, ListChecks, PauseCircle, ChevronDown} from 'lucide-react'import {parseTaskActivity} from '../lib/pixelTaskActivity'import './portal-task-list.css'-const stepLabels = {pending:'Pending',running:'In progress',completed:'Completed',blocked:'Blocked',paused:'Paused',waiting:'Waiting for you'}+const stepLabels = {pending:'Pending',running:'In progress',completed:'Completed',paused:'Paused',waiting:'Waiting for you'}++// A step the agent reports as blocked is paused, never an alarm: while the run+// lasts the agent may still find another way. Steps wait for the owner only+// when Portal holds the whole goal for an answer or approval.+function stepState(step, plan, running) {+ const stopped = step.status === 'blocked' || (step.status === 'running' && !running)+ if (!stopped) return step.status+ return !running && plan.status === 'waiting' ? 'waiting' : 'paused'+}function PlanTasks({plan, active, onResume, disabled}) {const [open,setOpen] = useState(true)const id = useId()const completed = plan.steps.filter(step => step.status === 'completed').lengthconst total = plan.steps.length- const running = active && plan.status === 'active'- const status = plan.status === 'active' && !active ? 'Paused' : {active:'Working toward your goal',completed:'Plan completed',blocked:'Needs attention',waiting:'Waiting for you'}[plan.status]+ // A goal reported blocked is still being worked on until its run ends.+ const running = active && ['active','blocked'].includes(plan.status)+ // Ask for the owner only where the goal waits for them: Portal holds it for+ // an answer or approval, or it stopped short and this card can continue it.+ const status = plan.status === 'waiting' || (plan.status === 'blocked' && onResume) ? 'Waiting for you' : plan.status === 'completed' ? 'Plan completed' : 'Paused'const progress = total ? completed / total : 0return <section className="portal-task-plan" aria-label="Goal plan" data-status={running ? 'running' : plan.status}>@@ -26,8 +38,8 @@ function PlanTasks({plan, active, onResume, disabled}) {<div className="portal-task-list-description"><p>{plan.summary}</p>{!running && <span className="portal-task-list-state">{status}</span>}</div><div id={`${id}-tasks`} role="region" aria-labelledby={`${id}-trigger`} hidden={!open}><ol className="portal-task-list" aria-label="Reported tasks">{plan.steps.map(step => {- const state = step.status === 'running' && !running ? plan.status === 'waiting' ? 'waiting' : 'paused' : step.status- const Icon = state === 'completed' ? CheckCircle2 : state === 'running' ? CircleDot : state === 'blocked' ? AlertCircle : ['paused','waiting'].includes(state) ? PauseCircle : Circle+ const state = stepState(step, plan, running)+ const Icon = state === 'completed' ? CheckCircle2 : state === 'running' ? CircleDot : ['paused','waiting'].includes(state) ? PauseCircle : Circlereturn <li key={step.id} data-state={state}><Icon className="portal-task-list-icon" size={16} aria-hidden="true"/><span className="portal-task-list-label">{step.title}</span>diff --git a/ods/extensions/services/dashboard/src/components/PortalGoalPlan.test.jsx b/ods/extensions/services/dashboard/src/components/PortalGoalPlan.test.jsxindex 6963a6e33..e1d3e4502 100644--- a/ods/extensions/services/dashboard/src/components/PortalGoalPlan.test.jsx+++ b/ods/extensions/services/dashboard/src/components/PortalGoalPlan.test.jsx@@ -60,13 +60,48 @@ it('distinguishes waiting and blocked plans and invents no initial steps',()=>{const {rerender}=render(<PortalGoalPlan task={{...planned,goal:{...planned.goal,status:'waiting'}}} active/>)expect(screen.getByText('Build the page').closest('li')).toHaveAttribute('data-state','waiting')rerender(<PortalGoalPlan task={{...planned,goal:{...planned.goal,status:'blocked',steps:[{id:'build',title:'Build the page',status:'blocked'}]}}}/>)- expect(screen.getByText('Needs attention')).toBeVisible()- expect(screen.getByText('Build the page').closest('li')).toHaveAttribute('data-state','blocked')+ expect(screen.getByText('Paused')).toBeVisible()+ expect(screen.getByText('Build the page').closest('li')).toHaveAttribute('data-state','paused')rerender(<PortalGoalPlan task={{...planned,goal:{...planned.goal,steps:[]}}} active/>)expect(screen.getByRole('status')).toHaveTextContent('Planning')expect(screen.queryAllByRole('listitem')).toHaveLength(0)})+it('pauses a step the agent reports as blocked while the run keeps working',()=>{+ const goal={summary:'Improve the project',status:'active',steps:[steps[0],{id:'build',title:'Build the page',status:'blocked'},steps[2]]}+ const {container,rerender}=render(<PortalGoalPlan task={{...planned,goal}} active onResume={vi.fn()}/>)+ const row=()=>screen.getByText('Build the page').closest('li')+ expect(row()).toHaveAttribute('data-state','paused')+ expect(row()).toHaveTextContent('Status: Paused')+ expect(row().querySelector('.lucide-circle-pause')).not.toBeNull()+ // A goal the agent reports blocked is still being worked on until its run ends.+ rerender(<PortalGoalPlan task={{...planned,goal:{...goal,status:'blocked'}}} active onResume={vi.fn()}/>)+ expect(row()).toHaveAttribute('data-state','paused')+ expect(screen.queryByText(/Needs attention|Waiting for you|Blocked/)).toBeNull()+ expect(screen.queryByRole('button',{name:'Continue goal'})).toBeNull()+ expect(container.querySelector('.lucide-circle-alert')).toBeNull()+})++it('asks for the owner only where the goal waits, next to the action that continues it',()=>{+ const resume=vi.fn()+ const blocked={...planned,goal:{summary:'Needs an API key to fetch the forecast',status:'blocked',steps:[steps[0],{id:'build',title:'Build the page',status:'blocked'}]}}+ const {rerender}=render(<PortalGoalPlan task={blocked} onResume={resume}/>)+ expect(screen.getByText('Waiting for you')).toBeVisible()+ expect(screen.getByText('Build the page').closest('li')).toHaveAttribute('data-state','paused')+ fireEvent.click(screen.getByRole('button',{name:'Continue goal'}))+ expect(resume).toHaveBeenCalledOnce()+ // Portal holding the goal for an answer or approval is a real wait as well.+ rerender(<PortalGoalPlan task={{...planned,goal:{...planned.goal,status:'waiting'}}} onResume={resume}/>)+ expect(screen.getByText('Waiting for you',{selector:'.portal-task-list-state'})).toBeVisible()+ expect(screen.getByText('Build the page').closest('li')).toHaveAttribute('data-state','waiting')+ expect(screen.getByRole('button',{name:'Continue goal'})).toBeEnabled()+ // With no action on this card (an earlier reply, a subagent) a stopped goal reads as paused.+ rerender(<PortalGoalPlan task={blocked}/>)+ expect(screen.getByText('Paused')).toBeVisible()+ expect(screen.queryByText('Waiting for you')).toBeNull()+ expect(screen.queryByRole('button',{name:'Continue goal'})).toBeNull()+})+it('uses only successful public steps without inventing a resumable goal',()=>{const display=steps=>({type:'steps',label:'Work plan',detail:null,sources:[],steps,change:null})const events=[{sequence:1,kind:'unknown',state:'completed',startedAt:time,finishedAt:time,display:display(steps)},{sequence:2,kind:'unknown',state:'failed',startedAt:time,finishedAt:time,display:display([{id:'fiction',title:'This update failed',status:'completed'}])}]diff --git a/ods/extensions/services/dashboard/src/components/portal-task-list.css b/ods/extensions/services/dashboard/src/components/portal-task-list.cssindex 55fa4ea6c..8ce39de80 100644--- a/ods/extensions/services/dashboard/src/components/portal-task-list.css+++ b/ods/extensions/services/dashboard/src/components/portal-task-list.css@@ -22,8 +22,6 @@.portal-task-list li[data-state=completed] .portal-task-list-icon { color:var(--portal-plan-complete,#65bda0); }.portal-task-list li[data-state=completed] .portal-task-list-label { text-decoration:line-through; text-decoration-color:rgb(var(--theme-text-muted) / .45); }.portal-task-list li[data-state=running] { color:rgb(var(--theme-text)); }-.portal-task-list li[data-state=blocked] { color:rgb(var(--theme-text-secondary)); }-.portal-task-list li[data-state=blocked] .portal-task-list-icon { color:var(--portal-plan-attention,#d4b078); }.portal-task-list-item-state { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }.portal-task-list-empty { margin:6px 0 10px 25px; color:rgb(var(--theme-text-muted)); }.portal-task-list-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; margin-top:8px; }diff --git a/ods/extensions/services/dashboard/src/lib/pixelMascotState.js b/ods/extensions/services/dashboard/src/lib/pixelMascotState.jsindex 2691dae81..b9bcffc48 100644--- a/ods/extensions/services/dashboard/src/lib/pixelMascotState.js+++ b/ods/extensions/services/dashboard/src/lib/pixelMascotState.js@@ -6,9 +6,13 @@ export function pixelHeaderPose({sending, stopping, restoredActive, restoredChecreturn 'idle'}+// The reply's own outcome sets its pose, never the run's telemetry: a receipt+// can record a failed attempt beside a delivered answer. Only a reply that+// really failed keeps the brief "ended early" pose; a goal reply's outcome is+// its team's state.export function pixelReplyPose(message, active) {- if (message.status === 'error' || message.task?.state === 'failed') return 'blocked'- if (message.status === 'stopped') return 'idle'+ if (message.status === 'error' || message.goalState === 'failed') return 'blocked'+ if (message.status === 'stopped' || message.goalState === 'cancelled') return 'idle'// A restored/abandoned streaming placeholder is not proof of ongoing work.if (message.status === 'streaming') return active ? (message.task?.state === 'running' && message.task?.calls > 0 ? 'working' : 'thinking') : 'waiting'return message.content ? 'done' : 'idle'diff --git a/ods/extensions/services/dashboard/src/pages/PixelMascotActivity.test.jsx b/ods/extensions/services/dashboard/src/pages/PixelMascotActivity.test.jsxindex b100001a0..1f19e75fa 100644--- a/ods/extensions/services/dashboard/src/pages/PixelMascotActivity.test.jsx+++ b/ods/extensions/services/dashboard/src/pages/PixelMascotActivity.test.jsx@@ -46,3 +46,32 @@ it('drives both mascots from validated live task activity counters', async () =>expect(screen.getAllByTitle('Portal · idle').length).toBeGreaterThan(0)expect(screen.queryAllByTitle('Portal · working')).toHaveLength(0)})++it('greets a delivered answer calmly even when its receipt recorded a failed run', async () => {+ localStorage.clear()+ let stream+ const body = new globalThis.ReadableStream({start(controller) {stream = controller}})+ vi.stubGlobal('fetch', vi.fn(async url => String(url).endsWith('/chat/stream')+ ? {ok:true,headers:new Map([['content-type','text/event-stream']]),body}+ : {ok:true,json:async () => ({available:true})}))+ render(<Pixel/>)+ await screen.findByText('Available')+ fireEvent.change(screen.getByPlaceholderText('Message Portal...'),{target:{value:'Build the page'}})+ fireEvent.click(screen.getByTitle('Send'))+ const runId = 'chatcmpl_11111111-2222-4333-8444-555555555555'+ const emit = frame => act(async () => {+ stream.enqueue(new TextEncoder().encode('data: ' + JSON.stringify(frame) + '\n\n'))+ })+ await emit({choices:[{delta:{content:'The page is ready.'}}]})+ // One command did not work along the way, and the receipt says the run failed.+ await emit({id:runId,choices:[{delta:{},finish_reason:'stop'}],pixel_task:{+ schemaVersion:1,runId,startedAt:'2026-09-12T02:00:00.000Z',finishedAt:'2026-09-12T02:00:03.000Z',state:'failed',+ calls:2,failures:1,blocked:0,truncated:false,activities:[{kind:'run',calls:2,failures:1,blocked:0}],+ }})+ await act(async () => {+ stream.enqueue(new TextEncoder().encode('data: [DONE]\n\n'))+ stream.close()+ })+ expect(await screen.findByTitle('Portal · done')).toBeInTheDocument()+ expect(screen.queryAllByTitle('Portal · blocked')).toHaveLength(0)+})