Description
Three convenience wrappers in pkg/workflow/github_cli.go hard-code context.Background() even though all callers already hold a live signal-propagating context. This creates silent cancellation dead zones: when a user presses Ctrl+C the signal context is cancelled, but any call routed through these wrappers continues running until it times out.
Affected Functions
ExecGH → should call ExecGHContext(ctx, ...)
RunGH → should call RunGHContext(ctx, ...)
RunGHCombined → should call RunGHCombinedContext(ctx, ...)
Context-aware siblings (ExecGHContext, RunGHContext, RunGHCombinedContext) already exist in the same file — the fix is to thread ctx from callers instead of hard-coding context.Background().
Scope
- 92 downstream call sites are affected
- Entry-points already wire
signal.NotifyContext correctly in cmd/gh-aw/main.go and pkg/cli/forecast.go
- The fix propagates that cancellation signal through the entire compiler pipeline
Suggested Changes
- Update
ExecGH, RunGH, RunGHCombined to accept ctx context.Context as first arg and delegate to the *Context siblings
- Update all 92 call sites to pass their local
ctx
- Verify
make test-unit passes
Files Affected
pkg/workflow/github_cli.go (3 functions)
- All callers in
pkg/workflow/, pkg/cli/, pkg/compiler/ (~92 sites)
Success Criteria
grep -r "ExecGH(\|RunGH(\|RunGHCombined(" --include=*.go pkg/ cmd/ returns 0 non-context call sites
- All existing tests pass
- Ctrl+C at any point cancels in-flight gh CLI subprocesses
Source
Extracted from discussion #48389 — context.Background() Call-Chain Leakage
Priority
High — affects 92 call sites, degrades signal-aware lifecycle and user-visible Ctrl+C responsiveness
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · sonnet46 · 42.7 AIC · ⌖ 5.66 AIC · ⊞ 7.2K · ◷
Description
Three convenience wrappers in
pkg/workflow/github_cli.gohard-codecontext.Background()even though all callers already hold a live signal-propagating context. This creates silent cancellation dead zones: when a user presses Ctrl+C the signal context is cancelled, but any call routed through these wrappers continues running until it times out.Affected Functions
ExecGH→ should callExecGHContext(ctx, ...)RunGH→ should callRunGHContext(ctx, ...)RunGHCombined→ should callRunGHCombinedContext(ctx, ...)Context-aware siblings (
ExecGHContext,RunGHContext,RunGHCombinedContext) already exist in the same file — the fix is to threadctxfrom callers instead of hard-codingcontext.Background().Scope
signal.NotifyContextcorrectly incmd/gh-aw/main.goandpkg/cli/forecast.goSuggested Changes
ExecGH,RunGH,RunGHCombinedto acceptctx context.Contextas first arg and delegate to the*Contextsiblingsctxmake test-unitpassesFiles Affected
pkg/workflow/github_cli.go(3 functions)pkg/workflow/,pkg/cli/,pkg/compiler/(~92 sites)Success Criteria
grep -r "ExecGH(\|RunGH(\|RunGHCombined(" --include=*.go pkg/ cmd/returns 0 non-context call sitesSource
Extracted from discussion #48389 — context.Background() Call-Chain Leakage
Priority
High — affects 92 call sites, degrades signal-aware lifecycle and user-visible Ctrl+C responsiveness