fix(version): remove git subprocess from bd version command (GH#1zonaz)
Some checks failed
CI / Check version consistency (push) Successful in 4s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 8m8s
CI / Lint (push) Failing after 2m39s
CI / Test Nix Flake (push) Failing after 54s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
Some checks failed
CI / Check version consistency (push) Successful in 4s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 8m8s
CI / Lint (push) Failing after 2m39s
CI / Test Nix Flake (push) Failing after 54s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
Under high concurrency (17+ agent sessions), each gt command invokes bd version to validate minimum beads version. The resolveBranch() function was spawning git subprocesses (git symbolic-ref) which caused severe contention and timeouts when many agents ran simultaneously. Changes: - Remove git subprocess fallback in resolveBranch() - Branch info now only comes from ldflags or build info's vcs.branch - Version number (what gt actually checks) is unaffected - Update documentation to reflect the change The fix reduces bd version from potentially 2 git subprocesses to zero, eliminating the contention issue under high agent concurrency. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,7 @@ The CLI is built on the Cobra framework and consists of command implementations
|
||||
|
||||
**Fallback Resolution Chain** (important for development):
|
||||
- The `resolveCommitHash()` function first checks the ldflag, then checks runtime build info, returning empty if neither is available
|
||||
- The `resolveBranch()` function checks ldflags, then build info's vcs.branch - it does NOT spawn git subprocesses (GH#1zonaz: prevents contention under high concurrency)
|
||||
- This allows the version command to work even in development environments where ldflags aren't set (useful for testing)
|
||||
|
||||
**Testing Coverage** (`@/cmd/bd/version_test.go`):
|
||||
@@ -85,6 +86,6 @@ The CLI is built on the Cobra framework and consists of command implementations
|
||||
**Platform-Specific Considerations**:
|
||||
- The git extraction in Makefile uses POSIX shell constructs compatible with bash on all platforms
|
||||
- Windows builds via goreleaser set ldflags identically to Unix platforms
|
||||
- The `symbolic-ref` fallback in resolveBranch works reliably even in fresh repos with no commits
|
||||
- Branch info comes from build-time ldflags or vcs.branch in build info - no runtime git calls (GH#1zonaz)
|
||||
|
||||
Created and maintained by Nori.
|
||||
|
||||
Reference in New Issue
Block a user