Skip to content

fix(core): add timeouts to GitHub push flow to prevent CLI hangs#35011

Merged
FrozenPandaz merged 1 commit into
masterfrom
NXC-4141
Mar 25, 2026
Merged

fix(core): add timeouts to GitHub push flow to prevent CLI hangs#35011
FrozenPandaz merged 1 commit into
masterfrom
NXC-4141

Conversation

@jaysoo
Copy link
Copy Markdown
Member

@jaysoo jaysoo commented Mar 25, 2026

Current Behavior

The pushToGitHub flow in create-nx-workspace calls gh api user and gh repo create --push with no timeout. When gh CLI is wrapped by 1Password SSH agent, credential managers with GUI prompts, SSH keys with passphrases, or corporate SSO, these calls hang indefinitely — freezing the CLI after workspace creation with no indication of what's happening.

YTD data shows a 96.3% failure rate (16,426 failures out of 17,058 push attempts).

Expected Behavior

  • The initial gh auth check (gh api user) has a 2-second timeout. If gh is slow to respond (hung on credential prompt), the push flow is skipped gracefully instead of freezing.
  • The gh repo create --push command has a 15-second timeout. If the push hangs, the process is killed and a helpful message is shown.
  • If gh CLI is not installed, the push flow is skipped immediately without attempting any network calls.
  • Error messages now include actionable fallback: "You can push manually with: git push -u origin main".

The error is now captured in recordStat as well, so when users see this we'll also see it in our stats.

image

Related Issue(s)

Fixes #34482, NXC-4141

@jaysoo jaysoo requested a review from a team as a code owner March 25, 2026 12:54
@jaysoo jaysoo requested a review from FrozenPandaz March 25, 2026 12:54
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 25, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit b7bf7fb
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69c4095af17625000897e9b0
😎 Deploy Preview https://deploy-preview-35011--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 25, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit b7bf7fb
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69c40c9d1c0188c3144d500b
😎 Deploy Preview https://deploy-preview-35011--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Mar 25, 2026

View your CI Pipeline Execution ↗ for commit b7bf7fb

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 11m 3s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 7s View ↗
nx-cloud record -- pnpm nx conformance:check ✅ Succeeded 7s View ↗
nx build workspace-plugin ✅ Succeeded 1m 24s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-25 16:29:25 UTC

@jaysoo jaysoo force-pushed the NXC-4141 branch 2 times, most recently from 49c1601 to e9d63ed Compare March 25, 2026 13:15
Comment thread packages/create-nx-workspace/src/utils/git/git.ts Outdated
Comment thread packages/create-nx-workspace/src/utils/git/git.ts
@jaysoo jaysoo requested a review from FrozenPandaz March 25, 2026 14:53
@jaysoo jaysoo force-pushed the NXC-4141 branch 5 times, most recently from dfc4e82 to 96a4710 Compare March 25, 2026 16:09
## Current Behavior

The `pushToGitHub` flow calls `gh api user` and `gh repo create --push`
with no timeout via `spawnAndWait()`/`execAndWait()`. When gh CLI is
wrapped by 1Password SSH agent, credential managers with GUI prompts,
SSH keys with passphrases, or corporate SSO, these calls hang
indefinitely—freezing the CLI after workspace creation with no
indication of what's happening. YTD data shows a 96.3% failure rate
(16,426 failures out of 17,058 attempts).

## Expected Behavior

- The initial `gh` auth check (`gh api user`) has a 2-second timeout.
  If gh is slow to respond (hung on credential prompt), the push flow
  is skipped gracefully instead of freezing.
- The `gh repo create --push` command has a 60-second timeout. If the
  push hangs, the process is killed and a helpful message is shown.
- If `gh` CLI is not installed, the push flow is skipped immediately
  without attempting any network calls.
- Error messages now include actionable fallback: "You can push manually
  with: git push -u origin main".

## Related Issue(s)

Fixes NXC-4141
@FrozenPandaz FrozenPandaz merged commit 96537f8 into master Mar 25, 2026
24 checks passed
@FrozenPandaz FrozenPandaz deleted the NXC-4141 branch March 25, 2026 18:29
FrozenPandaz pushed a commit that referenced this pull request Mar 26, 2026
)

## Current Behavior

The `pushToGitHub` flow in create-nx-workspace calls `gh api user` and
`gh repo create --push` with no timeout. When `gh` CLI is wrapped by
1Password SSH agent, credential managers with GUI prompts, SSH keys with
passphrases, or corporate SSO, these calls hang indefinitely — freezing
the CLI after workspace creation with no indication of what's happening.

YTD data shows a **96.3% failure rate** (16,426 failures out of 17,058
push attempts).

## Expected Behavior

- The initial `gh` auth check (`gh api user`) has a **2-second
timeout**. If `gh` is slow to respond (hung on credential prompt), the
push flow is skipped gracefully instead of freezing.
- The `gh repo create --push` command has a **15-second timeout**. If
the push hangs, the process is killed and a helpful message is shown.
- If `gh` CLI is not installed, the push flow is skipped immediately
without attempting any network calls.
- Error messages now include actionable fallback: *"You can push
manually with: git push -u origin main"*.

The error is now captured in `recordStat` as well, so when users see
this we'll also see it in our stats.

<img width="1026" height="334" alt="image"
src="https://github.com/user-attachments/assets/10c0b4a8-9083-4063-9558-88ebb8a5a850"
/>

## Related Issue(s)

Fixes #34482, NXC-4141

(cherry picked from commit 96537f8)
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npx create-nx-workspace produces error.log file

2 participants