Skip to content

fix(git): do not hang when git fetch stalls on a credential prompt - #42639

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-42630
Sep 9, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:fix-42630

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • spawnAsync now enforces its timeout itself: kills the process tree and resolves with timedOut, instead of relying on Node's timeout which only kills the direct child and then waits for close that never fires while grandchildren hold the stdio pipes.
  • Git commit info plugin runs git with credential.interactive=false and GIT_TERMINAL_PROMPT=0 so a fetch without credentials fails fast instead of prompting.
  • Extracted killProcessTree into processLauncher.ts and merged spawnAsync into it.

Fixes #42630

if (process.platform === 'win32')
childProcess.spawnSync(`taskkill /pid ${pid} /T /F`, { shell: true, windowsHide: true });
else
process.kill(pid, 'SIGKILL');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure why we don't do -pid here, and special-case line 240 instead. Perhaps worth some blame archeology to understand it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kill(-pid) needs a process group leader. launchProcess spawns browsers with detached: true, so the browser leads its own group. Workers are forked with detached: false on purpose (so Ctrl+C reaches them), and spawnAsync children are not detached either, so -pid would throw ESRCH there. Hence the split.

resolve({ stdout, stderr, code });
});
child.on('error', error => {
clearTimeout(timer);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need killProcessTree here just in case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed. error fires when the spawn failed (no pid), when kill() failed (we never call it), or when an IPC send failed (no channel). Nothing is left running on that path.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8348 passed, 1376 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

8 flaky ⚠️ [chromium-library] › library/chromium/chromium.spec.ts:373 › should produce network events, routing, and annotations for Service Worker `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:356 › screencast › should work for popups `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:778 › should partition action tree state by test `@windows-latest-node22`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:827 › should update state on subsequent run `@windows-latest-node22`

51415 passed, 1246 skipped


Merge workflow run.

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit aafd6e7 into microsoft:main Sep 9, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants