Conversation
Recover from silent NativePHP dev-server death and unblock Cmd+Q wedges: - Renderer overlay (Alpine + Tailwind) detects backend failure via Livewire commit hook plus a `/_rfa/health` poller; reloads on recovery, shows Force Quit / Restart buttons after it gives up. - `/_rfa/health` route registered outside web middleware so SQLite session contention can't false-flip the overlay. - Build-time vendor patches (`scripts/patch-native-electron-main.php` and the existing `patch-native-preload.php`) auto-respawn the PHP server on the captured port, expose a `rfaLifecycle` contextBridge for force-quit and restart, and arm a 3 s `app.exit(0)` deadline so Cmd+Q always wins. - Patch scripts are atomic (`.tmp` + rename), versioned-sentinel, whitespace-tolerant, and exit non-zero on missing anchors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32340deac0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| state.phpServer = newServer; | ||
| newServer.on("error", (err) => { | ||
| console.error('[rfa] PHP respawn error:', err); | ||
| }); | ||
| newServer.on("close", __rfaRestartHandler); |
There was a problem hiding this comment.
Drain stdio on respawned PHP server
The respawn branch creates newServer and only wires error/close handlers, but never attaches stdout/stderr listeners. In this code path, callPhp() spawns the same php -S process used at startup, and that server continuously logs requests to stderr; without a consumer, the pipe buffer can fill and block the child process, causing the “recovered” backend to hang again under normal traffic. Please attach the same stream-draining listeners used for the initial phpServer to each respawned child.
Useful? React with 👍 / 👎.
`out/main/index.js` is generated by `electron-vite build`, not shipped in the package dist. Hard-erroring in `post-autoload-dump` broke every CI job that runs `composer install` from a cold cache (lint, types, test-core, test-browser, benchmark-perf). Treat a missing file as a skip; still error on missing anchors so upstream shape changes stay loud. Also add the new script + helper to the vendor cache key so the cache busts when the patch script changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Caution
DO NOT MERGE. The electron-main patch (
scripts/patch-native-electron-main.php) is wired as acomposer post-autoload-dumphook, butvendor/nativephp/desktop/resources/electron/out/main/index.jsis regenerated byelectron-vite buildinsidephp artisan native:build(whichrelease.ymlruns after composer). Any patches applied at composer time get overwritten beforeelectron-builderpackages the app, so the lifecycle IPC handlers,phpServerregistration, auto-restart, and 3s quit deadline never reach the shipped binary.Resolve before merging. Options:
postbuildscript to the upstream electronpackage.json(patched the same way release.yml already patchesnpm ci->npm install) that runs the PHP patch script afterelectron-vite build.electron.vite.config.mjssoout/main/index.jsis born patched.src/main/index.ts) instead of the build output, so electron-vite emits a patched bundle.CI is green now (commit a51da14 makes the script skip gracefully when the build artifact is missing), but green CI does not mean the feature works in production.
Recover from silent NativePHP dev-server death and unblock Cmd+Q wedges:
commit hook plus a `/_rfa/health` poller; reloads on recovery, shows
Force Quit / Restart buttons after it gives up.
contention can't false-flip the overlay.
the existing `patch-native-preload.php`) auto-respawn the PHP server on
the captured port, expose a `rfaLifecycle` contextBridge for force-quit
and restart, and arm a 3 s `app.exit(0)` deadline so Cmd+Q always wins.
whitespace-tolerant, and exit non-zero on missing anchors.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com