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
Show Assistant provider retry progress
rcourtman2291924cb6db
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 3440b79a5d..5bda1311be 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -1507,6 +1507,22 @@ runtime cost control, and shared AI transport surfaces.## Current State+Assistant provider retries are a first-class visible workflow state, not a+hidden server log. The referenced OpenCode source at fetched `dev` commit+`7ae856a9e97130f664f6f11fa5871a2795de9902` defines retry session status in+`packages/opencode/src/session/status.ts` (`SessionStatus.Info` /+`SessionStatus.set`), wires retry updates from+`packages/opencode/src/session/processor.ts` through+`SessionRetry.policy({ set })`, and renders retry attempt/backoff state from+`status().type === "retry"` in+`packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx`. Pulse adapts+that contract at the owning stream boundary: `WorkflowStateData` carries+`attempt`, `max_attempts`, and `retry_after_ms`, and `AgenticLoop` emits+`provider_retry` before sleeping between transient pre-output provider+attempts. The frontend active-turn footer renders that same typed workflow state+as compact attempt/backoff progress, so the user sees Pulse moving through a+retry instead of staring at an obsolete provider-wait message.+Primary nav moved to governed platform/runtime destinations on 2026-05-16 andwas clarified on 2026-05-25 through `frontend-modern/src/App.tsx` and`frontend-modern/src/AppLayout.tsx`: the top of the app may expose canonicaldiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 35315ec09d..765f12a6bf 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -113,6 +113,15 @@ product API routes free of maintainer commercial analytics.## Shared Boundaries+Assistant chat `workflow_state` events are a shared AI/API payload boundary.+The backend source of truth is `internal/ai/chat.WorkflowStateData`, generated+to `frontend-modern/src/api/generated/aiChatEvents.ts` by+`scripts/generate-types.go` and pinned by `internal/api/contract_test.go`.+Provider retry progress must use typed fields (`attempt`, `max_attempts`,+`retry_after_ms`) on that same event instead of frontend-only string parsing or+provider-specific ad hoc events; the Assistant UI may format those fields, but+must not invent retry progress that the stream contract did not carry.+Infrastructure settings copied agent commands are a shared API/payload boundaryeven when the final command string is assembled in the browser. Selected-rowupgrade commands may carry fresh token and identity fields when the operator isdiff --git a/frontend-modern/src/api/__tests__/aiChatEvents.test.ts b/frontend-modern/src/api/__tests__/aiChatEvents.test.tsindex f35f2dca91..011968862a 100644--- a/frontend-modern/src/api/__tests__/aiChatEvents.test.ts+++ b/frontend-modern/src/api/__tests__/aiChatEvents.test.ts@@ -42,6 +42,25 @@ describe('AI chat stream event contract', () => {expect(aiChatEventsSource).toContain('next_model?: string');});+ it('exposes provider retry metadata on workflow state events', () => {+ const workflow: WorkflowStateData = {+ phase: 'provider_retry',+ message: 'Provider connection failed before any output; retrying.',+ state: 'investigating',+ attempt: 2,+ max_attempts: 2,+ retry_after_ms: 200,+ };+ const event: AIChatStreamEvent = { type: 'workflow_state', data: workflow };++ expect(event.data.attempt).toBe(2);+ expect(event.data.max_attempts).toBe(2);+ expect(event.data.retry_after_ms).toBe(200);+ expect(aiChatEventsSource).toContain('attempt?: number');+ expect(aiChatEventsSource).toContain('max_attempts?: number');+ expect(aiChatEventsSource).toContain('retry_after_ms?: number');+ });+it('exposes live tool progress as a typed stream contract', () => {const progress: ToolProgressData = {id: 'tool-1',diff --git a/frontend-modern/src/api/generated/aiChatEvents.ts b/frontend-modern/src/api/generated/aiChatEvents.tsindex bd0ecee7c8..17cff18af5 100644--- a/frontend-modern/src/api/generated/aiChatEvents.ts+++ b/frontend-modern/src/api/generated/aiChatEvents.ts@@ -128,6 +128,9 @@ export interface WorkflowStateData {message: string;state?: string;tool?: string;+ attempt?: number;+ max_attempts?: number;+ retry_after_ms?: number;failed_provider?: string;failed_model?: string;next_provider?: string;diff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.tsindex 887aaa5833..c6e950c9a9 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts@@ -116,6 +116,31 @@ describe('getAssistantActiveTurnStatus', () => {});});+ it('surfaces provider retry attempt and backoff metadata in the active footer', () => {+ const startedAt = Date.now() - 2_000;+ expect(+ getAssistantActiveTurnStatus(+ [+ assistantMessage({+ workflowStatus: {+ phase: 'provider_retry',+ message: 'Provider connection failed before any output; retrying.',+ attempt: 2,+ maxAttempts: 2,+ retryAfterMs: 200,+ startedAt,+ },+ }),+ ],+ true,+ ),+ ).toEqual({+ type: 'thinking',+ text: 'Provider connection failed before any output; retrying. · attempt 2/2 · retrying in 200ms',+ startedAt,+ });+ });+it('prefers live tool progress over generic tool labels', () => {expect(getAssistantActiveTurnStatus(diff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.tsindex 2eb061b7e8..e333698b92 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -1164,6 +1164,39 @@ describe('useChat', () => {dispose();});+ it('stores provider retry metadata from workflow state events', async () => {+ const { getFireEvent } = setupWithEventCapture();+ const { value: chat, dispose } = withRoot(() =>+ useChat({ sessionId: 's', model: 'openrouter:openai/gpt-4o-mini' }),+ );++ await chat.sendMessage('hi');+ const fire = getFireEvent();++ fire({+ type: 'workflow_state',+ data: {+ phase: 'provider_retry',+ message: 'Provider connection failed before any output; retrying.',+ attempt: 2,+ max_attempts: 2,+ retry_after_ms: 200,+ },+ });++ const assistant = chat.messages().find((m) => m.role === 'assistant')!;+ expect(assistant.workflowStatus).toEqual(+ expect.objectContaining({+ phase: 'provider_retry',+ message: 'Provider connection failed before any output; retrying.',+ attempt: 2,+ maxAttempts: 2,+ retryAfterMs: 200,+ }),+ );+ dispose();+ });+it('does not infer a failed route when workflow only carries a next model', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() =>diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.tsindex b3adc009a7..670558168f 100644--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts@@ -31,6 +31,33 @@ const messageContainsToolLabel = (message: string, label: string) => {return new RegExp(`(^|\\W)${escapeRegExp(label)}($|\\W)`, 'i').test(message);};+const formatRetryDelay = (milliseconds?: number): string => {+ if (!Number.isFinite(milliseconds) || !milliseconds || milliseconds <= 0) return '';+ if (milliseconds < 1000) return `${Math.round(milliseconds)}ms`;+ const seconds = milliseconds / 1000;+ if (seconds < 10) return `${Number(seconds.toFixed(1))}s`;+ if (seconds < 60) return `${Math.round(seconds)}s`;+ const minutes = seconds / 60;+ if (minutes < 10) return `${Number(minutes.toFixed(1))}m`;+ return `${Math.round(minutes)}m`;+};++const formatRetryStatusSuffix = (status?: WorkflowStatus): string => {+ const parts: string[] = [];+ if (status?.attempt && status.maxAttempts) {+ parts.push(`attempt ${status.attempt}/${status.maxAttempts}`);+ } else if (status?.attempt) {+ parts.push(`attempt ${status.attempt}`);+ }++ const retryDelay = formatRetryDelay(status?.retryAfterMs);+ if (retryDelay) {+ parts.push(`retrying in ${retryDelay}`);+ }++ return parts.length > 0 ? ` · ${parts.join(' · ')}` : '';+};+export const formatAssistantWorkflowStatus = (status?: WorkflowStatus): string => {const message = status?.message?.trim();if (!message) return '';@@ -41,8 +68,9 @@ export const formatAssistantWorkflowStatus = (status?: WorkflowStatus): string =toolLabel && !message.includes(tool || '') && !messageContainsToolLabel(message, toolLabel)? ` · ${toolLabel}`: '';+ const retrySuffix = formatRetryStatusSuffix(status);- return `${message}${toolSuffix}`;+ return `${message}${toolSuffix}${retrySuffix}`;};const formatPendingToolStatus = (tool?: PendingTool): string => {diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.tsindex 57dcc79e5d..1e4eb29cd3 100644--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts@@ -121,7 +121,10 @@ export function useChat(options: UseChatOptions = {}) {(a.phase || '') === (b.phase || '') &&a.message === b.message &&(a.state || '') === (b.state || '') &&- (a.tool || '') === (b.tool || '');+ (a.tool || '') === (b.tool || '') &&+ (a.attempt || 0) === (b.attempt || 0) &&+ (a.maxAttempts || 0) === (b.maxAttempts || 0) &&+ (a.retryAfterMs || 0) === (b.retryAfterMs || 0);const setAssistantWorkflowStatus = (assistantId: string,@@ -601,6 +604,11 @@ export function useChat(options: UseChatOptions = {}) {};};+ const positiveNumber = (value: unknown): number | undefined => {+ const numberValue = Number(value);+ return Number.isFinite(numberValue) && numberValue > 0 ? numberValue : undefined;+ };+const extractCompletedModel = (data: unknown): string => {if (!data || typeof data !== 'object') return '';const record = data as Record<string, unknown>;@@ -640,12 +648,18 @@ export function useChat(options: UseChatOptions = {}) {const phase = typeof record.phase === 'string' ? record.phase.trim() : '';const state = typeof record.state === 'string' ? record.state.trim() : '';const tool = typeof record.tool === 'string' ? record.tool.trim() : '';+ const attempt = positiveNumber(record.attempt);+ const maxAttempts = positiveNumber(record.max_attempts ?? record.maxAttempts);+ const retryAfterMs = positiveNumber(record.retry_after_ms ?? record.retryAfterMs);return {message,phase: phase || undefined,state: state || undefined,tool: tool || undefined,+ attempt,+ maxAttempts,+ retryAfterMs,startedAt: Date.now(),};};@@ -691,7 +705,9 @@ export function useChat(options: UseChatOptions = {}) {return Object.keys(requestContext).length > 0 ? requestContext : undefined;};- const snapshotSendOptions = (sendOptions?: SendMessageOptions): SendMessageOptions | undefined => {+ const snapshotSendOptions = (+ sendOptions?: SendMessageOptions,+ ): SendMessageOptions | undefined => {const modelRoute = effectiveModelRoute(sendOptions);const next: SendMessageOptions = {};if (modelRoute) {diff --git a/frontend-modern/src/components/AI/Chat/types.ts b/frontend-modern/src/components/AI/Chat/types.tsindex 97a16b67a7..47148b7015 100644--- a/frontend-modern/src/components/AI/Chat/types.ts+++ b/frontend-modern/src/components/AI/Chat/types.ts@@ -123,6 +123,9 @@ export interface WorkflowStatus {message: string;state?: string;tool?: string;+ attempt?: number;+ maxAttempts?: number;+ retryAfterMs?: number;startedAt?: number;}diff --git a/internal/ai/chat/agentic.go b/internal/ai/chat/agentic.goindex c672fd7edb..97bf72c896 100644--- a/internal/ai/chat/agentic.go+++ b/internal/ai/chat/agentic.go@@ -65,16 +65,38 @@ func isRetryableProviderStreamError(err error) bool {return false}-func emitWorkflowState(callback StreamCallback, phase, message, state, tool string) {+type workflowStateOption func(*WorkflowStateData)++func withWorkflowRetry(nextAttempt, maxAttempts int, retryAfter time.Duration) workflowStateOption {+ return func(data *WorkflowStateData) {+ if nextAttempt > 0 {+ data.Attempt = nextAttempt+ }+ if maxAttempts > 0 {+ data.MaxAttempts = maxAttempts+ }+ if retryAfter > 0 {+ data.RetryAfterMS = int64(retryAfter / time.Millisecond)+ }+ }+}++func emitWorkflowState(callback StreamCallback, phase, message, state, tool string, opts ...workflowStateOption) {if callback == nil {return}- jsonData, _ := json.Marshal(WorkflowStateData{+ data := WorkflowStateData{Phase: phase,Message: message,State: state,Tool: tool,- })+ }+ for _, opt := range opts {+ if opt != nil {+ opt(&data)+ }+ }+ jsonData, _ := json.Marshal(data)callback(StreamEvent{Type: "workflow_state", Data: jsonData})}@@ -85,6 +107,23 @@ func sessionFSMState(fsm *SessionFSM) string {return string(fsm.State)}+func providerRetryStatusMessage(err error) string {+ if err == nil {+ return "Provider stream interrupted before any output; retrying."+ }+ msg := strings.ToLower(strings.TrimSpace(err.Error()))+ switch {+ case strings.Contains(msg, "rate limit"), strings.Contains(msg, "too many requests"), strings.Contains(msg, "429"):+ return "Provider is rate limiting the request; retrying."+ case strings.Contains(msg, "timeout"), strings.Contains(msg, "timed out"), strings.Contains(msg, "deadline"):+ return "Provider timed out before any output; retrying."+ case strings.Contains(msg, "connection"), strings.Contains(msg, "broken pipe"), strings.Contains(msg, "eof"):+ return "Provider connection failed before any output; retrying."+ default:+ return "Provider stream interrupted before any output; retrying."+ }+}+const defaultProviderStreamErrorMessage = "AI response stream interrupted before completion. Please retry."func fallbackProviderStreamErrorMessage(err error) string {@@ -996,6 +1035,14 @@ func (a *AgenticLoop) executeWithTools(ctx context.Context, sessionID string, meDur("backoff", backoff).Str("session_id", sessionID).Msg("[AgenticLoop] Provider stream failed before events; retrying turn")+ emitWorkflowState(+ callback,+ "provider_retry",+ providerRetryStatusMessage(effectiveErr),+ sessionFSMState(a.sessionFSM),+ "",+ withWorkflowRetry(attempt+1, maxProviderAttempts, backoff),+ )select {case <-time.After(backoff):case <-ctx.Done():diff --git a/internal/ai/chat/agentic_additional_test.go b/internal/ai/chat/agentic_additional_test.goindex 0e95c85c3d..3c5dd423e8 100644--- a/internal/ai/chat/agentic_additional_test.go+++ b/internal/ai/chat/agentic_additional_test.go@@ -296,13 +296,39 @@ func TestAgenticLoop_RetriesProviderStreamBeforeEvents(t *testing.T) {return nil}- results, err := loop.Execute(context.Background(), "retry-before-events", []Message{{Role: "user", Content: "hi"}}, func(event StreamEvent) {})+ var workflowStates []WorkflowStateData+ results, err := loop.Execute(context.Background(), "retry-before-events", []Message{{Role: "user", Content: "hi"}}, func(event StreamEvent) {+ if event.Type != "workflow_state" {+ return+ }+ var data WorkflowStateData+ if err := json.Unmarshal(event.Data, &data); err != nil {+ t.Fatalf("failed to decode workflow_state: %v", err)+ }+ workflowStates = append(workflowStates, data)+ })if err != nil {t.Fatalf("expected retry to recover stream failure, got error: %v", err)}if callCount != 2 {t.Fatalf("expected 2 provider attempts, got %d", callCount)}+ if len(workflowStates) != 1 {+ t.Fatalf("expected one retry workflow state, got %#v", workflowStates)+ }+ retry := workflowStates[0]+ if retry.Phase != "provider_retry" {+ t.Fatalf("retry phase = %q, want provider_retry", retry.Phase)+ }+ if retry.Attempt != 2 || retry.MaxAttempts != 2 {+ t.Fatalf("retry attempts = %d/%d, want 2/2", retry.Attempt, retry.MaxAttempts)+ }+ if retry.RetryAfterMS != 200 {+ t.Fatalf("retry backoff = %dms, want 200ms", retry.RetryAfterMS)+ }+ if retry.Message != "Provider connection failed before any output; retrying." {+ t.Fatalf("retry message = %q", retry.Message)+ }if len(results) != 1 || results[0].Content != "hello" {t.Fatalf("unexpected results: %+v", results)}diff --git a/internal/ai/chat/types.go b/internal/ai/chat/types.goindex cb8539c42e..11386a34fe 100644--- a/internal/ai/chat/types.go+++ b/internal/ai/chat/types.go@@ -255,6 +255,9 @@ type WorkflowStateData struct {Message string `json:"message"` // Human-readable status text for the UIState string `json:"state,omitempty"` // Backend workflow state, when availableTool string `json:"tool,omitempty"` // Tool associated with this transition+ Attempt int `json:"attempt,omitempty"` // One-based attempt number for transient provider retries+ MaxAttempts int `json:"max_attempts,omitempty"` // Maximum attempts available for the current provider request+ RetryAfterMS int64 `json:"retry_after_ms,omitempty"` // Milliseconds until the next provider attempt startsFailedProvider string `json:"failed_provider,omitempty"` // Provider that failed before visible outputFailedModel string `json:"failed_model,omitempty"` // Model that failed before visible outputNextProvider string `json:"next_provider,omitempty"` // Provider selected for the fallback attemptdiff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 99c6c7a156..f27c79e444 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -10615,6 +10615,18 @@ func TestContract_ChatStreamEventJSONSnapshots(t *testing.T) {}),want: `{"type":"workflow_state","data":{"phase":"provider_fallback","message":"OpenRouter did not start a response; trying DeepSeek.","state":"provider_fallback","failed_provider":"openrouter","failed_model":"openrouter:qwen/qwen3.7-plus","next_provider":"deepseek","next_model":"deepseek:deepseek-v4-pro"}}`,},+ {+ name: "workflow_state_provider_retry",+ event: mustStreamEvent(t, "workflow_state", chat.WorkflowStateData{+ Phase: "provider_retry",+ Message: "Provider connection failed before any output; retrying.",+ State: "investigating",+ Attempt: 2,+ MaxAttempts: 2,+ RetryAfterMS: 200,+ }),+ want: `{"type":"workflow_state","data":{"phase":"provider_retry","message":"Provider connection failed before any output; retrying.","state":"investigating","attempt":2,"max_attempts":2,"retry_after_ms":200}}`,+ },{name: "tool_start",event: mustStreamEvent(t, "tool_start", chat.ToolStartData{diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex 895bd6bc4c..0803a0a27b 100644--- a/scripts/release_control/subsystem_lookup_test.py+++ b/scripts/release_control/subsystem_lookup_test.py@@ -2860,7 +2860,7 @@ class SubsystemLookupTest(unittest.TestCase):{"heading": "## Shared Boundaries","path": "internal/api/access_control_handlers.go",- "line": 379,+ "line": 388,"heading_line": 114,}],