Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Prioritize Assistant workflow status over route evidence

rcourtman89ff200fcead
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 502c188a1c..3abc03a1a3 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -225,10 +225,15 @@ runtime cost control, and shared AI transport surfaces.
export status lines must normalize internal tool identifiers such as
`pulse_query`, `pulse_read`, and `pulse_exec` into operator-facing activity
labels, while preserving the raw typed event payload for Details/debug paths.
- Placeholder `request_start` workflow statuses remain fallback activity only:
- once selected-model, provider, tool, thinking, approval, question, or content
- activity is visible, the placeholder must not outrank it in the footer or
- render beside it as a duplicate transcript row. The generated frontend SSE
+ Selected-model route rows are typed route evidence, not live activity. They
+ may render immediately while the backend/provider stream is still quiet, but
+ they must not hide or outrank workflow progress once a `request_start`,
+ provider, tool, thinking, approval, question, or content activity is
+ available. This follows the referenced OpenCode separation between session
+ status and model/tool transcript events at fetched `origin/dev` commit
+ `31c099be435d59bd6749ace7a9f2bb2245e6d3fa`: Pulse keeps the selected route
+ visible as durable evidence while the active-turn footer and live workflow
+ rows answer what the assistant is doing now. The generated frontend SSE
contract must include workflow `provider` and `model` fields so
selected-route activity is typed end to end.
The transcript viewport is part of the same live activity contract. The
diff --git a/frontend-modern/src/components/AI/Chat/MessageItem.tsx b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
index 79ea497ae4..3d838078fa 100644
--- a/frontend-modern/src/components/AI/Chat/MessageItem.tsx
+++ b/frontend-modern/src/components/AI/Chat/MessageItem.tsx
@@ -261,6 +261,8 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
const groupedEvents = createMemo(() =>
groupStreamEventsForDisplay(props.message.streamEvents || []),
);
+ const isSelectedModelRouteEvent = (evt: StreamDisplayEvent) =>
+ evt.type === 'model_switch' && evt.modelEvent === 'selected' && !evt.failedModel?.trim();
const isConcreteStreamActivity = (evt: StreamDisplayEvent) => {
switch (evt.type) {
case 'workflow_status':
@@ -279,7 +281,7 @@ export const MessageItem: Component<MessageItemProps> = (props) => {
case 'tool_cancel':
return !!evt.toolCancel;
case 'model_switch':
- return !!evt.model?.trim();
+ return !!evt.model?.trim() && !isSelectedModelRouteEvent(evt);
case 'approval':
return !!evt.approval;
case 'question':
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
index 57d178a9e3..b386fcf983 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -4709,7 +4709,7 @@ describe('AIChat', () => {
);
});
- it('prefers the selected model route over placeholder request-start progress', () => {
+ it('prefers workflow progress over selected model route evidence', () => {
const startedAt = Date.now() - 1_000;
mockChat.isLoading.mockReturnValue(true);
mockChat.messages.mockReturnValue([
@@ -4748,8 +4748,8 @@ describe('AIChat', () => {
renderChat();
const status = screen.getByLabelText('Assistant active turn status');
- expect(status).toHaveTextContent('Using Qwen: Qwen3.7 Plus via OpenRouter');
- expect(status).not.toHaveTextContent('Preparing Pulse context.');
+ expect(status).toHaveTextContent('Preparing Pulse context.');
+ expect(status).not.toHaveTextContent('Using Qwen: Qwen3.7 Plus via OpenRouter');
});
it('shows the latest burst workflow progress immediately in the active turn status footer', () => {
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
index f0cc9d97f0..c63ab702e3 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/MessageItem.test.tsx
@@ -928,7 +928,7 @@ describe('MessageItem', () => {
).toHaveTextContent('Using Qwen 3.7 Plus via OpenRouter');
});
- it('hides placeholder request-start rows once the selected model route is visible', () => {
+ it('keeps request-start progress visible next to selected model route evidence', () => {
const events: StreamDisplayEvent[] = [
{
type: 'model_switch',
@@ -968,7 +968,7 @@ describe('MessageItem', () => {
expect(
screen.getByRole('status', { name: 'Assistant model route selected' }),
).toHaveTextContent('Using Qwen 3.7 Plus via OpenRouter');
- expect(screen.queryByText('Preparing Pulse context.')).not.toBeInTheDocument();
+ expect(screen.getByText(/Preparing Pulse context\./)).toBeInTheDocument();
});
it('renders provider fallback model switches with failed and next routes', () => {
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
index 15673bcbcc..996b326af5 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
@@ -116,7 +116,7 @@ describe('getAssistantActiveTurnStatus', () => {
});
});
- it('prefers the selected model route over the generic request-start status', () => {
+ it('prefers workflow progress over selected model route evidence', () => {
const startedAt = Date.now() - 1_000;
expect(
getAssistantActiveTurnStatus(
@@ -153,7 +153,7 @@ describe('getAssistantActiveTurnStatus', () => {
),
).toEqual({
type: 'thinking',
- text: 'Using Qwen: Qwen3.7 Plus via OpenRouter',
+ text: 'Preparing Pulse context.',
startedAt,
});
});
diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
index 50302b2ed2..16359e1868 100644
--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
@@ -233,6 +233,11 @@ const activePendingToolFromEvents = (events?: StreamDisplayEvent[]): PendingTool
const latestPendingToolActivity = (tool?: PendingTool): number =>
tool?.updatedAt ?? tool?.startedAt ?? 0;
+const isSelectedModelRouteEvent = (event: StreamDisplayEvent): boolean =>
+ event.type === 'model_switch' &&
+ event.modelEvent === 'selected' &&
+ !event.failedModel?.trim();
+
const pendingToolCandidate = (
tool: PendingTool | undefined,
order: number,
@@ -422,6 +427,7 @@ const latestStreamActivityStatus = (
text,
startedAt: event.startedAt,
activityAt: eventActivityAt(event),
+ placeholder: isSelectedModelRouteEvent(event),
order: index,
};
}
@@ -513,7 +519,11 @@ export const getAssistantActiveTurnStatus = (
const workflowCandidate = workflowStatusCandidate(assistantMessage.workflowStatus, now);
if (
workflowCandidate &&
- !(isInitialRequestStartStatus(assistantMessage.workflowStatus) && eventStatusCandidate)
+ !(
+ isInitialRequestStartStatus(assistantMessage.workflowStatus) &&
+ eventStatusCandidate &&
+ eventStatusCandidate.placeholder !== true
+ )
) {
statusCandidates.push(workflowCandidate);
}