Skip to content

[Repo Assist] fix: always close stdin in format() regardless of debug mode#92

Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/fix-debug-stdin-close-2026-03-16-8a500cf16d28b852
Draft

[Repo Assist] fix: always close stdin in format() regardless of debug mode#92
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/fix-debug-stdin-close-2026-03-16-8a500cf16d28b852

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

When phpcbf.debug is true, exec.stdin was left open after spawning the phpcbf process. This caused phpcbf to block waiting for stdin input, which manifested as the onWillSaveTextDocument-listener threw ERROR: timeout seen in issue #35.

phpcbf always operates on a temp file passed as a CLI argument — it never reads from stdin — so stdin should be closed immediately after spawn regardless of the debug setting.

Root Cause

// Before (buggy): stdin only closed when debug is false
let exec = cp.spawn(this.executablePath, this.getArgs(document, fileName));
if (!this.debug) {
    exec.stdin.end();
}

Fix

// After: stdin always closed
let exec = cp.spawn(this.executablePath, this.getArgs(document, fileName));
exec.stdin.end();
```

## Trade-offs

None. The debug flag controls logging verbosity (`-l` vs `-lq` in `getArgs`), not stdin behaviour. Closing stdin unconditionally is correct in both modes.

## Test Status

All 7 existing unit tests pass:

```
# tests 7
# pass 7
# fail 0

Closes #35

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

When phpcbf.debug is true, exec.stdin was left open, causing the spawned
phpcbf process to block waiting for stdin input. This manifests as the
onWillSaveTextDocument timeout error (issue #35) when debug mode is enabled.

phpcbf operates on a temp file passed as an argument, never on stdin, so
stdin should always be closed immediately after spawn.

Closes #35

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor Author

🤖 This is an automated note from Repo Assist.

This PR appears to be a duplicate of PR #90 ("[Repo Assist] fix: always close stdin in format() regardless of debug mode (closes #35)"), which covers the same change with a more complete description referencing the issue it closes.

I'd recommend closing this PR and tracking the fix via PR #90 instead.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onWillSaveTextDocument-listener error

0 participants