Skip to content

fix(git): run git and gh non-interactively so prompts can't hang the tools - #1365

Open
Piyushrathoree wants to merge 1 commit into
Nano-Collective:mainfrom
Piyushrathoree:fix/git-exec-noninteractive-1344
Open

Piyushrathoree wants to merge 1 commit into
Nano-Collective:mainfrom
Piyushrathoree:fix/git-exec-noninteractive-1344

Conversation

@Piyushrathoree

Copy link
Copy Markdown

Fixes #1344.

Description

execProcess in source/tools/git/utils.ts spawned git and gh with inherited stdin, no GIT_TERMINAL_PROMPT, and no timeout. Anything that asked for input (a credential helper, a pre-commit hook reading stdin) blocked forever, and since every git_* tool and git_pr go through it, the whole process froze.

Now stdin is ignore, GIT_TERMINAL_PROMPT=0 is set (same as skills/install.ts already does for clone), and a 60s timeout kills the child and rejects. The timeout settles immediately instead of waiting on close, because a helper git spawned (ssh, gpg, credential manager) can still hold the stderr pipe and keep close from ever firing.

GIT_TERMINAL_PROMPT=0 only covers git's own credential prompt. SSH passphrase and gpg pinentry read the tty directly, so those are caught by the timeout rather than prevented. 60s matches CLONE_TIMEOUT_MS; git_commit runs hooks under it, so happy to raise it if that feels tight.

Testing

  • Two new tests in utils.spec.ts check GIT_TERMINAL_PROMPT reaches the child and that a !cat alias returns instead of blocking. Both fail (the second hangs) against the old code.
  • git ls-remote on an HTTPS repo with credential.helper= now fails in under a second with could not read Username ... terminal prompts disabled.
  • git_commit with a pre-commit hook that reads stdin completes.
  • A !sleep 300 alias rejects at 60s with Git command timed out after 60s, no orphan process.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

@github-actions github-actions Bot added the area:tools Tool implementations and tool-calling label Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

nc-review: nothing to raise

@Piyushrathoree — nothing to raise from the automated review.

The PR closes stdin and sets GIT_TERMINAL_PROMPT=0 in execProcess, matching the precedent in source/skills/install.ts, and adds a 60s timeout that settles independently of the close event so a credential helper holding the stderr pipe cannot freeze the promise. The two new tests exercise both fixes via !printenv and !cat git aliases. The changeset is well-formed, the package name resolves, and the change is scoped to exactly what issue #1344 asked for.


🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional

Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with /re-review.

@github-actions github-actions Bot added the agent:clean nc-review had nothing to raise label Sep 17, 2026
@akramcodez

Copy link
Copy Markdown
Member

Hey @Piyushrathoree, one of the required tests is currently failing. Could you fix that? Once it’s resolved I’ll review the PR.

@Piyushrathoree
Piyushrathoree force-pushed the fix/git-exec-noninteractive-1344 branch from 74e4dce to ac27a7c Compare September 18, 2026 11:55
@Piyushrathoree
Piyushrathoree force-pushed the fix/git-exec-noninteractive-1344 branch from ac27a7c to 613e494 Compare September 18, 2026 11:56
@Piyushrathoree

Copy link
Copy Markdown
Author

@akramcodez its passing locally not sure why its failing over here
image

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

Labels

agent:clean nc-review had nothing to raise area:tools Tool implementations and tool-calling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] execProcess in git tools lacks stdin closure, credentials timeout, and GIT_TERMINAL_PROMPT=0

2 participants