Skip to content

fix(core): hide remaining subprocess windows on Windows#643

Open
MarsSall wants to merge 1 commit into
Gentleman-Programming:mainfrom
MarsSall:fix/windows-hide-subprocesses
Open

fix(core): hide remaining subprocess windows on Windows#643
MarsSall wants to merge 1 commit into
Gentleman-Programming:mainfrom
MarsSall:fix/windows-hide-subprocesses

Conversation

@MarsSall

@MarsSall MarsSall commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked Issue

Closes #641


🏷️ PR Type

  • type:bug — Bug fix
  • type:feature — New feature
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no behavior change)
  • type:chore — Maintenance, dependencies, tooling
  • type:breaking-change — Breaking change

📝 Summary

  • Extract the platform-specific subprocess constructor from internal/project into shared internal/command.
  • Hide LLM, setup, and project subprocess windows on Windows while preserving non-Windows behavior.
  • Preserve setup command injection and enforce shared-helper usage with focused tests.

📂 Changes

File Change
internal/command/* Add shared Windows/non-Windows command construction and usage tests.
internal/project/detect.go Route Git subprocesses through the shared helper.
internal/llm/claude.go Route agent CLI subprocesses through the shared helper.
internal/setup/setup.go Hide setup subprocess windows without removing the injectable runCommand seam.
internal/setup/setup_test.go Make the default execution test portable across Windows and Unix.

🧪 Test Plan

  • Unit tests pass locally: go test ./...
  • E2E tests pass locally: go test -tags e2e ./internal/server/...
  • Manually tested the affected functionality

Additional verification:

  • go test -count=1 ./internal/command ./internal/project ./internal/llm
  • go test -count=1 ./internal/setup -run '^TestDefaultRunCommandExecutes$'
  • GOOS=windows GOARCH=amd64 go build ./...

The complete unit suite still hits existing Windows-specific failures and a cmd/engram timeout. The same failures reproduce on the base commit without this change; affected-package tests pass.


🤖 Automated Checks

These run automatically and all must pass before merge:

Check What it verifies Status
Check Issue Reference PR body contains Closes #N / Fixes #N / Resolves #N
Check Issue Has status:approved Linked issue has status:approved label
Check PR Has type:* PR has exactly one type:* label
Unit Tests go test ./... passes
E2E Tests go test -tags e2e ./internal/server/... passes

✅ Contributor Checklist

  • I linked an approved issue above (Closes #641)
  • I added exactly one type:* label to this PR
  • I ran unit tests locally: go test ./...
  • I ran e2e tests locally: go test -tags e2e ./internal/server/...
  • Docs updated if behavior changed (not applicable: internal process behavior only)
  • Commits follow conventional commits format
  • No Co-Authored-By trailers in commits

💬 Notes for Reviewers

This is the approved follow-up to #604. The helper was moved rather than copied so project, llm, and setup share one build-tagged Windows implementation.

The PR needs the type:bug label. GitHub does not allow the fork contributor account to apply labels to the upstream repository.

Summary by CodeRabbit

  • Bug Fixes

    • Improved cross-platform command execution.
    • Prevented command windows from appearing on Windows.
    • Standardized command handling across project detection, setup, and Claude CLI operations.
  • Tests

    • Added coverage verifying platform-specific command behavior.
    • Updated command execution tests to run reliably on Windows and non-Windows platforms.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a shared, platform-specific command.NewContext helper that hides Windows subprocess windows and uses standard context-aware execution elsewhere. Project detection, Claude CLI execution, and setup commands now use the helper, with updated tests and AST-based call-site validation.

Changes

Shared command execution

Layer / File(s) Summary
Platform-specific command helper
internal/command/*
Adds exported NewContext, using exec.CommandContext on non-Windows platforms and enabling HideWindow on Windows. Platform-specific tests verify command arguments and process attributes.
Subprocess call-site integration
internal/llm/claude.go, internal/project/detect.go, internal/setup/setup.go
Routes Claude CLI, Git detection, and setup subprocesses through command.NewContext while preserving existing output and error handling.
Cross-platform and call-site validation
internal/command/command_usage_test.go, internal/project/command_usage_test.go, internal/setup/setup_test.go
Adds AST-based checks for helper usage, removes the obsolete project-local helper check, and makes setup execution assertions work on Windows and non-Windows platforms.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: type:bug

Suggested reviewers: gentleman-programming

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address #641 by routing LLM and setup subprocesses through the shared Windows-hiding command helper.
Out of Scope Changes check ✅ Passed The project helper refactor and usage tests are part of the stated shared-helper and verification work.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: hiding remaining subprocess windows on Windows.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(core): llm and setup subprocesses still open console windows on Windows

1 participant