Skip to content

[Website] Preserve auto-login across browser-stored Playground reopens - #4185

Merged
adamziel merged 1 commit into
trunkfrom
adamziel/relogin-on-site-reopen
Jul 29, 2026
Merged

adamziel merged 1 commit into
trunkfrom
adamziel/relogin-on-site-reopen

Conversation

@adamziel

@adamziel adamziel commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Browser-stored Playgrounds now preserve auto-login after they are reopened.

Before this PR, the first MEMFS-to-OPFS copy stored WordPress files but not constants registered by live Blueprint steps. Reopening the Playground created a new runtime without PLAYGROUND_AUTO_LOGIN_AS_USER, so /wp-admin/ showed the login screen.

After this PR, that initial copy persists live PHP constants in the same metadata write that marks the copy complete, and later runtimes replay them. A failed constants read leaves the copy pending instead of silently saving incomplete state. Older completed saves cannot be backfilled because their retired runtime was the only authoritative source.

Test plan

Wait for browser autosave, switch to another Playground and back, then confirm /wp-admin/ opens logged in.

@adamziel
adamziel marked this pull request as ready for review July 29, 2026 08:55
Copilot AI review requested due to automatic review settings July 29, 2026 08:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Ensures reopening or switching back to a previously running auto-login Playground can restore the WordPress admin session without a visible reload unless needed, addressing the “can’t get back into wp-admin” scenario in #4092.

Changes:

  • Adds a Redux listener that probes the force-login mu-plugin path when an already-running auto-login site becomes active again.
  • Refreshes the retained iframe only when the probe indicates a login occurred (302).
  • Enables the mu-plugin force-login recovery path at boot for auto-login sites via a defined constant.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts Adds active-site-change listener to re-establish session via background request and conditional refresh.
packages/playground/website/src/lib/state/redux/boot-site-client.ts Injects PLAYGROUND_FORCE_AUTO_LOGIN_ENABLED constant for auto-login Playgrounds to activate mu-plugin recovery path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts Outdated
Comment thread packages/playground/website/src/lib/state/redux/boot-site-client.ts Outdated
Comment thread packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts Outdated
The first OPFS copy stored WordPress files but dropped constants defined by live Blueprint steps. Persist them in the same metadata write that marks the copy complete so later runtimes can replay them.
@adamziel
adamziel force-pushed the adamziel/relogin-on-site-reopen branch from 549531c to 1e3186e Compare July 29, 2026 13:10
@adamziel adamziel changed the title [Website] Re-login when reopening a saved Playground [Website] Preserve auto-login across browser-stored Playground reopens Jul 29, 2026
@adamziel
adamziel merged commit cf73f23 into trunk Jul 29, 2026
54 checks passed
@adamziel
adamziel deleted the adamziel/relogin-on-site-reopen branch July 29, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants