The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(flows): add run inspection panel to canvas side rail
Steven Enamakel3c288e32ab69
diff --git a/app/src/components/flows/FlowRunInspectorDrawer.tsx b/app/src/components/flows/FlowRunInspectorDrawer.tsxindex 02783db968..0b8aa6a999 100644--- a/app/src/components/flows/FlowRunInspectorDrawer.tsx+++ b/app/src/components/flows/FlowRunInspectorDrawer.tsx@@ -241,10 +241,13 @@ export function FlowRunInspectorDrawer({});};- useEscapeKey(() => {- log('escape: closing runId=%s', runId);- onClose();- }, runId !== null && variant === 'drawer');+ useEscapeKey(+ () => {+ log('escape: closing runId=%s', runId);+ onClose();+ },+ runId !== null && variant === 'drawer'+ );if (!runId) return null;@@ -253,171 +256,171 @@ export function FlowRunInspectorDrawer({const content = (<>- {/* Header */}- <header className="flex items-start gap-2.5 border-b border-line px-4 py-3">- <div className="min-w-0 flex-1">- <div className="flex items-center gap-2">- <span className="truncate font-semibold text-content">- {t('flowRuns.inspector.title')}- </span>- {run && (- <span- data-testid="flow-run-status-dot"- data-status={run.status}- className={`h-2 w-2 shrink-0 rounded-full ${flowRunStatusDotClass(run.status)}`}- />- )}- </div>- <div className="mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-content-muted">- {run && (- <Badge- variant={flowRunStatusVariant(run.status)}- data-testid="flow-run-status-pill"- data-status={run.status}>- {flowRunStatusLabel(run.status, t)}- </Badge>- )}- {/* Internal ids are dev/debug info, not primary-view content (issue+ {/* Header */}+ <header className="flex items-start gap-2.5 border-b border-line px-4 py-3">+ <div className="min-w-0 flex-1">+ <div className="flex items-center gap-2">+ <span className="truncate font-semibold text-content">+ {t('flowRuns.inspector.title')}+ </span>+ {run && (+ <span+ data-testid="flow-run-status-dot"+ data-status={run.status}+ className={`h-2 w-2 shrink-0 rounded-full ${flowRunStatusDotClass(run.status)}`}+ />+ )}+ </div>+ <div className="mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-content-muted">+ {run && (+ <Badge+ variant={flowRunStatusVariant(run.status)}+ data-testid="flow-run-status-pill"+ data-status={run.status}>+ {flowRunStatusLabel(run.status, t)}+ </Badge>+ )}+ {/* Internal ids are dev/debug info, not primary-view content (issueB20) — shown short-form only, full value on hover via `title`,matching `FlowRunsDrawer`'s row-level `run.id.slice(0, 8)`. */}- {run && (- <span className="truncate font-mono" title={run.flow_id}>- {run.flow_id.slice(0, 8)}- </span>- )}- {run && (- <span className="truncate font-mono" title={run.thread_id}>- {run.thread_id.slice(0, 8)}- </span>- )}- </div>+ {run && (+ <span className="truncate font-mono" title={run.flow_id}>+ {run.flow_id.slice(0, 8)}+ </span>+ )}+ {run && (+ <span className="truncate font-mono" title={run.thread_id}>+ {run.thread_id.slice(0, 8)}+ </span>+ )}</div>- <Button- type="button"- variant="tertiary"- size="xs"- iconOnly- data-testid="flow-run-inspector-close"- onClick={onClose}- aria-label={t('conversations.subagent.close')}- className="shrink-0">- <X className="h-3.5 w-3.5" aria-hidden />- </Button>- </header>-- <div className="flex-1 space-y-3 overflow-y-auto px-4 py-4">- {loading && !run && (- <div data-testid="flow-run-inspector-loading">- <CenteredLoadingState label={t('flowRuns.inspector.loading')} />- </div>- )}-- {error && (- <Alert variant="destructive" density="compact" data-testid="flow-run-inspector-error">- <AlertDescription>- {t('flowRuns.inspector.loadError')}: {error}- </AlertDescription>- </Alert>- )}+ </div>+ <Button+ type="button"+ variant="tertiary"+ size="xs"+ iconOnly+ data-testid="flow-run-inspector-close"+ onClick={onClose}+ aria-label={t('conversations.subagent.close')}+ className="shrink-0">+ <X className="h-3.5 w-3.5" aria-hidden />+ </Button>+ </header>- {run && (- <>- {/* Timing */}- <div className="text-xs text-content-muted" data-testid="flow-run-timing">- {startedAt && (- <div>- {t('flowRuns.inspector.startedAt')}: {startedAt}- </div>- )}- {finishedAt ? (- <div>- {t('flowRuns.inspector.finishedAt')}: {finishedAt}- </div>- ) : run.status === 'running' || run.status === 'pending_approval' ? (- <div className="animate-pulse">{t('flowRuns.inspector.running')}</div>- ) : null}- </div>+ <div className="flex-1 space-y-3 overflow-y-auto px-4 py-4">+ {loading && !run && (+ <div data-testid="flow-run-inspector-loading">+ <CenteredLoadingState label={t('flowRuns.inspector.loading')} />+ </div>+ )}- {/* Error banner */}- {run.error && (- <Alert variant="destructive" density="compact" data-testid="flow-run-error-banner">- <AlertDescription>- {t('flowRuns.inspector.error')}: {run.error}- </AlertDescription>- </Alert>- )}+ {error && (+ <Alert variant="destructive" density="compact" data-testid="flow-run-inspector-error">+ <AlertDescription>+ {t('flowRuns.inspector.loadError')}: {error}+ </AlertDescription>+ </Alert>+ )}- {/* Repair entry point (Phase 5c): open the canvas copilot preloaded- with this failed run so the workflow builder can propose a fix. */}- {run.status === 'failed' && onFixWithAgent && (+ {run && (+ <>+ {/* Timing */}+ <div className="text-xs text-content-muted" data-testid="flow-run-timing">+ {startedAt && (<div>- <Button- type="button"- variant="primary"- size="sm"- data-testid="flow-run-fix-with-agent"- onClick={handleFixWithAgent}>- {t('flowRuns.inspector.fixWithAgent')}- </Button>+ {t('flowRuns.inspector.startedAt')}: {startedAt}</div>)}+ {finishedAt ? (+ <div>+ {t('flowRuns.inspector.finishedAt')}: {finishedAt}+ </div>+ ) : run.status === 'running' || run.status === 'pending_approval' ? (+ <div className="animate-pulse">{t('flowRuns.inspector.running')}</div>+ ) : null}+ </div>- {/* Actionable pending-approval gates for this run (flow-approval+ {/* Error banner */}+ {run.error && (+ <Alert variant="destructive" density="compact" data-testid="flow-run-error-banner">+ <AlertDescription>+ {t('flowRuns.inspector.error')}: {run.error}+ </AlertDescription>+ </Alert>+ )}++ {/* Repair entry point (Phase 5c): open the canvas copilot preloaded+ with this failed run so the workflow builder can propose a fix. */}+ {run.status === 'failed' && onFixWithAgent && (+ <div>+ <Button+ type="button"+ variant="primary"+ size="sm"+ data-testid="flow-run-fix-with-agent"+ onClick={handleFixWithAgent}>+ {t('flowRuns.inspector.fixWithAgent')}+ </Button>+ </div>+ )}++ {/* Actionable pending-approval gates for this run (flow-approvalsurface). Replaces the old read-only "N node(s) awaitingapproval" banner — Approve once / Approve always / Denyresolve the gate in place via `openhuman.approval_decide`;the run poller above picks up the resulting steps on itsown 2s cadence once the gate clears. */}- {isActiveRun && pendingApprovals.length > 0 && (- <div className="space-y-2" data-testid="flow-run-pending-approvals">- <h3 className="text-xs font-semibold uppercase tracking-wide text-content-muted">- {t('flowRuns.inspector.pendingApprovals')}- </h3>- {pendingApprovals.map(approval => (- <FlowRunPendingApprovalCard- key={approval.request_id}- approval={approval}- deciding={decidingApprovalId === approval.request_id}- onDecide={decision => decideApproval(approval.request_id, decision)}- />- ))}- {pendingApprovalsError && (- <p- role="alert"- data-testid="flow-run-pending-approvals-error"- className="text-xs text-coral-600 dark:text-coral-400">- {t('flowRuns.inspector.approval.loadError')}- </p>- )}- </div>- )}-- {/* Steps timeline */}- <div>- <h3 className="mb-1.5 text-xs font-semibold uppercase tracking-wide text-content-muted">- {t('flowRuns.inspector.steps')}+ {isActiveRun && pendingApprovals.length > 0 && (+ <div className="space-y-2" data-testid="flow-run-pending-approvals">+ <h3 className="text-xs font-semibold uppercase tracking-wide text-content-muted">+ {t('flowRuns.inspector.pendingApprovals')}</h3>- {run.steps.length === 0 ? (- <p className="text-xs italic text-content-faint">- {t('flowRuns.inspector.noSteps')}+ {pendingApprovals.map(approval => (+ <FlowRunPendingApprovalCard+ key={approval.request_id}+ approval={approval}+ deciding={decidingApprovalId === approval.request_id}+ onDecide={decision => decideApproval(approval.request_id, decision)}+ />+ ))}+ {pendingApprovalsError && (+ <p+ role="alert"+ data-testid="flow-run-pending-approvals-error"+ className="text-xs text-coral-600 dark:text-coral-400">+ {t('flowRuns.inspector.approval.loadError')}</p>- ) : (- <ol className="space-y-2" data-testid="flow-run-steps">- {run.steps.map((step, idx) => (- <StepRow- key={`${step.node_id}-${idx}`}- step={step}- index={idx}- liveStatus={liveStatuses[step.node_id]}- inputItems={idx > 0 ? normalizeItems(run.steps[idx - 1].output) : undefined}- />- ))}- </ol>)}</div>- </>- )}- </div>+ )}++ {/* Steps timeline */}+ <div>+ <h3 className="mb-1.5 text-xs font-semibold uppercase tracking-wide text-content-muted">+ {t('flowRuns.inspector.steps')}+ </h3>+ {run.steps.length === 0 ? (+ <p className="text-xs italic text-content-faint">+ {t('flowRuns.inspector.noSteps')}+ </p>+ ) : (+ <ol className="space-y-2" data-testid="flow-run-steps">+ {run.steps.map((step, idx) => (+ <StepRow+ key={`${step.node_id}-${idx}`}+ step={step}+ index={idx}+ liveStatus={liveStatuses[step.node_id]}+ inputItems={idx > 0 ? normalizeItems(run.steps[idx - 1].output) : undefined}+ />+ ))}+ </ol>+ )}+ </div>+ </>+ )}+ </div></>);diff --git a/app/src/components/flows/FlowRunsSidebar.tsx b/app/src/components/flows/FlowRunsSidebar.tsxindex 8addb65ecf..0e997d08fb 100644--- a/app/src/components/flows/FlowRunsSidebar.tsx+++ b/app/src/components/flows/FlowRunsSidebar.tsx@@ -220,11 +220,11 @@ export default function FlowRunsSidebar({</div>{!controlled && (- <FlowRunInspectorDrawer- runId={selectedRunId}- onClose={() => setSelectedRunId(null)}- onFixWithAgent={handleFixWithAgent}- />+ <FlowRunInspectorDrawer+ runId={selectedRunId}+ onClose={() => setSelectedRunId(null)}+ onFixWithAgent={handleFixWithAgent}+ />)}</div>);diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.tsindex 3b5a5ac388..45e6fe72ff 100644--- a/app/src/lib/i18n/en.ts+++ b/app/src/lib/i18n/en.ts@@ -4888,6 +4888,7 @@ const en: TranslationMap = {// The palette tab is labelled "Manual" (build by hand) as the counterpart to// the AI "Copilot" tab; the key name stays `legendTab` for the node palette.'flows.canvas.legendTab': 'Manual',+ 'flows.canvas.runTab': 'Run','flows.canvas.toolbar': 'Canvas controls','flows.canvas.zoomIn': 'Zoom in','flows.canvas.zoomOut': 'Zoom out',diff --git a/app/src/pages/FlowCanvasPage.tsx b/app/src/pages/FlowCanvasPage.tsxindex 3ecbd9ce2e..b22aa3c652 100644--- a/app/src/pages/FlowCanvasPage.tsx+++ b/app/src/pages/FlowCanvasPage.tsx@@ -19,7 +19,7 @@*/import type { Viewport } from '@xyflow/react';import createDebug from 'debug';-import { Blocks, PanelRightClose, Sparkles } from 'lucide-react';+import { Blocks, ChevronLeft, History, PanelRightClose, Sparkles } from 'lucide-react';import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';import { useLocation, useNavigate, useParams } from 'react-router-dom';@@ -30,6 +30,7 @@ import type {import FlowCanvas from '../components/flows/canvas/FlowCanvas';import NodePalette from '../components/flows/canvas/NodePalette';import { FlowPreauthorizationOverlay } from '../components/flows/FlowPreauthorizationCard';+import { FlowRunInspectorDrawer } from '../components/flows/FlowRunInspectorDrawer';import FlowRunsSidebar from '../components/flows/FlowRunsSidebar';import WorkflowCopilotPanel, {type RepairPromptContext,@@ -174,7 +175,7 @@ const log = createDebug('app:flows:canvas');const RUN_ERROR_AUTO_DISMISS_MS = 12_000;/** Which panel (if any) the canvas side rail shows. Driven by the header toggle. */-type SidePanel = 'copilot' | 'legend' | null;+type SidePanel = 'copilot' | 'legend' | 'run' | null;type LoadState =| { status: 'loading' }@@ -455,6 +456,8 @@ function FlowEditor({// Copilot is shown by DEFAULT (and any build/prefill/repair seed also targets// it); the user can switch to the Legend or collapse the rail entirely.const [sidePanel, setSidePanel] = useState<SidePanel>('copilot');+ /** The run picked in the sidebar's run list, shown in the side panel's Run tab. */+ const [inspectRunId, setInspectRunId] = useState<string | null>(null);const copilotOpen = sidePanel === 'copilot';// Issue B22: a repair seed can also arrive WITHOUT a `FlowEditor` remount —// "Fix with agent" clicked from `FlowRunsSidebar` stays on this same@@ -1105,7 +1108,7 @@ function FlowEditor({size="sm"value={sidePanel ?? ''}onValueChange={next => {- if (next === 'copilot' || next === 'legend') setSidePanel(next);+ if (next === 'copilot' || next === 'legend' || next === 'run') setSidePanel(next);}}aria-label={t('flows.canvas.sidePanelToggle')}className="rounded-lg border border-line bg-surface-muted/50 p-0.5">@@ -1123,6 +1126,15 @@ function FlowEditor({<Blocks className="h-3.5 w-3.5" aria-hidden />{t('flows.canvas.legendTab')}</ToggleGroupItem>+ {inspectRunId && (+ <ToggleGroupItem+ value="run"+ data-testid="flow-canvas-run-toggle"+ className="gap-1.5 border-0 bg-transparent data-[state=on]:bg-primary-500/10 data-[state=on]:text-primary-600 dark:data-[state=on]:text-primary-300">+ <History className="h-3.5 w-3.5" aria-hidden />+ {t('flows.canvas.runTab')}+ </ToggleGroupItem>+ )}</ToggleGroupRoot>);@@ -1221,17 +1233,42 @@ function FlowEditor({in the space the real one would have occupied, and it only existed at`lg` and up. Drafts have no runs yet, so they project nothing and theregion stays empty. */}- {!isDraft && flowId && (- <SidebarContent>- <div className="h-full overflow-hidden">- <FlowRunsSidebar flowId={flowId} />+ {/* The sidebar region carries the way back to the list (so the page title+ sits on the same left edge as every other page's, instead of being+ pushed in by a leading back button) and, for a saved flow, its runs.+ Picking a run loads it into the side panel's Run tab. */}+ <SidebarContent>+ <div className="flex h-full flex-col overflow-hidden">+ <div className="shrink-0 px-3 pb-2">+ <Button+ type="button"+ variant="tertiary"+ data-testid="flow-canvas-back"+ aria-label={t('flows.canvas.backToList')}+ leadingIcon={<ChevronLeft className="h-4 w-4" aria-hidden />}+ className="h-auto w-full justify-start gap-2 rounded-md px-2.5 py-1.5 text-[13px] font-normal text-content-muted hover:bg-surface/40 hover:text-content-secondary"+ onClick={handleBack}>+ {t('flows.canvas.backToList')}+ </Button></div>- </SidebarContent>- )}+ {!isDraft && flowId && (+ <div className="min-h-0 flex-1">+ <FlowRunsSidebar+ flowId={flowId}+ selectedRunId={sidePanel === 'run' ? inspectRunId : null}+ onSelectRun={runId => {+ log('runs sidebar: inspecting run=%s in side panel', runId);+ setInspectRunId(runId);+ setSidePanel('run');+ }}+ />+ </div>+ )}+ </div>+ </SidebarContent><SettingsTabbedPagetitle={titleNode}description={t('flows.canvas.description')}- leading={backButton}headerAction={headerActions}scrollable={false}// No full-bleed: the canvas and the side panel are two framed cards in@@ -1336,6 +1373,30 @@ function FlowEditor({)}</header><div className="min-h-0 flex-1">+ {sidePanel === 'run' && inspectRunId && (+ <FlowRunInspectorDrawer+ variant="panel"+ runId={inspectRunId}+ onClose={() => {+ setInspectRunId(null);+ setSidePanel('copilot');+ }}+ onFixWithAgent={request => {+ log('fix with agent from run panel: run=%s', request.runId);+ setInspectRunId(null);+ navigate(`/flows/${request.flowId}`, {+ replace: true,+ state: {+ copilotRepair: {+ runId: request.runId,+ error: request.error,+ failingNodeIds: request.failingNodeIds,+ },+ },+ });+ }}+ />+ )}{sidePanel === 'legend' && (<NodePalettevariant="panel"