Skip to content

Agentic UI: Don't start a site while a stop for it is still in flight - #4406

Draft
bcotrim wants to merge 1 commit into
trunkfrom
guard-site-start-while-stopping
Draft

Agentic UI: Don't start a site while a stop for it is still in flight#4406
bcotrim wants to merge 1 commit into
trunkfrom
guard-site-start-while-stopping

Conversation

@bcotrim

@bcotrim bcotrim commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code traced the race and wrote the fix and tests. I found the repro (pressing a destination while a site is stopping) and reviewed the diff.

Proposed Changes

Starting a site while a stop for it is still in flight leaves the site down — the stop lands last — while the UI believes it started. Every "not running, so start it" path then tries again, and it loops; the site never comes up.

The guard goes in useStartSite rather than at any one call site, so it holds for all of them: the sidebar, the site dropdown, the preview's Start button, auto-start on launch, and anything opening a URL in the preview. A skipped start no longer shows the "Site started" toast.

Testing Instructions

  1. Start a site, then stop it.
  2. While it is still stopping, trigger a start — e.g. Open in… → phpMyAdmin in the preview toolbar, or the sidebar's Start.
  3. The start is ignored and the site finishes stopping. Before this PR it entered a start loop and never came up (repeated Starting server for '<site>' in the terminal).
  4. Once the stop has finished, starting works normally.
  5. Stopping site A while starting site B is unaffected — the guard is per-site.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing a57383e vs trunk

app-size

Metric trunk a57383e Diff Change
App Size (Mac) 1372.96 MB 1372.96 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk a57383e Diff Change
load 1064 ms 1038 ms 26 ms ⚪ 0.0%

site-startup

Metric trunk a57383e Diff Change
siteCreation 6527 ms 6507 ms 20 ms ⚪ 0.0%
siteStartup 2381 ms 2358 ms 23 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim
bcotrim marked this pull request as draft July 31, 2026 13:22
@bcotrim bcotrim changed the title Don't start a site while a stop for it is still in flight Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants