Skip to content

web/flow: revert locale-driven flow re-request from FlowExecutor - #24050

Merged
BeryJu merged 2 commits into
mainfrom
revert-flow-locale-refresh
Jul 15, 2026
Merged

BeryJu merged 2 commits into
mainfrom
revert-flow-locale-refresh

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Details

#23007 landed two changes: the locale selector label fix, and a LOCALE_STATUS_EVENT listener that makes FlowExecutor re-request the flow whenever the locale finishes loading. This reverts the listener. The label fixes (format.ts, ak-locale-select.ts, the activeLocaleTag-keyed repeat, the mixin @remarks) stay as merged.

The listener causes a duplicate GET on mount. firstUpdated already calls refresh() unconditionally, and LOCALE_STATUS_EVENT fires as soon as @lit/localize resolves the initial locale, which on the cached or default path is the same tick. Both flowsExecutorGet calls reach the server's dispatch loop, each calls plan.next(self.request) and writes request.session[SESSION_KEY_PLAN]. Django sessions aren't transactional across concurrent requests, so one write can clobber the other.

That also breaks the promise chain in firstUpdated. refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent())) resolves against the challenge its own GET returned, but a second refresh can overwrite this.challenge in between, leaving listeners that read flowExecutor.challenge on advance with a stale stage. Auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs can advance the plan twice and skip a stage.

The user-facing case is worse. Once the executor is mounted, flipping the locale selector fires the event, calls refresh(), and replaces this.challenge. The guard([challenge]) in render then tears down the whole stage subtree, dropping typed input on password, email, and identification stages and cancelling in-flight captcha and WebAuthn widgets.

CaptchaStage already handles locale changes the other way: the stage owns its own LOCALE_STATUS_EVENT listener and re-runs the locale-dependent part in place, without tearing down its containing view. A future pass should re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow.

This re-opens the server-side-label half of #22954.

Test plan

Lint, typecheck, and precommit are clean on the branch. The change is confined to web/src/flow/FlowExecutor.ts: the @lit/localize import returns to msg-only and the listener block is removed. No other files change.

Disclosure

Triaged and authored end-to-end by an agent running in a sandbox against goauthentik/authentik@main. Reviewed and shipped by @GirlBossRush.

closes #23857

Back out the `LOCALE_STATUS_EVENT` listener that #23007 added to `FlowExecutor`. The label-formatting half of that PR (`format.ts`, `ak-locale-select.ts`, the `activeLocaleTag`-keyed `repeat`, and the mixin `@remarks`) stays; only the executor-side re-request goes.

The operator's report was that the flow executor isn't handling locale events well. Four failure modes make that report reproducible.

First, on mount we get two concurrent `flowsExecutorGet` calls. `firstUpdated` already kicks off `refresh()` unconditionally, and `LOCALE_STATUS_EVENT` fires as soon as `@lit/localize` resolves the initial locale, which on the cached/default path is the same tick. Both GETs land in the server's dispatch loop; each one calls `plan.next(self.request)` and writes back to `request.session[SESSION_KEY_PLAN]`. Django sessions aren't transactional across concurrent requests, so the second write can clobber the first.

Second, the promise chain in `firstUpdated` around line 253 breaks. `refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent()))` resolves against the challenge *its* GET returned, but a second refresh can overwrite `this.challenge` in between, so listeners that read `flowExecutor.challenge` on advance see a stale stage.

Third, every user-initiated locale change destroys stage state. Once the executor is mounted, flipping the locale selector fires `LOCALE_STATUS_EVENT`, which calls `refresh()`, which replaces `this.challenge`. The `guard([challenge])` in the render tears down the whole stage subtree and rebuilds it, dropping typed input on password / email / identification stages and cancelling in-flight captcha and WebAuthn widgets.

Fourth, auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs advance the plan twice and skip a stage.

`CaptchaStage` already shows the right pattern for this: the stage owns its own `LOCALE_STATUS_EVENT` listener and re-runs the locale-dependent piece in place, without tearing down its containing view. Whoever picks this up next should either re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow.

Re-opens the server-side-label half of #22954.

Co-Authored-By: Agent (authentik-m-web-flow-wide-brief-cherry) <[email protected]>
@netlify

netlify Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 5ee891a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a5788e4a9c23500084520e0
😎 Deploy Preview https://deploy-preview-24050--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 5ee891a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a5788e49d64be00084719d1
😎 Deploy Preview https://deploy-preview-24050--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 5ee891a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a5788e4ad0cd7000823ad37
😎 Deploy Preview https://deploy-preview-24050--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.67%. Comparing base (c6b8a20) to head (5ee891a).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24050      +/-   ##
==========================================
- Coverage   92.71%   92.67%   -0.05%     
==========================================
  Files        1047     1047              
  Lines       61637    61637              
  Branches      424      424              
==========================================
- Hits        57149    57121      -28     
- Misses       4488     4516      +28     
Flag Coverage Δ
conformance 36.02% <ø> (+<0.01%) ⬆️
e2e 41.16% <ø> (+<0.01%) ⬆️
integration 31.97% <ø> (-0.50%) ⬇️
rust 0.00% <ø> (ø)
unit 91.84% <ø> (+<0.01%) ⬆️
unit-migrate 91.85% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-5ee891a469575f1fd2ce3ef5ebbddaa63899fede
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-5ee891a469575f1fd2ce3ef5ebbddaa63899fede

Afterwards, run the upgrade commands from the latest release notes.

@GirlBossRush GirlBossRush self-assigned this Jul 15, 2026
@GirlBossRush
GirlBossRush marked this pull request as ready for review July 15, 2026 13:50
@GirlBossRush
GirlBossRush requested a review from a team as a code owner July 15, 2026 13:50
@BeryJu BeryJu added the backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5 label Jul 15, 2026
@BeryJu
BeryJu merged commit dff7424 into main Jul 15, 2026
123 checks passed
@BeryJu
BeryJu deleted the revert-flow-locale-refresh branch July 15, 2026 14:14
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.5 created: #24068

kensternberg-authentik added a commit that referenced this pull request Jul 15, 2026
* main:
  web/flow: revert locale-driven flow re-request from FlowExecutor (#24050)
  web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840)
  root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013)
  docs/social-logins: Add jumpcloud oidc and saml (#24048)
  core, web: update translations (#24037)
  web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007)
  ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045)
  website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043)
  web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044)
  web: bump aws-cdk from 2.1128.1 to 2.1129.0 (#24046)
  stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#24039)
  packages/django-dramatiq-postgres/broker: close unusable PostgreSQL connections (#24023)
  api/search: add number and boolean support in AKQL queries on JSON fields (#23418) (#24028)
  enterprise: simplify tests (#18404)
  website/docs: Remove Public Release Docs. (#24031)
  website/docs: sys-mgmt: tweak settings wording (#24029)
  website/docs: cleanup 07-12: update release process guidance (#23970)
  website/integrations: add infiscal (#23996)
kensternberg-authentik added a commit that referenced this pull request Jul 15, 2026
* main: (104 commits)
  web/flow: revert locale-driven flow re-request from FlowExecutor (#24050)
  web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840)
  root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013)
  docs/social-logins: Add jumpcloud oidc and saml (#24048)
  core, web: update translations (#24037)
  web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007)
  ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045)
  website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043)
  web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044)
  web: bump aws-cdk from 2.1128.1 to 2.1129.0 (#24046)
  stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#24039)
  packages/django-dramatiq-postgres/broker: close unusable PostgreSQL connections (#24023)
  api/search: add number and boolean support in AKQL queries on JSON fields (#23418) (#24028)
  enterprise: simplify tests (#18404)
  website/docs: Remove Public Release Docs. (#24031)
  website/docs: sys-mgmt: tweak settings wording (#24029)
  website/docs: cleanup 07-12: update release process guidance (#23970)
  website/integrations: add infiscal (#23996)
  ...
kensternberg-authentik added a commit that referenced this pull request Jul 15, 2026
…card-2

* web/cleanup/schedule-card-1: (104 commits)
  web/flow: revert locale-driven flow re-request from FlowExecutor (#24050)
  web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840)
  root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013)
  docs/social-logins: Add jumpcloud oidc and saml (#24048)
  core, web: update translations (#24037)
  web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007)
  ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045)
  website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043)
  web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044)
  web: bump aws-cdk from 2.1128.1 to 2.1129.0 (#24046)
  stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#24039)
  packages/django-dramatiq-postgres/broker: close unusable PostgreSQL connections (#24023)
  api/search: add number and boolean support in AKQL queries on JSON fields (#23418) (#24028)
  enterprise: simplify tests (#18404)
  website/docs: Remove Public Release Docs. (#24031)
  website/docs: sys-mgmt: tweak settings wording (#24029)
  website/docs: cleanup 07-12: update release process guidance (#23970)
  website/integrations: add infiscal (#23996)
  ...
kensternberg-authentik added a commit that referenced this pull request Jul 15, 2026
…card-3-problem-children

* web/cleanup/schedule-card-2: (113 commits)
  website/docs: release notes for 2026.5.5 (#24070)
  website/docs: release notes for 2026.2.6 (#24069)
  web, locale: Normalize legacy locale file names (#24024)
  web/bug: harmonize and make routine the display of tasks (part 4: schedule-list cards) (#23855)
  security: automated internal backport of patch 1822.sec.patch to authentik-main (#24064)
  security: automated internal backport of patch 1934.sec.patch to authentik-main (#24067)
  security: automated internal backport of patch 1887.sec.patch to authentik-main (#24065)
  security: automated internal backport of patch 1919.sec.patch to authentik-main (#24066)
  security: automated internal backport of patch 1817.sec.patch to authentik-main (#24063)
  web/flow: revert locale-driven flow re-request from FlowExecutor (#24050)
  web/bug: harmonize and make routine the display of tasks (part 3: problem children) (#23840)
  root: PostgreSQL direct-endpoint support for LISTEN/NOTIFY and advisory locks (#23013)
  docs/social-logins: Add jumpcloud oidc and saml (#24048)
  core, web: update translations (#24037)
  web: bump @goauthentik/eslint-config from 2.0.0 to 2.0.2 in /web in the goauthentik group across 1 directory (#24007)
  ci: bump taiki-e/install-action from 2.82.9 to 2.83.2 in /.github/actions/setup (#24045)
  website: bump openapi-to-postmanv2 from 6.2.0 to 6.3.0 in /website (#24041)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /lifecycle/container (#24042)
  core: bump pnpm/pnpm from 11.11.0 to 11.12.0 in /website (#24043)
  web: bump @sentry/browser from 10.63.0 to 10.64.0 in /web in the sentry group across 1 directory (#24044)
  ...
BeryJu added a commit that referenced this pull request Jul 15, 2026
…rry-pick #24050 to version-2026.5) (#24068)

web/flow: revert locale-driven flow re-request from FlowExecutor (#24050)

Back out the `LOCALE_STATUS_EVENT` listener that #23007 added to `FlowExecutor`. The label-formatting half of that PR (`format.ts`, `ak-locale-select.ts`, the `activeLocaleTag`-keyed `repeat`, and the mixin `@remarks`) stays; only the executor-side re-request goes.

The operator's report was that the flow executor isn't handling locale events well. Four failure modes make that report reproducible.

First, on mount we get two concurrent `flowsExecutorGet` calls. `firstUpdated` already kicks off `refresh()` unconditionally, and `LOCALE_STATUS_EVENT` fires as soon as `@lit/localize` resolves the initial locale, which on the cached/default path is the same tick. Both GETs land in the server's dispatch loop; each one calls `plan.next(self.request)` and writes back to `request.session[SESSION_KEY_PLAN]`. Django sessions aren't transactional across concurrent requests, so the second write can clobber the first.

Second, the promise chain in `firstUpdated` around line 253 breaks. `refresh().then(() => dispatchEvent(new AKFlowAdvanceEvent()))` resolves against the challenge *its* GET returned, but a second refresh can overwrite `this.challenge` in between, so listeners that read `flowExecutor.challenge` on advance see a stale stage.

Third, every user-initiated locale change destroys stage state. Once the executor is mounted, flipping the locale selector fires `LOCALE_STATUS_EVENT`, which calls `refresh()`, which replaces `this.challenge`. The `guard([challenge])` in the render tears down the whole stage subtree and rebuilds it, dropping typed input on password / email / identification stages and cancelling in-flight captcha and WebAuthn widgets.

Fourth, auto-advance stages (redirect, consent auto-confirm, source continuation) resolve on GET, so two concurrent GETs advance the plan twice and skip a stage.

`CaptchaStage` already shows the right pattern for this: the stage owns its own `LOCALE_STATUS_EVENT` listener and re-runs the locale-dependent piece in place, without tearing down its containing view. Whoever picks this up next should either re-render the server-rendered label subtrees in place, or fetch the label strings through a locale-aware endpoint, rather than re-requesting the whole flow.

Re-opens the server-side-label half of #22954.

Co-authored-by: Teffen Ellis <[email protected]>
Co-authored-by: Agent (authentik-m-web-flow-wide-brief-cherry) <[email protected]>
Co-authored-by: Jens L. <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebAuthn not working with 2026.5.4 when using non-default locale

2 participants