fix(fpm): guard response reads and strip bridge headers#62
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in FastCGI (FPM) response timeout to prevent the runner from hanging indefinitely when the FPM bridge stalls, and aligns the devcontainer PHP bridge output to strip customer-emitted headers before returning the JSON envelope.
Changes:
- Introduces
-fpm-response-timeout(default0, disabled) and threads it into the CLI performer to bound FPM response handling. - Adds a unit test covering a hung FPM response path using a
gofast.ResponsePipethat never produces output. - Updates the devcontainer
fpm-cron-runner.phpbridge to remove all previously-set headers before sending the JSON response.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| readme.md | Documents the new -fpm-response-timeout flag. |
| main.go | Adds CLI flag plumbing and passes the timeout into the performer. |
| performer/cli.go | Implements timeout-aware request creation + guarded response streaming. |
| performer/performer_test.go | Adds a focused timeout test for a hung FPM response. |
| .devcontainer/local-features/cron-runner-environment/fpm-cron-runner.php | Clears bridge-emitted headers before returning the JSON envelope. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…wording Addresses Copilot review comments on PR #62. ## What changed - Bump the FPM response timeout test from 10ms to 1s to avoid CI flake from goroutine scheduling jitter on shared runners. - Rename the timeout error wording from "response write timed out" to "response read timed out" so it reflects that the bound is on reading the FastCGI response stream (the in-memory `fakeHTTPResponseWriter` cannot block on writes), not on writing to a client. - Update the test assertion to match the new wording. ## Why - The 10ms threshold is below typical CI scheduler quanta; the test was fundamentally racy. - "Response write timed out" misled the on-call about which leg of the FPM bridge was stuck during the incident referenced by this PR.
robersongomes
approved these changes
Jun 5, 2026
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.
Summary
-fpm-response-timeoutflag that bounds the FPM response read/write phase and closes the response pipe on timeout.-fpm-response-timeout=0.fpm-cron-runner.phpbridge before returning the JSON envelope.Why
PLTFRM-2424 traced stuck Cron Control Runner behavior to long customer-emitted response headers reaching the FPM/gofast path before normal watcher startup. The production bridge cleanup is being handled in Automattic/wpvip-dockerfiles#493; this PR keeps the runner devcontainer bridge in parity and adds runner-side fail-fast hardening for future FPM response stalls.
Validation
php -l .devcontainer/local-features/cron-runner-environment/fpm-cron-runner.phpgo test ./...git diff --checkContent-Security-Policyheader returned onlyContent-Type: application/jsonand a valid{ "buf", "stdout", "stderr" }JSON envelope.Notes