Surface PHP errors when a site fails to start#3813
Draft
bcotrim wants to merge 1 commit into
Draft
Conversation
Collaborator
📊 Performance Test ResultsComparing d53d08b vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
Built with Claude Code: it traced the error-reporting flow, reproduced the failure against plain Playground CLI to isolate root causes, implemented the fix, and verified it end-to-end (CLI before/after on a broken site). All code human-reviewed; the empirical findings below were verified with live runs, not just code reading.
Proposed Changes
When a site fails to start (e.g. an active plugin or theme fatals while WordPress loads), Studio only reported
WordPress server process exited unexpectedly— with the default debug settings the actual PHP error was recorded nowhere, leaving users (and support) with no way to diagnose it. Three compounding causes:runCLI()swallows boot errors andprocess.exit(1)s (upstream: runCLI() swallows errors via process.exit(1) instead of re-throwing WordPress/wordpress-playground#3520), so Studio's IPC error path never runs.WP_DEBUG_LOG=falseand Playground's platform mu-plugin then disableslog_errorsentirely — boot fatals vanish.With this change:
wp-content/studio-error.logwhile the user's debug-log setting is off (theirdebug.log/WP_DEBUGtoggles keep their exact meaning). The file is cleared on each start and excluded from exports and sync pushes.Error:line in the crash tail, so non-PHP boot failures (port, mounts) carry a reason too.debug.loginstead (gated by mtime so stale entries from previous runs are not shown).Known limits: fatals in user
wp-content/mu-plugins/orwp-config.phpfire before the capture mu-plugin loads (the stdoutError:line still shows); running daemons pick up the stdout-tail change only after restart. The issue title asks for a--verboseflag — capturing errors fixes the underlying need for both the app and CLI surfaces; a--verbosestreaming view can build on this as a follow-up.Testing Instructions
Isolate config + daemon so your real sites are untouched:
Before (trunk):
After (this branch):
To compare builds on the same site, recycle the isolated daemon between them (
lsof -t $DEMO/daemon/daemon.sock | xargs kill) so the new daemon code is used. Cleanup: kill the daemon the same way, thenrm -rf $DEMO.Also verify the happy path: remove the broken line (
sed -i '' '$ d' .../functions.php), start again — site boots normally and nostudio-error.logis left behind. For the desktop app, break a throwaway site the same way and hit Start — the error dialog andstudio-<date>.lognow include the fatal.Pre-merge Checklist
🤖 Generated with Claude Code