Skip to content

armgit / ODS

Public Imported from GitHub
0

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.

fix(portal): say a long silent step is expected instead of showing only a timer (#8205)

Mike Bradleyd110f11bb4e5
diff --git a/ods/extensions/services/dashboard/src/components/PortalAgentActivity.jsx b/ods/extensions/services/dashboard/src/components/PortalAgentActivity.jsx
index 96801288d..6598bd6cd 100644
--- a/ods/extensions/services/dashboard/src/components/PortalAgentActivity.jsx
+++ b/ods/extensions/services/dashboard/src/components/PortalAgentActivity.jsx
@@ -11,6 +11,11 @@ import './portal-agent-activity.css'
const labels={read:'Reading files',run:'Running a command',edit:'Editing files',browser:'Browsing the web',preview:'Publishing a preview',action:'Running an operation',agent:'Coordinating agents',unknown:'Using a tool'}
const icons={read:FileSearch,run:Terminal,edit:FilePenLine,browser:Globe2,preview:Layers,agent:MessageSquare}
const completedLabels={'Reading a file':'Read','Writing a file':'Wrote','Editing a file':'Edited','Applying changes':'Applied changes','Running a command':'Ran','Finding available tools':'Found available tools','Checking tool parameters':'Checked tool parameters'}
+// A model step shows nothing until it is complete (the router validates tool
+// calls before they stream), so writing a whole page reads as one long, silent
+// "Thinking…". After this quiet stretch, say that it is expected.
+const QUIET_HINT_MS=45000
+export const QUIET_HINT='Still working. Bigger steps, like writing a whole page, can take a couple of minutes.'
export function activityDuration(seconds) {
const n=Math.max(0,Math.round(seconds))
return n<60?`${n}s`:`${Math.floor(n/60)}m${n%60?` ${n%60}s`:''}`
@@ -76,6 +81,8 @@ export default function PortalAgentActivity({task:raw,active=false,status}) {
const currentType=current?.display?.type
const progress=[...events].reverse().find(event=>event.display?.type==='text' && event.state==='completed')?.display?.label
const activeLabel=progress || (currentType==='search' || current?.kind==='browser'?'Searching the web…':currentType==='text' || !current?'Thinking…':currentType==='steps'?'Planning…':'Working…')
+ const lastChange=Math.max(start,...events.map(event=>Date.parse(event.finishedAt || event.startedAt) || 0))
+ const quiet=active && !current && now-lastChange>=QUIET_HINT_MS
const label=active?activeLabel:stopped?'Stopped':ended?'Ended early · you can try again':seconds===null?'Activity recorded':`Worked for ${activityDuration(seconds)}`
const refreshFade=()=>{const el=viewport.current;if(el)setFade({top:el.scrollTop>2,bottom:el.scrollTop+el.clientHeight<el.scrollHeight-2})}
useEffect(()=>{
@@ -102,6 +109,7 @@ export default function PortalAgentActivity({task:raw,active=false,status}) {
{active && seconds>=1 && <span className="portal-agent-time">{activityDuration(seconds)}</span>}
<ChevronDown size={13} aria-hidden="true"/>
</button>
+ {quiet && <p className="portal-agent-hint" role="status">{QUIET_HINT}</p>}
<div id={`${id}-log`} role="region" aria-labelledby={`${id}-trigger`} hidden={!open}>
<div ref={viewport} className="portal-agent-viewport" tabIndex={events.length?0:undefined} aria-label="Activity history" data-fade-top={fade.top} data-fade-bottom={fade.bottom} onScroll={()=>{const el=viewport.current;follow.current=el.scrollTop+el.clientHeight>=el.scrollHeight-12;refreshFade()}}>
<ol ref={content} className="portal-agent-stream" aria-label="Execution steps">{progressRows.map(row=>row.event?<ActivityRow key={row.event.sequence} event={row.event} active={active} later={row.event.sequence<lastSequence}/>:<li key={row.id} className="portal-agent-progress"><p>{row.text}</p></li>)}</ol>
diff --git a/ods/extensions/services/dashboard/src/components/PortalAgentActivity.test.jsx b/ods/extensions/services/dashboard/src/components/PortalAgentActivity.test.jsx
index e215f65e7..b56178225 100644
--- a/ods/extensions/services/dashboard/src/components/PortalAgentActivity.test.jsx
+++ b/ods/extensions/services/dashboard/src/components/PortalAgentActivity.test.jsx
@@ -1,5 +1,5 @@
-import {fireEvent,render,screen,within} from '@testing-library/react'
-import PortalAgentActivity from './PortalAgentActivity'
+import {act,fireEvent,render,screen,within} from '@testing-library/react'
+import PortalAgentActivity,{QUIET_HINT} from './PortalAgentActivity'
import PortalActivityChange,{activityChangeRows} from './PortalActivityChange'
const start='2026-09-15T10:00:00.000Z',end='2026-09-15T10:00:05.000Z'
const display=(type,label,extra={})=>({type,label,detail:null,sources:[],steps:[],change:null,...extra})
@@ -41,6 +41,34 @@ it('renders an empty file without crashing and distinguishes completed recovery
expect(screen.getByRole('button',{name:'Worked for 5s'})).toHaveAttribute('aria-expanded','false');
expectCalm(container);
});
+it('says a long silent step is expected instead of leaving only a growing timer',()=>{
+ vi.useFakeTimers()
+ try {
+ // The last step finished at 10:00:05; the model has been quiet since.
+ const running={...task,state:'running',finishedAt:null}
+ vi.setSystemTime(new Date('2026-09-15T10:00:30.000Z'))
+ const early=render(<PortalAgentActivity task={running} active/>)
+ expect(screen.queryByText(QUIET_HINT)).toBeNull()
+ early.unmount()
+ vi.setSystemTime(new Date('2026-09-15T10:01:00.000Z'))
+ const quiet=render(<PortalAgentActivity task={running} active/>)
+ expect(screen.getByRole('status')).toHaveTextContent(QUIET_HINT)
+ expectCalm(quiet.container)
+ quiet.unmount()
+ // A running tool reports its own progress, and a finished reply never says it is still working.
+ const tool=render(<PortalAgentActivity task={{...running,events:[call(1,'run','running',display('tool','Running a command'))]}} active/>)
+ expect(screen.queryByText(QUIET_HINT)).toBeNull()
+ tool.unmount()
+ const done=render(<PortalAgentActivity task={task}/>)
+ expect(screen.queryByText(QUIET_HINT)).toBeNull()
+ done.unmount()
+ // Before any step is recorded, the quiet stretch counts from when the reply started.
+ render(<PortalAgentActivity active/>)
+ expect(screen.queryByText(QUIET_HINT)).toBeNull()
+ act(()=>{vi.advanceTimersByTime(46000)})
+ expect(screen.getByRole('status')).toHaveTextContent(QUIET_HINT)
+ } finally {vi.useRealTimers()}
+})
it('shows a compact thinking line immediately with no fake steps or technical placeholder',()=>{
render(<PortalAgentActivity active/>);
expect(screen.getByRole('button',{name:/Thinking/})).toHaveAttribute('aria-expanded','true');
diff --git a/ods/extensions/services/dashboard/src/components/portal-agent-activity.css b/ods/extensions/services/dashboard/src/components/portal-agent-activity.css
index 425cf654e..18bd0bffa 100644
--- a/ods/extensions/services/dashboard/src/components/portal-agent-activity.css
+++ b/ods/extensions/services/dashboard/src/components/portal-agent-activity.css
@@ -30,7 +30,7 @@
.portal-agent-plan li > span:last-child { overflow-wrap:anywhere; }
.portal-agent-plan li[data-state=pending] { opacity:.65; }
.portal-agent-dot { display:inline-block; width:7px; height:7px; margin:3px; border-radius:50%; background:currentColor; box-shadow:0 0 0 3px rgb(var(--theme-text) / .07); animation:portal-agent-pulse 1.5s ease-in-out infinite; }
-.portal-agent-empty,.portal-agent-follow { font-size:11px; margin:4px 0 0; color:rgb(var(--theme-text-muted)); }
+.portal-agent-empty,.portal-agent-follow,.portal-agent-hint { font-size:11px; margin:4px 0 0; color:rgb(var(--theme-text-muted)); }
.portal-agent-follow { text-decoration:underline; text-underline-offset:3px; }
.portal-agent-shimmer { background:linear-gradient(100deg,rgb(var(--theme-text-muted)) 20%,rgb(var(--theme-text)) 45%,rgb(var(--theme-text-muted)) 70%); background-size:250% 100%; background-clip:text; -webkit-background-clip:text; color:transparent; animation:portal-agent-shine 2.2s linear infinite; }
.portal-agent-activity :is(button,a,.portal-agent-viewport):focus-visible { outline:2px solid rgb(var(--theme-text-muted)); outline-offset:3px; border-radius:4px; }