: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(flags): say when a refresh after an agent change fails (#107669)
James Gill78304d9379f3
diff --git a/frontend/src/initKea.ts b/frontend/src/initKea.tsindex 8b60fa9fa5c1..926c35efd7f7 100644--- a/frontend/src/initKea.ts+++ b/frontend/src/initKea.ts@@ -91,6 +91,7 @@ const ERROR_FILTER_ALLOW_LIST = ['loadSessionEventDeltas', // The experiment watch shelf renders the refusal, or the failure with a retry'loadLineage', // MetricLineagePanel renders every failure class itself, including the not-ready 404'loadSourceDocuments', // The knowledge source page renders its own retry banner for the indexed page list+ 'refreshFeatureFlag', // featureFlagLogic's refreshFeatureFlagFailure listener shows a notice with a reload'loadTableDetails', // The model detail summary renders its own error state with a retry'loadIntegrationAccounts', // The source wizard's account picker shows the error under the field with a reconnect link'loadCredentialAccounts', // Fires while the user types credentials; the account picker shows the error under the fielddiff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.test.tsindex 3cb7f44e11b0..2fad6ac72bb4 100644--- a/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts@@ -11,6 +11,7 @@ import { render } from '@testing-library/react'import { router } from 'kea-router'import { expectLogic, partial } from 'kea-test-utils'import posthog from 'posthog-js'+import { toast } from 'react-toastify'import { lemonToast as sharedLemonToast } from '@posthog/lemon-ui'@@ -243,6 +244,10 @@ describe('schedule timezone helpers', () => {describe('featureFlagLogic', () => {let logic: ReturnType<typeof featureFlagLogic.build>+ const FLAG_URL = `/api/projects/${MOCK_DEFAULT_PROJECT.id}/feature_flags/${MOCK_FEATURE_FLAG.id}/`+ // The shape drf-exceptions-hog returns. The `detail` is what the generic initKea toast renders,+ // so an empty body would let a silence or "one notice" assertion pass without suppression.+ const SERVER_ERROR_BODY = { type: 'server_error', code: 'error', detail: 'A server error occurred.' }beforeEach(async () => {useMocks({@@ -309,11 +314,24 @@ describe('featureFlagLogic', () => {featureFlagsLogic.unmount()})++ // The agent path surfaces its failures through this same loader, so its rethrow must not+ // reach this one.+ it('says nothing when the background refresh fails', async () => {+ useMocks({ get: { [FLAG_URL]: () => [500, SERVER_ERROR_BODY] } })++ // A payloadless refresh is the mount path; `afterMount` dispatches exactly this.+ await expectLogic(logic, () => logic.actions.refreshFeatureFlag())+ .toDispatchActions(['refreshFeatureFlagSuccess'])+ .toNotHaveDispatchedActions(['refreshFeatureFlagFailure'])+ .toFinishAllListeners()++ expect(lemonToast.error).not.toHaveBeenCalled()+ expect(lemonToast.info).not.toHaveBeenCalled()+ })})describe('refresh after a PostHog AI change', () => {- const FLAG_URL = `/api/projects/${MOCK_DEFAULT_PROJECT.id}/feature_flags/${MOCK_FEATURE_FLAG.id}/`-function serverFlagMock(flag: Record<string, any>): Parameters<typeof useMocks>[0] {return { get: { [FLAG_URL]: () => [200, { ...MOCK_FEATURE_FLAG, ...flag }] } }}@@ -423,48 +441,262 @@ describe('featureFlagLogic', () => {expect(logic.values.originalFeatureFlag?.name).toBe('second agent change')})- // The case above holds a refresh against a second refresh, which `breakpoint()` covers on- // its own. A mutation landing mid-request needs a separate guard, so it needs its own case.- it.each([- ['a toggle', (flag: FeatureFlagType) => logic.actions.updateFeatureFlagActiveSuccess(flag)],- // The inline tag and description saves and the cross-project toggle re-baseline without- // dispatching any loader success, so a guard keyed to those actions cannot see them.+ type MutationDuringRefresh = [string, (flag: FeatureFlagType) => void]++ // These update only the fields they persisted. The inline tag and description saves and the+ // cross-project toggle re-baseline without dispatching any loader success, so a guard keyed+ // to those actions cannot see them.+ const partialFoldsDuringRefresh: MutationDuringRefresh[] = [+ ['a toggle', (flag) => logic.actions.updateFeatureFlagActiveSuccess(flag)],['an inline field save',- (flag: FeatureFlagType) => {+ (flag) => {logic.actions.setFeatureFlag(flag)logic.actions.setOriginalFeatureFlag(flag)},],- ['a full reload', (flag: FeatureFlagType) => logic.actions.loadFeatureFlagSuccess(flag)],- ])('discards a refresh response that %s superseded', async (_label, mutate) => {- const response = deferred()- // The loader samples the mutation count before it calls the API, so mutating before the- // request is open would pass without exercising the guard.- const requestStarted = deferred()+ ]+ const fullReload: MutationDuringRefresh = [+ 'a full reload',+ (flag) => logic.actions.loadFeatureFlagSuccess(flag),+ ]+ const fullSave: MutationDuringRefresh = ['a full save', (flag) => logic.actions.saveFeatureFlagSuccess(flag)]- useMocks({- get: {- [FLAG_URL]: async () => {- requestStarted.resolve()- await response.promise- return [200, { ...MOCK_FEATURE_FLAG, name: 'agent change', active: true, version: 3 }]+ // The case above holds a refresh against a second refresh, which `breakpoint()` covers on+ // its own. A mutation landing mid-request needs a separate guard, so it needs its own case.+ it.each([...partialFoldsDuringRefresh, fullReload])(+ 'discards a refresh response that %s superseded',+ async (_label, mutate) => {+ const response = deferred()+ // The loader samples the mutation count before it calls the API, so mutating before the+ // request is open would pass without exercising the guard.+ const requestStarted = deferred()++ useMocks({+ get: {+ [FLAG_URL]: async () => {+ requestStarted.resolve()+ await response.promise+ return [200, { ...MOCK_FEATURE_FLAG, name: 'agent change', active: true, version: 3 }]+ },},- },+ })++ logic.actions.refreshFeatureFlagAfterAgentChange()+ await requestStarted.promise++ mutate({ ...MOCK_FEATURE_FLAG, active: false, version: 7 } as FeatureFlagType)+ expect(logic.values.featureFlag.active).toBe(false)++ response.resolve()+ await expectLogic(logic).toDispatchActions(['refreshFeatureFlagSuccess']).toFinishAllListeners()++ expect(logic.values.featureFlag.active).toBe(false)+ expect(logic.values.featureFlag.name).toBe('test-name')+ expect(logic.values.featureFlag.version).toBe(7)+ }+ )++ describe('when the request fails', () => {+ beforeEach(silenceKeaLoadersErrors)+ afterEach(resumeKeaLoadersErrors)++ // A flag GET held open until `failAfter` lands `mutate`, then answered with a 500. The loader+ // samples its counters before it calls the API, so mutating before the request is open would+ // pass without exercising the guard.+ function heldRefreshFailure(): {+ mocks: Parameters<typeof useMocks>[0]+ failAfter: (mutate: (flag: FeatureFlagType) => void) => Promise<void>+ } {+ const response = deferred()+ const requestStarted = deferred()+ return {+ mocks: {+ get: {+ [FLAG_URL]: async () => {+ requestStarted.resolve()+ await response.promise+ return [500, SERVER_ERROR_BODY]+ },+ },+ },+ failAfter: async (mutate) => {+ logic.actions.refreshFeatureFlagAfterAgentChange()+ await requestStarted.promise+ mutate({ ...MOCK_FEATURE_FLAG, active: false, version: 7 } as FeatureFlagType)+ response.resolve()+ },+ }+ }++ // The failure notice never closes on its own, so a failure that lands after a whole-flag+ // replacement would tell the reader a current page is stale until they act on it.+ it.each([fullReload, fullSave])('says nothing when a refresh fails after %s', async (_label, mutate) => {+ const held = heldRefreshFailure()+ useMocks(held.mocks)+ await held.failAfter(mutate)+ await expectLogic(logic)+ .toDispatchActions(['refreshFeatureFlagSuccess'])+ .toNotHaveDispatchedActions(['refreshFeatureFlagFailure'])+ .toFinishAllListeners()++ expect(lemonToast.error).not.toHaveBeenCalled()})- logic.actions.refreshFeatureFlagAfterAgentChange()- await requestStarted.promise+ // A partial fold leaves the page without the agent's other changes and carries the fresh+ // `version` into the form, so the next save passes the stale-write check and overwrites+ // them with no error. The notice is the only warning.+ it.each(partialFoldsDuringRefresh)('still says the refresh failed after %s', async (_label, mutate) => {+ const held = heldRefreshFailure()+ useMocks(held.mocks)+ await held.failAfter(mutate)+ await expectLogic(logic).toDispatchActions(['refreshFeatureFlagFailure']).toFinishAllListeners()- mutate({ ...MOCK_FEATURE_FLAG, active: false, version: 7 } as FeatureFlagType)- expect(logic.values.featureFlag.active).toBe(false)+ expect(lemonToast.error).toHaveBeenCalledTimes(1)+ })- response.resolve()- await expectLogic(logic).toDispatchActions(['refreshFeatureFlagSuccess']).toFinishAllListeners()+ // Silence here leaves the reader trusting a screen behind the server, then saving over it.+ it('says the refresh failed and retries it from the notice', async () => {+ useMocks({ get: { [FLAG_URL]: () => [500, SERVER_ERROR_BODY] } })- expect(logic.values.featureFlag.active).toBe(false)- expect(logic.values.featureFlag.name).toBe('test-name')- expect(logic.values.featureFlag.version).toBe(7)+ await expectLogic(logic, () => logic.actions.refreshFeatureFlagAfterAgentChange())+ .toDispatchActions(['refreshFeatureFlag', 'refreshFeatureFlagFailure'])+ .toFinishAllListeners()++ // One notice, not two: initKea's ERROR_FILTER_ALLOW_LIST names this action.+ expect(lemonToast.error).toHaveBeenCalledTimes(1)+ const [message, options] = jest.mocked(lemonToast.error).mock.calls[0]+ expect(message).toContain('could not load the new values')+ expect(options?.toastId).toBe('feature-flag-agent-refresh-failed-1-1')+ expect(options?.autoClose).toBe(false)+ expect(options?.button?.label).toBe('Try again')++ // A retry that fails again must not run the full loader, which would mark the flag+ // missing and swap the page for Not Found.+ await expectLogic(logic, () => void options?.button?.action())+ .toDispatchActions(['refreshFeatureFlag', 'refreshFeatureFlagFailure'])+ .toFinishAllListeners()++ expect(logic.values.featureFlagMissing).toBe(false)+ expect(lemonToast.error).toHaveBeenCalledTimes(2)+ const [, retryOptions] = jest.mocked(lemonToast.error).mock.calls[1]+ expect(retryOptions?.toastId).toBe('feature-flag-agent-refresh-failed-1-2')++ useMocks(serverFlagMock({ name: 'renamed by the agent' }))++ await expectLogic(logic, () => void retryOptions?.button?.action())+ .toDispatchActions(['refreshFeatureFlag', 'refreshFeatureFlagSuccess'])+ .toFinishAllListeners()++ expect(logic.values.featureFlag.name).toBe('renamed by the agent')+ })++ // The notice never closes on its own. Each of these replaces the values it warns about, and+ // after unmount its button would retry on a logic that is gone.+ it.each<[string, () => Promise<void>]>([+ [+ 'a later refresh succeeds',+ async () => {+ useMocks(serverFlagMock({ name: 'renamed by the agent' }))+ await expectLogic(logic, () => logic.actions.refreshFeatureFlagAfterAgentChange())+ .toDispatchActions(['refreshFeatureFlagSuccess'])+ .toFinishAllListeners()+ },+ ],+ [+ 'the flag fully reloads',+ async () => {+ await expectLogic(logic, () =>+ logic.actions.loadFeatureFlagSuccess(MOCK_FEATURE_FLAG)+ ).toFinishAllListeners()+ },+ ],+ [+ 'the flag saves',+ async () => {+ await expectLogic(logic, () =>+ logic.actions.saveFeatureFlagSuccess(MOCK_FEATURE_FLAG)+ ).toFinishAllListeners()+ },+ ],+ ['the logic unmounts', async () => logic.unmount()],+ ])('clears the failure notice when %s', async (_label, close) => {+ const dismiss = jest.spyOn(toast, 'dismiss')+ try {+ useMocks({ get: { [FLAG_URL]: () => [500, SERVER_ERROR_BODY] } })++ await expectLogic(logic, () => logic.actions.refreshFeatureFlagAfterAgentChange())+ .toDispatchActions(['refreshFeatureFlagFailure'])+ .toFinishAllListeners()++ const [, options] = jest.mocked(lemonToast.error).mock.calls[0]+ dismiss.mockClear()+ await close()++ expect(dismiss).toHaveBeenCalledWith(options?.toastId)+ } finally {+ dismiss.mockRestore()+ }+ })++ // A dirty-form refresh leaves its notice open until someone acts on it, so a later failure+ // would otherwise stack a second permanent notice offering the same reload.+ it('replaces the kept-edits notice when a later refresh fails', async () => {+ const dismiss = jest.spyOn(toast, 'dismiss')+ try {+ logic.actions.setFeatureFlag({ ...logic.values.featureFlag, name: 'half-written local edit' })+ expect(logic.values.isFormDirty).toBe(true)++ useMocks(serverFlagMock({ active: false }))+ await expectLogic(logic, () => logic.actions.refreshFeatureFlagAfterAgentChange())+ .toDispatchActions(['refreshFeatureFlagSuccess'])+ .toFinishAllListeners()+ expect(lemonToast.info).toHaveBeenCalledTimes(1)++ dismiss.mockClear()+ useMocks({ get: { [FLAG_URL]: () => [500, SERVER_ERROR_BODY] } })++ await expectLogic(logic, () => logic.actions.refreshFeatureFlagAfterAgentChange())+ .toDispatchActions(['refreshFeatureFlagFailure'])+ .toFinishAllListeners()++ expect(dismiss).toHaveBeenCalledWith('feature-flag-agent-change-1')+ } finally {+ dismiss.mockRestore()+ }+ })++ // Needs the two-in-flight setup for the same reason as the superseded-response case above:+ // the notice is keyed to the flag and never closes on its own, so a late failure would tell+ // the reader a current page is stale.+ it('says nothing when a superseded refresh fails late', async () => {+ const firstResponse = deferred()+ let requestCount = 0++ useMocks({+ get: {+ [FLAG_URL]: async () => {+ requestCount += 1+ if (requestCount === 1) {+ await firstResponse.promise+ return [500, SERVER_ERROR_BODY]+ }+ return [200, { ...MOCK_FEATURE_FLAG, name: 'second agent change' }]+ },+ },+ })++ await expectLogic(logic, () => {+ logic.actions.refreshFeatureFlagAfterAgentChange()+ logic.actions.refreshFeatureFlagAfterAgentChange()+ }).toDispatchActions(['refreshFeatureFlagSuccess'])++ firstResponse.resolve()+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.featureFlag.name).toBe('second agent change')+ expect(lemonToast.error).not.toHaveBeenCalled()+ })})})diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.tsindex e23530899279..688b94072927 100644--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts@@ -829,13 +829,29 @@ function cleanFlag(flag: Partial<FeatureFlagType>): Partial<FeatureFlagType> {}}-// Key the agent-change notice to one flag. The default id hashes the message, and the message names-// no flag, so a notice still open for another flag would swallow this one as a duplicate and leave-// its button reloading that flag.+// Key the agent-change notices to one flag. The default id hashes the message, and neither message+// names a flag, so a notice still open for another flag would swallow this one as a duplicate and+// leave its button reloading that flag.function agentChangeToastId(id: FeatureFlagLogicProps['id']): string {return `feature-flag-agent-change-${id}`}+// Each raise of the failure notice gets its own id. Its button dismisses the notice on click, and+// react-toastify keeps a dismissed id reserved until the exit animation ends and drops a toast raised+// under it in that window, so a retry that fails fast would re-raise into nothing.+function agentRefreshFailedToastId(id: FeatureFlagLogicProps['id'], attempt: number): string {+ return `feature-flag-agent-refresh-failed-${id}-${attempt}`+}++// Plain toast.dismiss, not lemonToast.dismiss, because the latter marks the id cancelled and would+// swallow the notice for the next agent change on this flag.+function dismissAgentNotices(id: FeatureFlagLogicProps['id'], cache: Record<string, any>): void {+ toast.dismiss(agentChangeToastId(id))+ if (cache.agentRefreshFailedToastId) {+ toast.dismiss(cache.agentRefreshFailedToastId)+ }+}+// Shape a freshly-loaded server flag into the `originalFeatureFlag` baseline the dirty check// compares against. Callers must pass server-authoritative state — never the in-progress// working copy — or an unsaved edit would be folded into the baseline and read as clean.@@ -1002,6 +1018,7 @@ export interface featureFlagLogicValues {>flagIntent: FlagIntent | nullflagMutationCount: number+ flagReplacementCount: numberflagStatus: FeatureFlagStatusResponseApi | nullflagStatusLoading: booleanflagType: 'boolean' | 'multivariate' | 'remote_config'@@ -1375,7 +1392,7 @@ export interface featureFlagLogicActions {flagId: numberteamId: number}- refreshFeatureFlag: (_payload?: { afterAgentChange?: boolean }) => {+ refreshFeatureFlag: (payload?: { afterAgentChange?: boolean }) => {afterAgentChange?: boolean}refreshFeatureFlagAfterAgentChange: () => {@@ -2342,6 +2359,13 @@ export const featureFlagLogic = kea<featureFlagLogicType>([setOriginalFeatureFlag: (state) => state + 1,},],+ flagReplacementCount: [+ 0,+ {+ loadFeatureFlagSuccess: (state) => state + 1,+ saveFeatureFlagSuccess: (state) => state + 1,+ },+ ],originalFeatureFlag: [null as FeatureFlagType | null,{@@ -3306,22 +3330,39 @@ export const featureFlagLogic = kea<featureFlagLogicType>([featureFlagRefresh: [null as FeatureFlagType | null,{- // `afterAgentChange` is unused here; refreshFeatureFlagSuccess reads it off the payload.- // The `= {}` default keeps the generated action's payload optional now that- // `breakpoint` follows it, so the mount-path `refreshFeatureFlag()` call still- // typechecks once kea-typegen regenerates this logic's types.- refreshFeatureFlag: async (_payload: { afterAgentChange?: boolean } = {}, breakpoint) => {+ // `refreshFeatureFlagSuccess` also reads `afterAgentChange` off the payload. The+ // `= {}` default keeps the generated action's payload optional, so the mount-path+ // `refreshFeatureFlag()` call still typechecks once kea-typegen regenerates.+ refreshFeatureFlag: async (payload: { afterAgentChange?: boolean } = {}, breakpoint) => {if (!props.id || props.id === 'new' || props.id === 'link') {return null}const mutationsBefore = values.flagMutationCount+ const replacementsBefore = values.flagReplacementCountlet retrievedFlag: FeatureFlagTypetry {retrievedFlag = await api.featureFlags.get(props.id)- } catch {- // Swallow errors — this is a silent background reconciliation, so a- // transient failure shouldn't surface a toast or get reported.- return null+ } catch (error) {+ // A mount-path failure stays silent, because that path is a background+ // reconciliation. An agent-path failure cannot: PostHog AI has already told+ // the reader the flag changed.+ if (!payload.afterAgentChange) {+ return null+ }+ // Breakpoint first, so a superseded refresh that fails late raises no notice+ // about values the page already shows. kea-loaders swallows the breakpoint+ // and dispatches no failure, as the status loader below does for its verdict.+ breakpoint()+ // A full load or save that landed while this request was open replaced every+ // field, so the values the notice would call old are gone. A partial fold (a+ // toggle, an inline description or tag save) must not count: it updates only+ // its own fields and carries the fresh `version` into the form, so the page+ // still lacks the agent's other changes while a later save passes the+ // stale-write check and overwrites them. The notice is the only warning.+ if (values.flagReplacementCount !== replacementsBefore) {+ return null+ }+ throw error}// A second mutation can start a newer refresh while this one is open. Discard this// response if so, or a slow earlier request would overwrite the newer flag, its@@ -3585,7 +3626,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([loadFeatureFlagStatusFailure: () => null,},}),- listeners(({ actions, values, props, sharedListeners }) => ({+ listeners(({ actions, values, props, sharedListeners, cache }) => ({loadCopyDependencyRequirements: async (_, breakpoint): Promise<void> => {const { copyDestinationProject, currentOrganizationId, currentProjectId, featureFlag } = values@@ -3856,9 +3897,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([},saveFeatureFlagSuccess: ({ featureFlag }) => {lemonToast.success('Feature flag saved')- // Plain toast.dismiss, not lemonToast.dismiss, because the latter marks the id- // cancelled and would swallow the notice for the next agent change on this flag.- toast.dismiss(agentChangeToastId(props.id))+ dismissAgentNotices(props.id, cache)actions.setFeatureFlag(featureFlag)// Whole flag just persisted — the baseline is now the saved state, so the form reads clean.actions.setOriginalFeatureFlag(toFeatureFlagBaseline(featureFlag))@@ -3996,6 +4035,10 @@ export const featureFlagLogic = kea<featureFlagLogicType>([return}const afterAgentChange = !!payload?.afterAgentChange+ if (afterAgentChange && cache.agentRefreshFailedToastId) {+ // This response carries what the failed one missed, so its notice is now wrong.+ toast.dismiss(cache.agentRefreshFailedToastId)+ }const baseline = values.originalFeatureFlag// Replacing the whole flag would discard an edit made during the request and re-baseline// over it, leaving the guard clean. An agent change on a clean form is the one refresh@@ -4039,6 +4082,30 @@ export const featureFlagLogic = kea<featureFlagLogicType>([// Keep the list cache in sync with the server state either way, so the two views agree.actions.updateFlag(featureFlagRefresh)},+ // Only the agent path throws, so this needs no `afterAgentChange` check of its own, and+ // initKea's ERROR_FILTER_ALLOW_LIST keeps the generic loader toast off the same failure.+ refreshFeatureFlagFailure: () => {+ // This notice supersedes the one a successful refresh left open, and both reload the+ // same flag, so stacking them would offer the reader two buttons for one action.+ toast.dismiss(agentChangeToastId(props.id))+ cache.agentRefreshFailedAttempt = (cache.agentRefreshFailedAttempt ?? 0) + 1+ cache.agentRefreshFailedToastId = agentRefreshFailedToastId(props.id, cache.agentRefreshFailedAttempt)+ // The button retries this refresh rather than running the full loader, which marks the+ // flag missing on any error except access denied. Nothing resets that state, so the scene+ // would show Not Found over the flag and any unsaved edits until it remounts.+ lemonToast.error(+ 'PostHog AI changed this flag, but the page could not load the new values. It still shows the old ones.',+ {+ autoClose: false,+ toastId: cache.agentRefreshFailedToastId,+ button: {+ label: 'Try again',+ action: () => actions.refreshFeatureFlag({ afterAgentChange: true }),+ dataAttr: 'feature-flag-agent-refresh-failed-reload',+ },+ }+ )+ },updateFeatureFlagArchivedSuccess: ({ featureFlagActiveUpdate }) => {if (featureFlagActiveUpdate) {lemonToast.success(`Feature flag ${featureFlagActiveUpdate.archived ? 'archived' : 'unarchived'}`)@@ -4109,7 +4176,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([}},loadFeatureFlagSuccess: async ({ featureFlag }) => {- toast.dismiss(agentChangeToastId(props.id))+ dismissAgentNotices(props.id, cache)// A ?tab=schedule deep link selects the tab before this load finishes, so the// schedule form's default was computed against the NEW_FLAG placeholder. Correct// it once against the loaded flag; only on the first load, so a later reload (e.g.@@ -5198,8 +5265,8 @@ export const featureFlagLogic = kea<featureFlagLogicType>([}}),- beforeUnmount(({ props }) => {+ beforeUnmount(({ props, cache }) => {// A notice that survives navigation has a button that reloads an unmounted logic.- toast.dismiss(agentChangeToastId(props.id))+ dismissAgentNotices(props.id, cache)}),])