[Repo Assist] fix: add 30-second watchdog timer to prevent phpcbf subprocess hangs#129
Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
Conversation
When phpcbf stalls (e.g. on a misconfigured build or very large file), format() returned a Promise that never settled, freezing VS Code indefinitely with no user feedback. Fix: schedule a timer after spawning. The timer terminates the process and shows an error message if it fires. It is cancelled on normal exit or spawn error so there is no dangling timer. Relates to #35 (onWillSaveTextDocument timeout errors). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
66 tasks
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.
🤖 This is an automated draft PR from Repo Assist, an AI assistant.
Summary
Adds a 30-second watchdog timer to the
format()function so that a stalledphpcbfprocess can no longer freeze VS Code indefinitely.Problem
format()spawnsphpcbfas a child process and wraps it in aPromise. If the process stalls (e.g. waiting for stdin on a misconfigured build, hanging while processing an unusually large file, or hitting a deadlock in the external tool) the Promise never settles. VS Code's formatter infrastructure waits for that Promise forever, leaving the document save or Format Document command frozen with no feedback.This has been reported as #35 ("onWillSaveTextDocument-listener error: timeout") and accounts for the VS Code
Error: timeoutin the extension host log that users see after a 5-second VS Code wait.Fix
A
setTimeoutis scheduled immediately after spawning:Relates to #35.