fix(fs): suppress visible console windows for git.exe children on Windows - #80
Open
DaisyHunter wants to merge 1 commit into
Open
DaisyHunter wants to merge 1 commit into
DaisyHunter wants to merge 1 commit into
Conversation
…dows UntrustedRepositoryGitCommand is the single channel for every git fact aoci reads about a repository. When aoci itself runs console-less (MCP stdio spawned by a host), Windows allocates a new visible console for each git.exe child, so every refresh flashes a terminal window and steals focus (issue aoci-spec#79). hideChildConsole pins CREATE_NO_WINDOW + HideWindow on Windows and is a no-op on other platforms. Stdio handle inheritance is untouched, so host pipes and interactive terminal output behave exactly as before. Evidence: console-less 'aoci check' sampled 1310 git.exe children with zero windowed handles; on the patched binary gofmt/vet/staticcheck are clean, the fs package tests (including a new invariant test) pass, and linux/darwin/windows builds verify the platform stub. Blackbox suites on Windows: conformance 44/46 (the 2 misses are the suite's own aoci-code-relative expectations run against a third-party repo) and scenarios 57 PASS / 2 CHARACTERIZED / 0 FAIL. Fixes aoci-spec#79
7 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.
Fixes #79 — root cause, the measurement method, and the full evidence table are documented there.
Problem
On Windows, every git probe aoci performs spawns a visible console window that steals focus when aoci itself runs console-less (MCP stdio spawned by a host). During agent sessions this happens constantly — see #79 for the user impact and the
MainWindowHandlesampling method.Change
internal/fs/git_command.go— the hardened git constructor now callshideChildConsole(command); all hardening arguments andGIT_OPTIONAL_LOCKS=0are untouched.internal/fs/git_command_windows.go(new) — setsSysProcAttr{HideWindow: true, CreationFlags: CREATE_NO_WINDOW}.internal/fs/git_command_other.go(new) — no-op stub for non-Windows platforms.internal/fs/git_command_windows_test.go(new) — pins the window-suppression invariant so a refactor cannot silently drop it (platform-suffixed test file, followingatomic_create_windows_test.go).Stdio handle inheritance is not affected by
CREATE_NO_WINDOW, so host pipes and interactive terminal output behave exactly as before.Change evidence (per CONTRIBUTING)
git.exechildren on Windows; no change to what git is invoked with, or to env, argv, stdio, or the hardening pipeline.gofmt -lclean;go vet ./...clean; staticcheck 2026.2.1 zero findings;go test ./internal/fs -count=1green including the new invariant test;go test ./... -count=1green except 17 pre-existinginternal/clifailures reproduced identically on unpatched rc14 (attributed in a [bug] Windows11环境下频繁终端弹窗,干扰鼠标与键盘操作 #79 comment — test-fixture path injectionbaseline.json.bak\blockeris a no-op on Windows); blackboxmcp_conformance.py44/46 (the 2 misses are the suite's own aoci-code-relative search expectations run against a third-party repo) andmcp_scenarios.py57 PASS / 2 CHARACTERIZED / 0 FAIL (T1 no-pty, P2 NTFS trailing-space directory — both platform characterizations, not failures).