Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(wizard): slow down run discovery polling and back off after failures (#130252)

Fernando Gomes352a15ee28cf
diff --git a/products/wizard/backend/facade/contracts.py b/products/wizard/backend/facade/contracts.py
index a208ee7fafc6..8cf85bbba3d9 100644
--- a/products/wizard/backend/facade/contracts.py
+++ b/products/wizard/backend/facade/contracts.py
@@ -243,6 +243,7 @@ class ListWizardRunsInput:
team_id: int
statuses: tuple[WizardRunStatus, ...] = ()
created_after: datetime | None = None
+ created_by_id: int | None = None
@frozen
diff --git a/products/wizard/backend/logic/runs/store.py b/products/wizard/backend/logic/runs/store.py
index 74b4dcd182ee..daf4723cdcc9 100644
--- a/products/wizard/backend/logic/runs/store.py
+++ b/products/wizard/backend/logic/runs/store.py
@@ -186,6 +186,8 @@ def list_runs(params: ListWizardRunsInput, page: PageRequest) -> Page[WizardRunD
runs = runs.filter(status__in=params.statuses)
if params.created_after is not None:
runs = runs.filter(created_at__gt=params.created_after)
+ if params.created_by_id is not None:
+ runs = runs.filter(created_by_id=params.created_by_id)
rows = select_page(runs, page)
results: list[WizardRunDTO] = []
for run in rows.results:
diff --git a/products/wizard/backend/presentation/runs/views.py b/products/wizard/backend/presentation/runs/views.py
index b6e4a2ed1ada..c7be90635a04 100644
--- a/products/wizard/backend/presentation/runs/views.py
+++ b/products/wizard/backend/presentation/runs/views.py
@@ -87,6 +87,11 @@ class WizardRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
type=datetime,
description="Only return runs created after this timestamp.",
),
+ OpenApiParameter(
+ name="created_by_id",
+ type=int,
+ description="Only return runs created by this user.",
+ ),
],
description="List Wizard runs for this project, ordered from newest to oldest.",
)
@@ -105,7 +110,15 @@ class WizardRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
if raw_created_after is not None
else None
)
- filters = ListWizardRunsInput(team_id=self.team_id, statuses=statuses, created_after=created_after)
+ raw_created_by_id = request.query_params.get("created_by_id")
+ created_by_id = (
+ cast(int, serializers.IntegerField().run_validation(raw_created_by_id))
+ if raw_created_by_id is not None
+ else None
+ )
+ filters = ListWizardRunsInput(
+ team_id=self.team_id, statuses=statuses, created_after=created_after, created_by_id=created_by_id
+ )
return facade_page_response(
self, lambda page: wizard_facade.list_runs(filters, page), serializer_class=WizardRunSerializer
)
diff --git a/products/wizard/backend/tests/runs/test_presentation.py b/products/wizard/backend/tests/runs/test_presentation.py
index 2fddcb6deaf5..942d8928615d 100644
--- a/products/wizard/backend/tests/runs/test_presentation.py
+++ b/products/wizard/backend/tests/runs/test_presentation.py
@@ -182,6 +182,15 @@ class TestWizardRunViewSet(APIBaseTest):
invalid_date_response = self.client.get(f"{self._url()}?created_after=invalid")
self.assertEqual(invalid_date_response.status_code, status.HTTP_400_BAD_REQUEST)
+ other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
+ WizardRun.objects.for_team(self.team.id).filter(id=run_ids[1]).update(created_by=other_user)
+ own_response = self.client.get(f"{self._url()}?created_by_id={self.user.id}")
+ self.assertEqual(own_response.status_code, status.HTTP_200_OK)
+ self.assertEqual([run["id"] for run in own_response.json()["results"]], [run_ids[2], run_ids[0]])
+
+ invalid_user_response = self.client.get(f"{self._url()}?created_by_id=me")
+ self.assertEqual(invalid_user_response.status_code, status.HTTP_400_BAD_REQUEST)
+
def test_create_requires_program_id(self) -> None:
response = self.client.post(
self._url(),
diff --git a/products/wizard/frontend/generated/api.schemas.ts b/products/wizard/frontend/generated/api.schemas.ts
index 5e63d535588a..17aaf149e2f0 100644
--- a/products/wizard/frontend/generated/api.schemas.ts
+++ b/products/wizard/frontend/generated/api.schemas.ts
@@ -900,6 +900,10 @@ export type WizardRunsListParams = {
* Only return runs created after this timestamp.
*/
created_after?: string
+ /**
+ * Only return runs created by this user.
+ */
+ created_by_id?: number
/**
* Number of results to return per page.
* @maximum 100
diff --git a/products/wizard/frontend/logics/wizardRunSyncLogic.test.ts b/products/wizard/frontend/logics/wizardRunSyncLogic.test.ts
index 3e8cc813f510..ea1c3e2e65ef 100644
--- a/products/wizard/frontend/logics/wizardRunSyncLogic.test.ts
+++ b/products/wizard/frontend/logics/wizardRunSyncLogic.test.ts
@@ -3,6 +3,8 @@ import { installMockEventSource, MockEventSource } from 'lib/wizard-sync/eventSo
import { expectLogic } from 'kea-test-utils'
+import { ApiError } from 'lib/api-error'
+
import { initKeaTests } from '~/test/init'
import { wizardRunsList, wizardRunsRetrieve, wizardRunsTasksRetrieve } from '../generated/api'
@@ -74,6 +76,7 @@ describe('wizardRunSyncLogic', () => {
await expectLogic(logic).toFinishAllListeners()
expect(mockWizardRunsList).toHaveBeenCalledWith('1', {
+ created_by_id: MOCK_DEFAULT_USER.id,
limit: 100,
offset: 0,
})
@@ -144,6 +147,7 @@ describe('wizardRunSyncLogic', () => {
logic.actions.watchRuns('test', ['next'])
await expectLogic(logic).toFinishAllListeners()
expect(mockWizardRunsList).toHaveBeenCalledWith('1', {
+ created_by_id: MOCK_DEFAULT_USER.id,
limit: 100,
offset: 0,
})
@@ -195,16 +199,24 @@ describe('wizardRunSyncLogic', () => {
.mockResolvedValueOnce({ results: [run('second')], next: null })
logic.actions.checkRuns()
await expectLogic(logic).toFinishAllListeners()
- expect(mockWizardRunsList).toHaveBeenLastCalledWith('1', { limit: 100, offset: 100 })
+ expect(mockWizardRunsList).toHaveBeenLastCalledWith('1', {
+ created_by_id: MOCK_DEFAULT_USER.id,
+ limit: 100,
+ offset: 100,
+ })
expect(logic.values.userRuns.map((run) => run.id)).toEqual(['first', 'second'])
const previousCalls = mockWizardRunsList.mock.calls.length
mockWizardRunsList.mockResolvedValue({ results: [run('first')], next: '/next' })
for (let poll = 0; poll < 6; poll++) {
- jest.advanceTimersByTime(5_000)
+ jest.advanceTimersByTime(60_000)
await expectLogic(logic).toFinishAllListeners()
}
expect(mockWizardRunsList.mock.calls.length - previousCalls).toBe(6)
- expect(mockWizardRunsList).toHaveBeenLastCalledWith('1', { limit: 100, offset: 0 })
+ expect(mockWizardRunsList).toHaveBeenLastCalledWith('1', {
+ created_by_id: MOCK_DEFAULT_USER.id,
+ limit: 100,
+ offset: 0,
+ })
expect(logic.values.userRuns.map((run) => run.id)).toEqual(['first', 'second'])
})
@@ -225,8 +237,9 @@ describe('wizardRunSyncLogic', () => {
const previousCalls = mockWizardRunsList.mock.calls.length
if (trigger === 'poll') {
- jest.advanceTimersByTime(5_000)
+ jest.advanceTimersByTime(60_000)
} else {
+ jest.advanceTimersByTime(30_000)
window.dispatchEvent(new Event('focus'))
}
await expectLogic(logic).toFinishAllListeners()
@@ -236,6 +249,101 @@ describe('wizardRunSyncLogic', () => {
}
)
+ it('polls on an interval only while the user has runs', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+ logic.unmount()
+ jest.useFakeTimers()
+ mockWizardRunsList.mockReset()
+ mockWizardRunsList.mockResolvedValue({ results: [], next: null })
+ logic = wizardRunSyncLogic({ projectId: '1' })
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(1)
+
+ jest.advanceTimersByTime(180_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(1)
+
+ window.dispatchEvent(new Event('focus'))
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(2)
+
+ logic.actions.awaitRuns('onboarding', true)
+ jest.advanceTimersByTime(5_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(3)
+
+ logic.actions.awaitRuns('onboarding', false)
+ jest.advanceTimersByTime(60_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(3)
+ })
+
+ it('keeps retrying the first list on the interval until it succeeds', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+ logic.unmount()
+ jest.useFakeTimers()
+ mockWizardRunsList.mockReset()
+ mockWizardRunsList.mockRejectedValueOnce(new Error('offline')).mockResolvedValue({ results: [], next: null })
+ logic = wizardRunSyncLogic({ projectId: '1' })
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(1)
+
+ jest.advanceTimersByTime(60_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(2)
+
+ jest.advanceTimersByTime(120_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(2)
+ })
+
+ it.each([
+ ['a Retry-After header', new ApiError('Throttled', 429, new Headers({ 'Retry-After': '60' })), 60_000],
+ ['no retry hint', new Error('offline'), 30_000],
+ ])('waits out a failed run check with %s before any trigger retries it', async (_, error, delayMs) => {
+ await expectLogic(logic).toFinishAllListeners()
+ logic.unmount()
+ jest.useFakeTimers()
+ mockWizardRunsList.mockReset()
+ mockWizardRunsList.mockRejectedValue(error)
+ logic = wizardRunSyncLogic({ projectId: '1' })
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(1)
+
+ jest.advanceTimersByTime(delayMs - 1_000)
+ for (let attempt = 0; attempt < 5; attempt++) {
+ window.dispatchEvent(new Event('focus'))
+ logic.actions.checkRuns(true)
+ await expectLogic(logic).toFinishAllListeners()
+ }
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(1)
+
+ mockWizardRunsList.mockResolvedValue({ results: [run('newer')], next: null })
+ jest.advanceTimersByTime(1_000)
+ window.dispatchEvent(new Event('focus'))
+ await expectLogic(logic).toFinishAllListeners()
+ expect(mockWizardRunsList).toHaveBeenCalledTimes(2)
+ expect(logic.values.userRuns.map((run) => run.id)).toEqual(['newer'])
+ })
+
+ it('does not open a stream for a run that has not started', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+ const created = { ...run('created'), status: 'created' as const }
+ mockRunPages({ count: 2, results: [created] })
+ logic.actions.checkRuns()
+ await expectLogic(logic).toFinishAllListeners()
+ logic.actions.watchRuns('test', ['created'])
+ expect(MockEventSource.instances.filter((stream) => stream.readyState !== MockEventSource.CLOSED)).toEqual([])
+
+ jest.mocked(wizardRunsRetrieve).mockResolvedValueOnce({ ...created, status: 'running' })
+ logic.actions.refreshWatchedRun()
+ await expectLogic(logic).toFinishAllListeners()
+ expect(MockEventSource.last().url).toBe('/api/projects/1/wizard/runs/created/stream/')
+ })
+
it('keeps a new creation response when an older full-history poll finishes afterward', async () => {
await expectLogic(logic).toFinishAllListeners()
let resolvePoll!: (page: { results: WizardRunApi[]; next: null }) => void
diff --git a/products/wizard/frontend/logics/wizardRunSyncLogic.ts b/products/wizard/frontend/logics/wizardRunSyncLogic.ts
index 021dc6ac862b..f3ee3e7ee81a 100644
--- a/products/wizard/frontend/logics/wizardRunSyncLogic.ts
+++ b/products/wizard/frontend/logics/wizardRunSyncLogic.ts
@@ -13,6 +13,7 @@ import {
selectors,
} from 'kea'
+import { ApiError } from 'lib/api-error'
import { userLogic } from 'scenes/userLogic'
import type { UserType } from '~/types'
@@ -33,7 +34,12 @@ import { loadWizardRunArtifacts } from '../lib/wizardApi'
import { wizardRunIsActive } from '../lib/wizardRunDisplay'
const RUN_POLL_MS = 30_000
-const RUN_DISCOVERY_POLL_MS = 5_000
+// Discovery only finds runs started outside this tab (the CLI). Streams and refreshWatchedRun cover active runs,
+// so it can be slow: a user with no runs is checked on focus only, a user with runs once a minute. A view that
+// is waiting for a CLI run to appear (onboarding) opts into the fast tick with awaitRuns.
+const RUN_DISCOVERY_TICK_MS = 5_000
+const RUN_DISCOVERY_POLL_MS = 60_000
+const RUN_DISCOVERY_MIN_GAP_MS = 30_000
const RUN_LIST_LIMIT = 100
// Leave HTTP/1.1 connections available for requests and other app streams.
@@ -45,6 +51,11 @@ type RunStreamState = Pick<
> &
WizardRunTaskListApi
+function checkRunsRetryDelayMs(error: unknown): number {
+ const retryAfterSeconds = error instanceof ApiError ? Number(error.headers?.get('Retry-After')) : NaN
+ return retryAfterSeconds > 0 ? retryAfterSeconds * 1000 : RUN_POLL_MS
+}
+
function streamRunPatch(state: RunStreamState): Partial<WizardRunApi> {
return {
status: state.status,
@@ -72,6 +83,8 @@ export interface wizardRunSyncLogicValues {
userRuns: WizardRunApi[]
activeUserRuns: WizardRunApi[]
watchedRunIds: Record<string, string[]>
+ awaitingRunSources: Record<string, boolean>
+ awaitingRuns: boolean
activeWatchedRuns: WizardRunApi[]
tasksByRunId: Record<string, readonly WizardRunTaskApi[]>
artifactsByRunId: Record<string, WizardRunArtifactApi[]>
@@ -102,6 +115,7 @@ export interface wizardRunSyncLogicActions {
runDataFailed: (runId: string) => { runId: string }
connectRuns: () => { value: true }
watchRuns: (source: string, runIds: string[]) => { source: string; runIds: string[] }
+ awaitRuns: (source: string, waiting: boolean) => { source: string; waiting: boolean }
refreshWatchedRun: () => { value: true }
}
@@ -127,6 +141,7 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
runDataFailed: (runId: string) => ({ runId }),
connectRuns: true,
watchRuns: (source: string, runIds: string[]) => ({ source, runIds }),
+ awaitRuns: (source: string, waiting: boolean) => ({ source, waiting }),
refreshWatchedRun: true,
}),
reducers({
@@ -134,6 +149,10 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
{} as Record<string, string[]>,
{ watchRuns: (state, { source, runIds }) => ({ ...state, [source]: runIds }) },
],
+ awaitingRunSources: [
+ {} as Record<string, boolean>,
+ { awaitRuns: (state, { source, waiting }) => ({ ...state, [source]: waiting }) },
+ ],
runs: [
[] as WizardRunApi[],
{
@@ -193,6 +212,10 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
user ? runs.filter((run) => run.created_by_id === user.id) : [],
],
activeUserRuns: [(s) => [s.userRuns], (runs: WizardRunApi[]): WizardRunApi[] => runs.filter(wizardRunIsActive)],
+ awaitingRuns: [
+ (s) => [s.awaitingRunSources],
+ (sources: Record<string, boolean>): boolean => Object.values(sources).some(Boolean),
+ ],
activeWatchedRuns: [
(s) => [s.runs, s.watchedRunIds],
(runs: WizardRunApi[], watched: Record<string, string[]>): WizardRunApi[] => {
@@ -205,10 +228,13 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
}),
listeners(({ actions, cache, props: logicProps, values }) => ({
checkRuns: async ({ recentOnly }) => {
- if (cache.checking || !logicProps.projectId || !values.user) {
+ // Focus, stream updates and user reloads all call this, so only a shared cooldown keeps
+ // them from retrying a throttled list request back to back.
+ if (cache.checking || !logicProps.projectId || !values.user || Date.now() < cache.checkRunsBlockedUntil) {
return
}
cache.checking = true
+ cache.lastCheckStartedAt = Date.now()
const disposables = cache.disposables
const knownRunIds = new Set(values.runs.map((run) => run.id))
try {
@@ -216,6 +242,7 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
let offset = 0
while (true) {
const page = await wizardRunsList(logicProps.projectId, {
+ created_by_id: values.user.id,
limit: RUN_LIST_LIMIT,
offset,
})
@@ -237,7 +264,8 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
if (!recentOnly) {
cache.historyLoaded = true
}
- } catch {
+ } catch (error) {
+ cache.checkRunsBlockedUntil = Date.now() + checkRunsRetryDelayMs(error)
return
} finally {
cache.checking = false
@@ -334,7 +362,10 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
}
},
connectRuns: () => {
- const streamedRuns = values.activeWatchedRuns.slice(0, MAX_RUN_STREAMS)
+ // A created run has no worker yet, so its stream would sit idle. refreshWatchedRun picks up the transition.
+ const streamedRuns = values.activeWatchedRuns
+ .filter((run) => run.status === 'running')
+ .slice(0, MAX_RUN_STREAMS)
const activeRunIds = streamedRuns.map((run) => run.id)
const connectedRunIds: string[] = cache.connectedRunIds ?? []
@@ -366,24 +397,41 @@ export const wizardRunSyncLogic: LogicWrapper<wizardRunSyncLogicType> = kea<wiza
}
},
})),
- events(({ actions, cache }) => ({
+ events(({ actions, cache, values }) => ({
afterMount: () => {
cache.runDataVersions = {}
cache.runDataRequests = {}
cache.runDataFailures = {}
+ cache.checkRunsBlockedUntil = 0
+ cache.lastCheckStartedAt = 0
actions.checkRuns()
cache.disposables.add(() => {
const timer = window.setInterval(() => actions.refreshWatchedRun(), RUN_POLL_MS)
return () => window.clearInterval(timer)
}, 'active-run-poll')
cache.disposables.add(() => {
- const discoverRuns = (): void => actions.checkRuns(true)
- const timer = window.setInterval(discoverRuns, RUN_DISCOVERY_POLL_MS)
- window.addEventListener('focus', discoverRuns)
- discoverRuns()
+ const discoverRuns = (minGapMs: number, recentOnly = true): void => {
+ if (Date.now() - cache.lastCheckStartedAt >= minGapMs) {
+ actions.checkRuns(recentOnly)
+ }
+ }
+ const onFocus = (): void => discoverRuns(RUN_DISCOVERY_MIN_GAP_MS)
+ const timer = window.setInterval(() => {
+ if (values.awaitingRuns) {
+ discoverRuns(0)
+ } else if (!cache.historyLoaded) {
+ // Until one full list succeeds, an empty userRuns only means the first request failed.
+ discoverRuns(RUN_DISCOVERY_POLL_MS, false)
+ } else if (values.userRuns.length) {
+ discoverRuns(RUN_DISCOVERY_POLL_MS)
+ }
+ }, RUN_DISCOVERY_TICK_MS)
+ window.addEventListener('focus', onFocus)
+ // The disposable re-runs this setup when a hidden tab becomes visible, which is the catch-up check.
+ onFocus()
return () => {
window.clearInterval(timer)
- window.removeEventListener('focus', discoverRuns)
+ window.removeEventListener('focus', onFocus)
}
}, 'run-discovery-poll')
},
diff --git a/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.test.ts b/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.test.ts
index 12c398d8af25..b85a4550c36f 100644
--- a/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.test.ts
+++ b/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.test.ts
@@ -69,9 +69,34 @@ describe('onboardingWizardRunLogic', () => {
logic.unmount()
restoreEventSource()
jest.restoreAllMocks()
+ jest.useRealTimers()
localStorage.clear()
})
+ it('polls for the installation run every few seconds until it appears', async () => {
+ await expectLogic(logic).toFinishAllListeners()
+ logic.unmount()
+ jest.useFakeTimers()
+ logic = onboardingWizardRunLogic(props)
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+ const listCalls = jest.mocked(wizardRunsList).mock.calls.length
+
+ jest.advanceTimersByTime(5_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(jest.mocked(wizardRunsList).mock.calls.length).toBe(listCalls + 1)
+
+ jest.mocked(wizardRunsList).mockResolvedValue({ count: 1, results: [run], next: null })
+ jest.advanceTimersByTime(5_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(logic.values.run?.id).toBe(run.id)
+
+ const callsAfterFound = jest.mocked(wizardRunsList).mock.calls.length
+ jest.advanceTimersByTime(30_000)
+ await expectLogic(logic).toFinishAllListeners()
+ expect(jest.mocked(wizardRunsList).mock.calls.length).toBe(callsAfterFound)
+ })
+
it('ignores history, audits, and other users, then saves the installation and supersedes it with a newer one', async () => {
await expectLogic(logic).toFinishAllListeners()
const sync = wizardRunSyncLogic({ projectId: '1' })
diff --git a/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.ts b/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.ts
index 333246926272..ddb0a8599f96 100644
--- a/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.ts
+++ b/products/wizard/frontend/views/onboarding/onboardingWizardRunLogic.ts
@@ -43,6 +43,7 @@ export interface onboardingWizardRunLogicActions {
acceptCreatedRun: (run: WizardRunApi) => { run: WizardRunApi }
loadRunData: (run: WizardRunApi) => { run: WizardRunApi }
watchRuns: (source: string, runIds: string[]) => { source: string; runIds: string[] }
+ awaitRuns: (source: string, waiting: boolean) => { source: string; waiting: boolean }
clickArtifact: (
artifact: WizardRunArtifactApi,
clickSource: WizardOnboardingArtifactClickSource
@@ -61,7 +62,7 @@ export const onboardingWizardRunLogic: LogicWrapper<onboardingWizardRunLogicType
path((key) => ['products', 'wizard', 'onboardingWizardRunLogic', key]),
connect(({ projectId }: OnboardingWizardRunProps) => ({
values: [wizardRunSyncLogic({ projectId }), ['userRuns']],
- actions: [wizardRunSyncLogic({ projectId }), ['loadRunData', 'watchRuns']],
+ actions: [wizardRunSyncLogic({ projectId }), ['loadRunData', 'watchRuns', 'awaitRuns']],
})),
actions({
initializeOnboarding: true,
@@ -135,6 +136,7 @@ export const onboardingWizardRunLogic: LogicWrapper<onboardingWizardRunLogicType
syncRun: () => {
const run = values.run
actions.watchRuns('onboarding', run ? [run.id] : [])
+ actions.awaitRuns('onboarding', !run)
if (!run) {
return
}
@@ -157,7 +159,10 @@ export const onboardingWizardRunLogic: LogicWrapper<onboardingWizardRunLogicType
}
cache.disposables.add(() => {
actions.syncRun()
- return () => actions.watchRuns('onboarding', [])
+ return () => {
+ actions.watchRuns('onboarding', [])
+ actions.awaitRuns('onboarding', false)
+ }
}, 'onboarding-run-watch')
}),
])
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 70f46e8db3f9..38c4ebb0bda7 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -137070,6 +137070,10 @@ export namespace Schemas {
* Only return runs created after this timestamp.
*/
created_after?: string;
+ /**
+ * Only return runs created by this user.
+ */
+ created_by_id?: number;
/**
* Number of results to return per page.
* @maximum 100