Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Speed up Assistant stream status feedback
rcourtman02386309d7f9
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 4090f976ba..41d9294e9b 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -76,7 +76,10 @@ Assistant live workflow status follows OpenCode's current-state timelinemodel: history may persist for audit/session state, but live transcript rowsand the active-turn footer render the latest replacing workflow statusimmediately. Pulse must not replay stale status history through artificial-timers when the stream already has a newer workflow/tool state.+timers when the stream already has a newer workflow/tool state. Frontend+display code may refresh elapsed-time suffixes while a turn is active, but+status selection must read the current workflow status directly rather than+deriving an older display status from `workflowStatusHistory`.1. Add or change chat runtime, Patrol orchestration, findings generation, or remediation behavior through `internal/ai/`2. Add or change canonical AI provider config, provider-scoped model selection, or runtime auth/base-URL defaults through `internal/config/ai.go`.diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex c04d8c555d..c043e3d5b6 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -572,7 +572,7 @@ payload shape change when the portal presents compact client rows.Cold Assistant streams must include a typed `session` event backed by`internal/ai/chat.SessionData` as soon as the HTTP SSE writer is ready andan immediate neutral `workflow_state` preparation event before backend- handoff recovery, model resolution, provider fallback planning, context+ handoff recovery, model resolution, selected-route retry planning, contextprefetch, inventory reads, or user-visible provider output so the frontendcan bind the backend-created session and show live progress without aseparate create-session request. That cold-stream model resolution must usediff --git a/frontend-modern/src/api/__tests__/aiChat.test.ts b/frontend-modern/src/api/__tests__/aiChat.test.tsindex 26d0337c64..de659a675a 100644--- a/frontend-modern/src/api/__tests__/aiChat.test.ts+++ b/frontend-modern/src/api/__tests__/aiChat.test.ts@@ -78,11 +78,11 @@ describe('AIChatAPI', () => {await flushMicrotasks();};- it('uses immediate and periodic paint checkpoints for text while yielding every progress event', () => {+ it('uses low-latency paint checkpoints for text while yielding every progress event', () => {const shouldYield = createAIChatStreamPaintCheckpointPredicate();expect(shouldYield({ type: 'content' })).toBe(true);- for (let index = 0; index < 14; index += 1) {+ for (let index = 0; index < 2; index += 1) {expect(shouldYield({ type: 'content' })).toBe(false);}expect(shouldYield({ type: 'content' })).toBe(true);diff --git a/frontend-modern/src/api/aiChat.ts b/frontend-modern/src/api/aiChat.tsindex d17803ea44..915bb1a91c 100644--- a/frontend-modern/src/api/aiChat.ts+++ b/frontend-modern/src/api/aiChat.ts@@ -151,7 +151,7 @@ export interface ToolCall {export type StreamEvent = AIChatStreamEvent;-const AI_CHAT_STREAM_TEXT_PAINT_CHECKPOINT_INTERVAL = 16;+const AI_CHAT_STREAM_TEXT_PAINT_CHECKPOINT_INTERVAL = 4;const AI_CHAT_STREAM_TEXT_EVENT_TYPES = new Set(['content', 'thinking']);const isAIChatStreamTextEvent = (event: Pick<StreamEvent, 'type'>): boolean =>diff --git a/frontend-modern/src/api/aiChatDevStreamFixture.ts b/frontend-modern/src/api/aiChatDevStreamFixture.tsindex eb1d886d7e..9854111d67 100644--- a/frontend-modern/src/api/aiChatDevStreamFixture.ts+++ b/frontend-modern/src/api/aiChatDevStreamFixture.ts@@ -402,7 +402,7 @@ const buildWorkflowBurstFixtureEvents = (model?: string): AIChatStreamEvent[] =>{type: 'content',data: {- text: 'The workflow-burst fixture held the live status long enough to show paced status movement.',+ text: 'The workflow-burst fixture held live status events long enough to show latest-status replacement.',},},{diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsxindex bc0c7ea521..78fa8c703a 100644--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx@@ -27,7 +27,7 @@ import { getAssistantAnswerText } from './assistantAnswerText';import { stripAssistantOutputArtifacts } from './assistantOutputHygiene';import { formatAssistantWorkflowStatus } from './activeTurnStatus';import { groupStreamEventsForDisplay } from './streamEventGrouping';-import { pacedWorkflowStatusForDisplay } from './workflowStatusPacing';+import { WORKFLOW_STATUS_REFRESH_MS } from './workflowStatusDisplay';import type {ChatMessage,ModelRouteRecoveryOption,@@ -371,7 +371,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {const status = currentWorkflowStatus();if (!props.message.isStreaming || !status?.startedAt) return;setStatusNow(Date.now());- const interval = window.setInterval(() => setStatusNow(Date.now()), 1000);+ const interval = window.setInterval(() => setStatusNow(Date.now()), WORKFLOW_STATUS_REFRESH_MS);onCleanup(() => window.clearInterval(interval));});const formatWorkflowStatus = (status?: WorkflowStatus, includeElapsed = false) => {@@ -389,15 +389,8 @@ export const MessageItem: Component<MessageItemProps> = (props) => {}return `${message}${elapsedSuffix}`;};- const displayedWorkflowStatus = (status?: WorkflowStatus) =>- pacedWorkflowStatusForDisplay(- props.message.workflowStatusHistory,- status,- groupedEvents(),- props.message.isStreaming ? statusNow() : undefined,- );const workflowStatusText = createMemo(() =>- formatWorkflowStatus(displayedWorkflowStatus(currentWorkflowStatus()), true),+ formatWorkflowStatus(currentWorkflowStatus(), true),);const shouldShowHeaderWorkflowStatus = () =>props.message.isStreaming &&@@ -588,9 +581,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {const contentText = () =>stripAssistantOutputArtifacts(evt?.content || '').text;const visibleWorkflowStatus = () =>- evt?.type === 'workflow_status'- ? displayedWorkflowStatus(evt.workflowStatus)- : undefined;+ evt?.type === 'workflow_status' ? evt.workflowStatus : undefined;return (<Switch>diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsxindex ffe1d67853..82b548ed2b 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx@@ -5478,7 +5478,7 @@ describe('AIChat', () => {expect(status).not.toHaveTextContent('Using Qwen: Qwen3.7 Plus via OpenRouter');});- it('paces replacing workflow progress in the active turn status footer', async () => {+ it('uses the latest replacing workflow progress in the active turn status footer', async () => {vi.useFakeTimers();vi.setSystemTime(1_200);const [isLoading, setIsLoading] = createSignal(false);@@ -5527,22 +5527,12 @@ describe('AIChat', () => {]);const status = screen.getByLabelText('Assistant active turn status');- expect(status).toHaveTextContent('Preparing Pulse context.');- expect(status).not.toHaveTextContent('OpenRouter is starting the response.');- expect(status).not.toHaveTextContent('Reading current Pulse inventory.');-- vi.advanceTimersByTime(1_000);- await waitFor(() => expect(status).toHaveTextContent('Reading current Pulse inventory.'));- expect(status).not.toHaveTextContent('Preparing Pulse context.');- expect(status).not.toHaveTextContent('OpenRouter is starting the response.');-- vi.advanceTimersByTime(1_000);await waitFor(() => expect(status).toHaveTextContent('OpenRouter is starting the response.'));expect(status).not.toHaveTextContent('Preparing Pulse context.');expect(status).not.toHaveTextContent('Reading current Pulse inventory.');});- it('paces replacing workflow progress without dropping queued follow-up pressure', async () => {+ it('uses the latest replacing workflow progress without dropping queued follow-up pressure', async () => {vi.useFakeTimers();vi.setSystemTime(1_200);const [isLoading, setIsLoading] = createSignal(false);@@ -5599,16 +5589,11 @@ describe('AIChat', () => {]);const status = screen.getByLabelText('Assistant active turn status');- expect(status).toHaveTextContent('Preparing Pulse context. · 1 follow-up queued');- expect(status).not.toHaveTextContent('OpenRouter is starting the response.');- expect(status).not.toHaveTextContent('Reading current Pulse inventory.');-- vi.advanceTimersByTime(1_000);await waitFor(() =>- expect(status).toHaveTextContent('Reading current Pulse inventory. · 1 follow-up queued'),+ expect(status).toHaveTextContent('OpenRouter is starting the response. · 1 follow-up queued'),);expect(status).not.toHaveTextContent('Preparing Pulse context.');- expect(status).not.toHaveTextContent('OpenRouter is starting the response.');+ expect(status).not.toHaveTextContent('Reading current Pulse inventory.');});it('keeps pending tool progress visible in the active turn status', () => {diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsxindex a269542e32..1dc38058e2 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx@@ -801,7 +801,7 @@ describe('MessageItem', () => {).toBeInTheDocument();});- it('paces replacing workflow activity through one live transcript row', async () => {+ it('renders the latest replacing workflow activity through one live transcript row', () => {vi.useFakeTimers();vi.setSystemTime(1_200);@@ -844,20 +844,6 @@ describe('MessageItem', () => {/>));- expect(screen.getByText('Preparing Pulse context.')).toBeInTheDocument();- expect(screen.queryByText(/OpenRouter is starting the response\./)).not.toBeInTheDocument();- expect(- screen.queryByText(/Reading current Pulse inventory\./),- ).not.toBeInTheDocument();-- vi.advanceTimersByTime(1_000);- await Promise.resolve();- expect(screen.getByText('Reading current Pulse inventory.')).toBeInTheDocument();- expect(screen.queryByText(/Preparing Pulse context\./)).not.toBeInTheDocument();- expect(screen.queryByText(/OpenRouter is starting the response\./)).not.toBeInTheDocument();-- vi.advanceTimersByTime(1_000);- await Promise.resolve();expect(screen.getByText(/OpenRouter is starting the response\./)).toBeInTheDocument();expect(screen.queryByText(/Preparing Pulse context\./)).not.toBeInTheDocument();expect(@@ -865,7 +851,7 @@ describe('MessageItem', () => {).not.toBeInTheDocument();});- it('lets provider retry workflow activity cut through live transcript pacing', () => {+ it('uses provider retry workflow activity as the latest live transcript status', () => {vi.useFakeTimers();vi.setSystemTime(1_200);diff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.tsindex fccf56aa21..1727907445 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts@@ -244,7 +244,7 @@ describe('getAssistantActiveTurnStatus', () => {});});- it('paces burst workflow progress in the active turn footer', () => {+ it('uses the latest replacing workflow progress in the active turn footer', () => {const workflowStatusHistory = [{phase: 'request_start',@@ -280,23 +280,13 @@ describe('getAssistantActiveTurnStatus', () => {];expect(getAssistantActiveTurnStatus(messages, true, 1_200)).toEqual({- type: 'thinking',- text: 'Preparing Pulse context.',- startedAt: 1_000,- });- expect(getAssistantActiveTurnStatus(messages, true, 1_900)).toEqual({- type: 'tool',- text: 'Reading current Pulse inventory.',- startedAt: 1_100,- });- expect(getAssistantActiveTurnStatus(messages, true, 2_800)).toEqual({type: 'thinking',text: 'OpenRouter is starting the response.',startedAt: 1_200,});});- it('lets provider retry workflow progress cut through active turn pacing', () => {+ it('uses provider retry workflow progress as the latest active turn status', () => {const workflowStatusHistory = [{phase: 'request_start',@@ -345,7 +335,7 @@ describe('getAssistantActiveTurnStatus', () => {});});- it('lets stream idle liveness cut through active turn pacing', () => {+ it('uses stream idle liveness as the latest active turn status', () => {const workflowStatusHistory = [{phase: 'request_start',diff --git a/frontend-modern/src/components/AI/Chat/__tests__/workflowStatusPacing.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/workflowStatusPacing.test.tsdeleted file mode 100644index aa2d962f3b..0000000000--- a/frontend-modern/src/components/AI/Chat/__tests__/workflowStatusPacing.test.ts+++ /dev/null@@ -1,113 +0,0 @@-import { describe, expect, it } from 'vitest';-import { pacedWorkflowStatusForDisplay, WORKFLOW_STATUS_PACE_MS } from '../workflowStatusPacing';-import type { StreamDisplayEvent, WorkflowStatus } from '../types';--const burstStatuses = (): WorkflowStatus[] => [- {- phase: 'request_start',- message: 'Preparing Pulse context.',- startedAt: 1_000,- },- {- phase: 'context',- message: 'Reading current Pulse inventory with pulse_query.',- tool: 'pulse_query',- startedAt: 1_100,- },- {- phase: 'provider_start',- message: 'OpenRouter is starting the response.',- startedAt: 1_200,- },-];--describe('workflowStatusPacing', () => {- it('paces burst workflow statuses instead of jumping straight to the latest status', () => {- const history = burstStatuses();- const events: StreamDisplayEvent[] = [- {- type: 'workflow_status',- workflowStatus: history[2],- startedAt: 1_200,- updatedAt: 1_200,- },- ];-- expect(- pacedWorkflowStatusForDisplay(history, history[2], events, 1_200),- ).toBe(history[0]);- expect(- pacedWorkflowStatusForDisplay(- history,- history[2],- events,- 1_000 + WORKFLOW_STATUS_PACE_MS,- ),- ).toBe(history[1]);- expect(- pacedWorkflowStatusForDisplay(- history,- history[2],- events,- 1_000 + WORKFLOW_STATUS_PACE_MS * 2,- ),- ).toBe(history[2]);- });-- it('keeps workflow rows tied to their own status after durable transcript evidence', () => {- const history = burstStatuses();- const events: StreamDisplayEvent[] = [- {- type: 'workflow_status',- workflowStatus: history[0],- startedAt: 1_000,- updatedAt: 1_000,- },- {- type: 'tool',- tool: {- name: 'pulse_query',- input: '{}',- output: '3 devices found',- success: true,- },- startedAt: 1_150,- updatedAt: 1_300,- },- {- type: 'workflow_status',- workflowStatus: history[2],- startedAt: 1_200,- updatedAt: 1_200,- },- ];-- expect(- pacedWorkflowStatusForDisplay(history, history[2], events, 1_200),- ).toBe(history[2]);- });-- it('does not pace status history that was not delivered as a burst', () => {- const history: WorkflowStatus[] = [- {- phase: 'request_start',- message: 'Preparing Pulse context.',- startedAt: 1_000,- },- {- phase: 'provider_start',- message: 'OpenRouter is starting the response.',- startedAt: 2_500,- },- ];-- expect(- pacedWorkflowStatusForDisplay(- history,- history[1],- [{ type: 'workflow_status', workflowStatus: history[1] }],- 2_500,- ),- ).toBe(history[1]);- });-});diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.tsindex f38641efac..f375220f2e 100644--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts@@ -8,7 +8,6 @@ import {parseToolInputSummary,toolValueText,} from './toolPresentation';-import { pacedWorkflowStatusForDisplay } from './workflowStatusPacing';export type AssistantActiveTurnStatusKind = 'thinking' | 'tool' | 'generating';@@ -364,7 +363,6 @@ const completedToolStatusText = (event: StreamDisplayEvent): string => {const latestStreamActivityStatus = (events?: StreamDisplayEvent[],now?: number,- workflowStatusHistory?: WorkflowStatus[],): AssistantActiveTurnStatusCandidate | null => {const completedToolKeys = new Set<string>();let current: AssistantActiveTurnStatusCandidate | null = null;@@ -426,12 +424,7 @@ const latestStreamActivityStatus = (break;}case 'workflow_status': {- const workflowStatus = pacedWorkflowStatusForDisplay(- workflowStatusHistory,- event.workflowStatus,- events,- now,- );+ const workflowStatus = event.workflowStatus;const text = formatAssistantWorkflowStatus(workflowStatus, now);if (text) {candidate = {@@ -628,7 +621,6 @@ export const getAssistantActiveTurnStatus = (const eventStatusCandidate = latestStreamActivityStatus(assistantMessage.streamEvents,now,- assistantMessage.workflowStatusHistory,);if (eventStatusCandidate) {statusCandidates.push(eventStatusCandidate);@@ -640,12 +632,7 @@ export const getAssistantActiveTurnStatus = (}}if (assistantMessage.isStreaming !== false) {- const displayedWorkflowStatus = pacedWorkflowStatusForDisplay(- assistantMessage.workflowStatusHistory,- assistantMessage.workflowStatus,- assistantMessage.streamEvents,- now,- );+ const displayedWorkflowStatus = assistantMessage.workflowStatus;const workflowCandidate = workflowStatusCandidate(displayedWorkflowStatus, now);if (workflowCandidate &&diff --git a/frontend-modern/src/components/AI/Chat/index.tsx b/frontend-modern/src/components/AI/Chat/index.tsxindex 366ff82008..197284684f 100644--- a/frontend-modern/src/components/AI/Chat/index.tsx+++ b/frontend-modern/src/components/AI/Chat/index.tsx@@ -154,6 +154,7 @@ import { SlashCommandAutocomplete } from './SlashCommandAutocomplete';import {getAssistantActiveTurnStatus,} from './activeTurnStatus';+import { WORKFLOW_STATUS_REFRESH_MS } from './workflowStatusDisplay';import { getLastAssistantAnswerText } from './assistantAnswerText';import {getNextAssistantRecentModelRoute,@@ -2364,7 +2365,10 @@ export const AIChat: Component<AIChatProps> = (props) => {const status = currentStatus();if (!status?.startedAt) return;setCurrentStatusNow(Date.now());- const interval = window.setInterval(() => setCurrentStatusNow(Date.now()), 1000);+ const interval = window.setInterval(+ () => setCurrentStatusNow(Date.now()),+ WORKFLOW_STATUS_REFRESH_MS,+ );onCleanup(() => window.clearInterval(interval));});const currentStatusText = createMemo(() => {diff --git a/frontend-modern/src/components/AI/Chat/workflowStatusDisplay.ts b/frontend-modern/src/components/AI/Chat/workflowStatusDisplay.tsnew file mode 100644index 0000000000..edf8da6d8d--- /dev/null+++ b/frontend-modern/src/components/AI/Chat/workflowStatusDisplay.ts@@ -0,0 +1 @@+export const WORKFLOW_STATUS_REFRESH_MS = 300;diff --git a/frontend-modern/src/components/AI/Chat/workflowStatusPacing.ts b/frontend-modern/src/components/AI/Chat/workflowStatusPacing.tsdeleted file mode 100644index 41c8b31503..0000000000--- a/frontend-modern/src/components/AI/Chat/workflowStatusPacing.ts+++ /dev/null@@ -1,109 +0,0 @@-import type { StreamDisplayEvent, WorkflowStatus } from './types';--export const WORKFLOW_STATUS_PACE_MS = 900;-const WORKFLOW_STATUS_BURST_GAP_MS = 900;--const finiteTime = (value: unknown): number | undefined =>- typeof value === 'number' && Number.isFinite(value) ? value : undefined;--const workflowStatusesMatch = (a?: WorkflowStatus, b?: WorkflowStatus) =>- !!a &&- !!b &&- (a.phase || '') === (b.phase || '') &&- a.message === b.message &&- (a.state || '') === (b.state || '') &&- (a.tool || '') === (b.tool || '') &&- (a.provider || '') === (b.provider || '') &&- (a.model || '') === (b.model || '') &&- (a.attempt || 0) === (b.attempt || 0) &&- (a.maxAttempts || 0) === (b.maxAttempts || 0) &&- (a.retryAfterMs || 0) === (b.retryAfterMs || 0);--const isDurableStreamBoundary = (event: StreamDisplayEvent) =>- event.type !== 'workflow_status' && event.type !== 'model_switch';--const immediateWorkflowStatusPhases = new Set(['provider_retry', 'stream_idle']);--const isImmediateWorkflowStatus = (status?: WorkflowStatus) => {- const phase = status?.phase?.trim().toLowerCase();- return (- (phase ? immediateWorkflowStatusPhases.has(phase) : false) ||- Boolean(status?.attempt || status?.retryAfterMs)- );-};--const latestWorkflowEventIndex = (- events: StreamDisplayEvent[] | undefined,- currentStatus: WorkflowStatus | undefined,-): number => {- for (let index = (events?.length || 0) - 1; index >= 0; index -= 1) {- const event = events?.[index];- if (event?.type !== 'workflow_status') continue;- if (!currentStatus || workflowStatusesMatch(event.workflowStatus, currentStatus)) {- return index;- }- }- return -1;-};--const hasEarlierDurableBoundary = (- events: StreamDisplayEvent[] | undefined,- workflowIndex: number,-) => {- if (!events || workflowIndex < 0) return false;- for (let index = 0; index < workflowIndex; index += 1) {- if (isDurableStreamBoundary(events[index])) return true;- }- return false;-};--const burstHistoryUpTo = (- history: WorkflowStatus[] | undefined,- currentStatus: WorkflowStatus | undefined,-): WorkflowStatus[] => {- if (!history?.length || !currentStatus) return [];-- let currentIndex = -1;- for (let index = history.length - 1; index >= 0; index -= 1) {- if (workflowStatusesMatch(history[index], currentStatus)) {- currentIndex = index;- break;- }- }- if (currentIndex <= 0) return [];-- const segment = history.slice(0, currentIndex + 1);- for (let index = 1; index < segment.length; index += 1) {- const previousAt = finiteTime(segment[index - 1].startedAt);- const currentAt = finiteTime(segment[index].startedAt);- if (previousAt === undefined || currentAt === undefined) return [];- const gap = currentAt - previousAt;- if (gap < 0 || gap > WORKFLOW_STATUS_BURST_GAP_MS) return [];- }- return segment;-};--export const pacedWorkflowStatusForDisplay = (- history: WorkflowStatus[] | undefined,- currentStatus: WorkflowStatus | undefined,- events: StreamDisplayEvent[] | undefined,- now?: number,-): WorkflowStatus | undefined => {- if (isImmediateWorkflowStatus(currentStatus)) return currentStatus;-- const workflowIndex = latestWorkflowEventIndex(events, currentStatus);- if (workflowIndex >= 0 && hasEarlierDurableBoundary(events, workflowIndex)) {- return currentStatus;- }-- const segment = burstHistoryUpTo(history, currentStatus);- if (segment.length <= 1) return currentStatus;-- const start = finiteTime(segment[0].startedAt);- const currentTime = finiteTime(now);- if (start === undefined || currentTime === undefined) return currentStatus;-- const elapsed = Math.max(0, currentTime - start);- const pacedIndex = Math.min(segment.length - 1, Math.floor(elapsed / WORKFLOW_STATUS_PACE_MS));- return segment[pacedIndex] || currentStatus;-};