Description
pkg/cli/git.go and pkg/cli/pr_command.go spawn subprocesses via exec.Command( (20 call sites each, confirmed via grep -c) instead of exec.CommandContext(. Ctrl-C and configured timeouts cannot stop these subprocesses — a hung git/gh call blocks the whole command tree. Context-aware variants already exist elsewhere in the codebase (RunGHContext), so this is plumbing, not new design.
Expected Impact
Git/PR CLI operations become cancellable and respect caller timeouts, closing the two highest-concentration violation sites of this pattern in the repo.
Suggested Fix
Thread a ctx context.Context parameter through the affected functions in both files, replace exec.Command with exec.CommandContext(ctx, ...), and update callers (ultimately from cmd.Context()).
Acceptance Criteria
Suggested Agent
Go-focused agent comfortable with pkg/cli subprocess helpers.
Estimated Effort
Medium (1-4 hours).
Data Source
Repository Quality: Context Propagation & Cancellation Hygiene — 2026-10-06 (#66149), Task 1 (High priority). Verified via grep -c "exec\.Command(" pkg/cli/git.go pkg/cli/pr_command.go = 20/20, zero CommandContext in either file.
Generated by 🔬 Deep Report · claude · agent · 421.8 AIC · ⌖ 9.14 AIC · ⊞ 7.1K · ◷
Description
pkg/cli/git.goandpkg/cli/pr_command.gospawn subprocesses viaexec.Command((20 call sites each, confirmed viagrep -c) instead ofexec.CommandContext(. Ctrl-C and configured timeouts cannot stop these subprocesses — a hunggit/ghcall blocks the whole command tree. Context-aware variants already exist elsewhere in the codebase (RunGHContext), so this is plumbing, not new design.Expected Impact
Git/PR CLI operations become cancellable and respect caller timeouts, closing the two highest-concentration violation sites of this pattern in the repo.
Suggested Fix
Thread a
ctx context.Contextparameter through the affected functions in both files, replaceexec.Commandwithexec.CommandContext(ctx, ...), and update callers (ultimately fromcmd.Context()).Acceptance Criteria
exec.Command(remains inpkg/cli/git.goorpkg/cli/pr_command.gomake test-unitpassesmake fmtrun after changesSuggested Agent
Go-focused agent comfortable with
pkg/clisubprocess helpers.Estimated Effort
Medium (1-4 hours).
Data Source
Repository Quality: Context Propagation & Cancellation Hygiene — 2026-10-06 (#66149), Task 1 (High priority). Verified via
grep -c "exec\.Command(" pkg/cli/git.go pkg/cli/pr_command.go= 20/20, zeroCommandContextin either file.