Skip to content

feat(skillsinit): replace git subprocesses with go-git - #3627

Open
ekam-walia wants to merge 1 commit into
kagent-dev:mainfrom
ekam-walia:subprocess-git
Open

ekam-walia wants to merge 1 commit into
kagent-dev:mainfrom
ekam-walia:subprocess-git

Conversation

@ekam-walia

Copy link
Copy Markdown

Summary

  • Replaced os/exec git CLI calls (runGitIn) in go/core/internal/skillsinit/git.go with the pure-Go github.com/go-git/go-git/v5 library.
  • Updated git materialization test helpers in go/core/pkg/agentplugins/materialize_test.go to initialize and commit repositories using go-git in-process.
  • Threaded context.Context through CloneGitCommit to ensure that network operations cleanly abort on context cancellation or timeouts, resolving [BUG] skills-init hangs forever when the git server goes silent mid-clone (git runs with no timeout) #3452 (clones hanging when git servers stall).

Changes

  1. go/core/internal/skillsinit/git.go:
    • Swapped out shell commands (git init, remote add, fetch, checkout) for go-git API calls.
    • Added context-aware fetching via repo.FetchContext(ctx, ...).
  2. go/core/pkg/agentplugins/materialize.go:
    • Passed ctx into skillsinit.CloneGitCommit.
  3. go/core/pkg/agentplugins/materialize_test.go & git_test.go:
    • Refactored test repository initializers to use go-git.
    • Added unit test coverage for context timeout / hung server handling (TestCloneGitCommitHonorsContextTimeout).

Testing

  • Verified all unit tests pass successfully under -race.
  • Verified zero dependency on a host git binary (PATH="" go test ./...).

Fixes #3588

@ekam-walia
ekam-walia requested a review from a team as a code owner November 10, 2026 09:33
@github-actions github-actions Bot added the enhancement New feature or request label Nov 10, 2026
@ekam-walia ekam-walia changed the title feat(skillsinit): replace git subprocesses with go-git (#3588, #3452) feat(skillsinit): replace git subprocesses with go-git Nov 10, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 10, 2026
@ekam-walia

Copy link
Copy Markdown
Author

/cc @timflannagan

@EItanya
EItanya requested a review from timflannagan November 10, 2026 13:39
@ekam-walia

Copy link
Copy Markdown
Author

Its just some linting error, fixing it ASAP

Signed-off-by: ekam-walia <164983405+ekam-walia@users.noreply.github.com>
@ekam-walia

Copy link
Copy Markdown
Author

Done I have also fixed the lint Error, It should pass now,
I am not aware about the security/snyk tests and require some help in those

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace git subprocesses with go-git

1 participant