From 051c9d1d288908f37d9a0ab664bc595912802867 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 17:16:26 +0000 Subject: [PATCH 1/2] fix(console): a screen run finished from Flow Runs no longer reads as paused The Test Run panel kept the trigger's paused answer after the runner completed the run, so it still said "Waiting for input" and offered a "Continue run" that resumed a run the server no longer holds. On completion the panel now re-reads the run and shows it as the result. Claude-Session: https://claude.ai/code/session_01ADHkmSmRojhM8vYjHkVSeg Co-authored-by: Claude --- .../src/pages/developer/FlowRunsPage.test.tsx | 44 +++++++++++++++++-- .../src/pages/developer/FlowRunsPage.tsx | 32 +++++++++++++- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/ui/apps/console/src/pages/developer/FlowRunsPage.test.tsx b/ui/apps/console/src/pages/developer/FlowRunsPage.test.tsx index 89a6355db80..442559cde48 100644 --- a/ui/apps/console/src/pages/developer/FlowRunsPage.test.tsx +++ b/ui/apps/console/src/pages/developer/FlowRunsPage.test.tsx @@ -18,7 +18,7 @@ import userEvent from '@testing-library/user-event'; // Hoisted so the vi.mock factories below can close over them, and so the // adapter is a STABLE singleton (a fresh object per render loops the page's // fetch effects). -const { execute, ADAPTER, authFetch } = vi.hoisted(() => { +const { execute, getRun, ADAPTER, authFetch } = vi.hoisted(() => { const flow = { name: 'reassign_wizard', label: 'Reassign', @@ -38,11 +38,22 @@ const { execute, ADAPTER, authFetch } = vi.hoisted(() => { fields: [{ name: 'new_assignee', label: 'New Assignee', type: 'text', required: true }], }, })); + // The run row as the server records it once the resume finished it. + const getRun = vi.fn(async () => ({ + id: 'run_1', + flowName: 'reassign_wizard', + status: 'completed', + trigger: { type: 'manual' }, + steps: [], + startedAt: '2026-11-15T00:00:00.000Z', + completedAt: '2026-11-15T00:00:01.000Z', + durationMs: 1000, + })); const ADAPTER = { getClient: () => ({ // The served list item IS the flow definition (objectui#12829). meta: { getItems: async (type: string) => (type === 'flow' ? [flow] : []) }, - automation: { execute, listRuns: async () => ({ runs: [] }) }, + automation: { execute, getRun, listRuns: async () => ({ runs: [] }) }, }), }; const authFetch = vi.fn(async () => @@ -51,7 +62,7 @@ const { execute, ADAPTER, authFetch } = vi.hoisted(() => { headers: { 'Content-Type': 'application/json' }, }), ); - return { execute, ADAPTER, authFetch }; + return { execute, getRun, ADAPTER, authFetch }; }); vi.mock('@object-ui/app-shell', async (importOriginal) => { @@ -76,6 +87,7 @@ import { FlowRunsPage } from './FlowRunsPage'; beforeEach(() => { execute.mockClear(); + getRun.mockClear(); authFetch.mockClear(); }); afterEach(cleanup); @@ -146,3 +158,29 @@ describe('Flow Runs — screen flows are completable from the Test Run panel', ( expect(reopened.queryByText('reassign_wizard')).not.toBeInTheDocument(); }); }); + +describe('Flow Runs — a screen run completed from the Test Run panel stops reading as paused', () => { + it('shows the completed run and drops "Waiting for input" and "Continue run"', async () => { + const user = userEvent.setup(); + render(); + + await screen.findByRole('button', { name: /Run Flow/i }); + await user.click(screen.getByRole('button', { name: /Run Flow/i })); + await screen.findByRole('dialog'); + // The pause is what the panel reads before the run is finished. + expect(screen.getByText('Waiting for input')).toBeInTheDocument(); + + const textboxes = screen.getAllByRole('textbox'); + await user.type(textboxes[textboxes.length - 1], 'ada@example.com'); + await user.click(screen.getByRole('button', { name: 'Submit' })); + await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument()); + + // The panel re-reads the run the runner finished and shows it as the result. + await waitFor(() => expect(getRun).toHaveBeenCalledWith('reassign_wizard', 'run_1')); + expect(await screen.findByText('Result')).toBeInTheDocument(); + expect(screen.getByText(/"status": "completed"/)).toBeInTheDocument(); + expect(screen.queryByText('Waiting for input')).not.toBeInTheDocument(); + expect(screen.queryByText(/This run is paused at screen/)).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /Continue run/i })).not.toBeInTheDocument(); + }); +}); diff --git a/ui/apps/console/src/pages/developer/FlowRunsPage.tsx b/ui/apps/console/src/pages/developer/FlowRunsPage.tsx index 6f5b4ff4dad..8c147b87b68 100644 --- a/ui/apps/console/src/pages/developer/FlowRunsPage.tsx +++ b/ui/apps/console/src/pages/developer/FlowRunsPage.tsx @@ -16,7 +16,7 @@ * from here too. */ -import { useEffect, useMemo, useState, useCallback } from 'react'; +import { useEffect, useMemo, useRef, useState, useCallback } from 'react'; import { useDisplayLocale, useObjectTranslation } from '@object-ui/i18n'; import { ConsolePageHeader, useAdapter, useMetadata, FlowRunner, type ScreenFlowState, DeveloperNamespaceGate } from '@object-ui/app-shell'; import { createAuthenticatedFetch } from '@object-ui/auth'; @@ -367,8 +367,12 @@ function FlowTestRunner({ // The paused screen a test run stopped at — driven to completion by // , exactly as a `type: 'flow'` action would. const [screenFlow, setScreenFlow] = useState(null); + // Bumped by every new run and flow switch: a completed run's re-read that + // lands after either belongs to a panel the tester has already left. + const runGeneration = useRef(0); useEffect(() => { + runGeneration.current += 1; setValues({}); setResult(null); setError(null); @@ -382,6 +386,7 @@ function FlowTestRunner({ setError({ unavailable: 'automation.execute' }); return; } + runGeneration.current += 1; setRunning(true); setError(null); setResult(null); @@ -410,6 +415,29 @@ function FlowTestRunner({ } }; + // The runner drove the paused run to completion. The trigger answer in + // `result` still describes the pause, and its screen no longer exists on the + // server, so it is replaced by the run as the server now records it: the + // panel reads the run's final status and offers no "Continue run". + const handleComplete = async () => { + const runId = screenFlow?.runId ?? result?.runId; + const generation = runGeneration.current; + setScreenFlow(null); + setResult(null); + onExecuted?.(); + if (!runId) return; + if (!client?.automation?.getRun) { + setError({ unavailable: 'automation.getRun' }); + return; + } + try { + const res: any = await client.automation.getRun(flow.name, runId); + if (generation === runGeneration.current) setResult(res?.run ?? res); + } catch (e: any) { + if (generation === runGeneration.current) setError({ message: e?.message ?? String(e) }); + } + }; + return ( @@ -527,7 +555,7 @@ function FlowTestRunner({ dataSource={adapter} objects={objects} onClose={() => { setScreenFlow(null); onExecuted?.(); }} - onComplete={() => { setScreenFlow(null); onExecuted?.(); }} + onComplete={handleComplete} /> ); From 716f3666db139748c254273ce5b357a27663294e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 17:27:25 +0000 Subject: [PATCH 2/2] chore(changeset): console Flow Runs completed screen run Claude-Session: https://claude.ai/code/session_01ADHkmSmRojhM8vYjHkVSeg Co-authored-by: Claude --- .changeset/33856-flow-runs-completed-run.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/33856-flow-runs-completed-run.md diff --git a/.changeset/33856-flow-runs-completed-run.md b/.changeset/33856-flow-runs-completed-run.md new file mode 100644 index 00000000000..796189dcba8 --- /dev/null +++ b/.changeset/33856-flow-runs-completed-run.md @@ -0,0 +1,10 @@ +--- +'@object-ui/console': patch +--- + +fix(console): a screen run finished from the Flow Runs test panel no longer reads as paused + +Clause-②: no +Metadata-protocol: none + +On the developer Flow Runs page, a screen flow's test run that the runner drove to completion left the Test Run panel showing the trigger's paused answer: "Waiting for input", "This run is paused at screen …" and a "Continue run" button. Continuing reopened the old screen, and submitting it answered 404 `RUN_NOT_FOUND`, because the server no longer holds a suspended run. When the runner completes the run, the panel now reads the run back (`automation.getRun`) and shows it as the result, with its final status and duration, and offers no "Continue run". A run the tester dismisses while it is still paused keeps its "Continue run", as before.