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.

Keep Assistant retry status visible in active dock

rcourtman9a1734bf871b
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 7e2e471fad..adfeb0d25d 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
@@ -363,6 +363,48 @@ describe('getAssistantActiveTurnStatus', () => {
});
});
+ it('keeps current provider retry liveness ahead of later generic content status', () => {
+ const retryStatus = {
+ phase: 'provider_retry',
+ message: 'Provider connection failed before any output; retrying.',
+ attempt: 2,
+ maxAttempts: 3,
+ retryAfterMs: 3200,
+ startedAt: 1_200,
+ };
+
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ isStreaming: true,
+ workflowStatus: retryStatus,
+ streamEvents: [
+ {
+ type: 'workflow_status',
+ workflowStatus: retryStatus,
+ startedAt: 1_200,
+ updatedAt: 1_200,
+ },
+ {
+ type: 'content',
+ content: 'The selected route recovered after the retry.',
+ startedAt: 1_300,
+ updatedAt: 1_300,
+ },
+ ],
+ }),
+ ],
+ true,
+ 2_300,
+ ),
+ ).toEqual({
+ type: 'retrying',
+ text: 'Provider connection failed before any output; retrying. · attempt 2/3 · retrying in 2.1s',
+ startedAt: 1_200,
+ });
+ });
+
it('uses stream idle liveness as the latest active turn status', () => {
const workflowStatusHistory = [
{
@@ -409,6 +451,45 @@ describe('getAssistantActiveTurnStatus', () => {
});
});
+ it('keeps current stream-idle liveness ahead of later generic content status', () => {
+ const idleStatus = {
+ phase: 'stream_idle',
+ message: 'OpenRouter is still working; waiting for more response data.',
+ startedAt: 1_200,
+ };
+
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ isStreaming: true,
+ workflowStatus: idleStatus,
+ streamEvents: [
+ {
+ type: 'workflow_status',
+ workflowStatus: idleStatus,
+ startedAt: 1_200,
+ updatedAt: 1_200,
+ },
+ {
+ type: 'content',
+ content: 'First provider token.',
+ startedAt: 1_300,
+ updatedAt: 1_300,
+ },
+ ],
+ }),
+ ],
+ true,
+ 1_400,
+ ),
+ ).toEqual({
+ type: 'thinking',
+ text: 'OpenRouter is still working; waiting for more response data.',
+ startedAt: 1_200,
+ });
+ });
+
it('prefers workflow progress over selected model route evidence', () => {
const startedAt = Date.now() - 1_000;
expect(
diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
index 87c8763f91..be353433fb 100644
--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
@@ -21,6 +21,8 @@ export interface AssistantActiveTurnStatus {
interface AssistantActiveTurnStatusCandidate extends AssistantActiveTurnStatus {
activityAt?: number;
placeholder?: boolean;
+ currentWorkflow?: boolean;
+ genericContent?: boolean;
terminalTool?: boolean;
order: number;
}
@@ -325,6 +327,8 @@ const isFresherStatusCandidate = (
) {
return current.terminalTool === true;
}
+ if (candidate.currentWorkflow && current.genericContent) return true;
+ if (candidate.genericContent && current.currentWorkflow) return false;
const candidateTime = candidate.activityAt;
const currentTime = current.activityAt;
if (candidateTime !== undefined && currentTime !== undefined && candidateTime !== currentTime) {
@@ -454,6 +458,7 @@ const latestStreamActivityStatus = (
text: 'Generating response',
startedAt: event.startedAt,
activityAt: eventActivityAt(event),
+ genericContent: true,
order: index,
};
}
@@ -518,6 +523,7 @@ const workflowStatusCandidate = (
text,
startedAt: status?.startedAt,
activityAt: status?.startedAt,
+ currentWorkflow: true,
order: Number.MAX_SAFE_INTEGER,
};
};