Description
Several call sites hide context.Background() behind non-context wrapper functions or root their own context instead of accepting one from a caller, confirmed by direct read:
pkg/workflow/github_cli.go:105,190,212 — setupGHCommand, and gh-command helpers call context-aware variants (RunGHContext, RunGHCombinedContext) but hardcode context.Background() instead of taking a ctx parameter.
pkg/cli/logs_parsing_javascript.go:65-76 — three call sites to runSessionParser(WithSources) all pass context.Background() directly.
pkg/cli/logs_parsing_persisted.go:40,52 — same pattern.
copilot_agents.go:202, experiments_command.go:335, branch_file_reader.go:19 — additional single-site instances.
Repo-wide, there are ~58 production context.Background() calls (grep -rn "context\.Background()" --include="*.go" pkg/ | grep -v _test.go); this issue targets the subset that sit in call chains that already have a cmd.Context() or caller ctx available but don't plumb it through.
Expected Impact
Reduces hidden un-cancellable roots in commonly-hit code paths (gh CLI wrapper helpers, log parsing); the context-aware variants already exist, so this is wiring, not new design.
Suggested Fix
Add a ctx context.Context parameter to the non-context wrappers in github_cli.go (deprecate or remove the bare variants once callers migrate), and thread cmd.Context() down through logs_parsing_javascript.go / logs_parsing_persisted.go to their runSessionParser calls.
Acceptance Criteria
Suggested Agent
Go-focused agent familiar with pkg/workflow/github_cli.go and the CLI command tree.
Estimated Effort
Medium (1-4 hours) — mechanical but touches several files.
Data Source
Repository Quality: Context Propagation & Cancellation Hygiene — 2026-10-06 (#66149), Task 3.
Generated by 🔬 Deep Report · claude · agent · 421.8 AIC · ⌖ 9.14 AIC · ⊞ 7.1K · ◷
Description
Several call sites hide
context.Background()behind non-context wrapper functions or root their own context instead of accepting one from a caller, confirmed by direct read:pkg/workflow/github_cli.go:105,190,212—setupGHCommand, and gh-command helpers call context-aware variants (RunGHContext,RunGHCombinedContext) but hardcodecontext.Background()instead of taking actxparameter.pkg/cli/logs_parsing_javascript.go:65-76— three call sites torunSessionParser(WithSources)all passcontext.Background()directly.pkg/cli/logs_parsing_persisted.go:40,52— same pattern.copilot_agents.go:202,experiments_command.go:335,branch_file_reader.go:19— additional single-site instances.Repo-wide, there are ~58 production
context.Background()calls (grep -rn "context\.Background()" --include="*.go" pkg/ | grep -v _test.go); this issue targets the subset that sit in call chains that already have acmd.Context()or caller ctx available but don't plumb it through.Expected Impact
Reduces hidden un-cancellable roots in commonly-hit code paths (gh CLI wrapper helpers, log parsing); the context-aware variants already exist, so this is wiring, not new design.
Suggested Fix
Add a
ctx context.Contextparameter to the non-context wrappers ingithub_cli.go(deprecate or remove the bare variants once callers migrate), and threadcmd.Context()down throughlogs_parsing_javascript.go/logs_parsing_persisted.goto theirrunSessionParsercalls.Acceptance Criteria
context.Background()make test-unitpassesSuggested Agent
Go-focused agent familiar with
pkg/workflow/github_cli.goand the CLI command tree.Estimated Effort
Medium (1-4 hours) — mechanical but touches several files.
Data Source
Repository Quality: Context Propagation & Cancellation Hygiene — 2026-10-06 (#66149), Task 3.