Repository navigation
[repository-quality] Repository Quality: Context Propagation & Cancellation Hygiene #66149
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
🎯 Repository Quality Improvement Report - Context Propagation & Cancellation Hygiene
Analysis Date: 2026-10-06
Focus Area: Context propagation & cancellation hygiene (Go)
Strategy Type: Custom
Custom Area: Yes — the repo already ships linters (
ctxbackground,execcommandwithoutcontext,timesleepnocontext,httpnoctx), so the question is how much real code still bypasses cancellation.Executive Summary
Non-test, non-linter code has ~92
exec.Command(call sites (vs ~56exec.CommandContext(), concentrated inpkg/cli/git.go(20),pkg/cli/pr_command.go(20),trial_repository.go(8),trial_helpers.go(5),shell_completion.go(4). Ctrl-C or timeouts cannot stop these subprocesses.About 30 production
context.Background()calls remain. Some are legitimate roots (forecast.gosignal context, shutdown timeouts), but others sit in call chains that could accept a ctx:logs_parsing_javascript.go:65-76,logs_parsing_persisted.go:40,52,copilot_agents.go:202,experiments_command.go:335,branch_file_reader.go:19,workflow/github_cli.go:105,190,212(non-context wrappers).Four
time.Sleepcalls remain in production code:run_workflow_tracking.go:73,trial_repository.go:199,update_extension_check.go:412,docker_validation.go:220. Nohttp.Get/NewRequestviolations found outside linter testdata.Full Analysis Report
Focus Area: Context propagation
Current State Assessment
exec.Command((prod)exec.CommandContext((prod)context.Background()(prod, excl. linters)time.Sleep(prod)http.Get/NewRequest(prod)Findings
Strengths
ctxutilhelper centralises nil-ctx handling.Areas for Improvement
pkg/clispawn uncancellable subprocesses.context.Background()(github_cli.go).time.Sleepcalls.Detailed Analysis
The context-aware variants (
RunGHContext,readRemoteRepoBranchFileContext) already exist, so most fixes are plumbing actxparameter to callers rather than new design.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Convert
exec.Commandin git/PR helpers toCommandContextPriority: High
Estimated Effort: Medium
Focus Area: Context propagation
Description: Thread
ctxthroughpkg/cli/git.goandpkg/cli/pr_command.gosubprocess calls.Acceptance Criteria:
exec.Command(remains in these two filesmake test-unitpassesCode Region:
pkg/cli/git.go,pkg/cli/pr_command.goTask 2: Convert trial helpers and misc CLI subprocesses
Priority: Medium
Estimated Effort: Medium
Focus Area: Context propagation
Description: Same conversion for
trial_repository.go,trial_helpers.go,shell_completion.go,add_interactive_git.go,poutine.go,shellcheck.go,update_merge.go,repo.go,experiments_state.go.Acceptance Criteria:
exec.Command(in these filesCode Region:
pkg/cli/trial_*.go,pkg/cli/shell_completion.go,pkg/cli/poutine.go,pkg/cli/shellcheck.goTask 3: Remove hidden
context.Background()in wrappers and log parsingPriority: Medium
Estimated Effort: Small
Focus Area: Context propagation
Description: Plumb ctx into
logs_parsing_javascript.go,logs_parsing_persisted.go,copilot_agents.go:202,experiments_command.go:335,branch_file_reader.go:19; deprecate/remove non-context wrappers inpkg/workflow/github_cli.go.Acceptance Criteria:
Code Region:
pkg/cli/logs_parsing_*.go,pkg/workflow/github_cli.goAdd ctx parameters and thread from command RunE (cmd.Context()) down to these call sites; migrate callers of non-context gh wrappers to the *Context variants.Task 4: Replace production
time.Sleepwith ctx-aware waitsPriority: Low
Estimated Effort: Small
Focus Area: Context propagation
Description: Use
select { case <-ctx.Done(): ... case <-time.After(d): }atrun_workflow_tracking.go:73,trial_repository.go:199,update_extension_check.go:412,docker_validation.go:220.Acceptance Criteria:
time.Sleepin prod codeCode Region: files listed above
Task 5: Verify linter enforcement in CI
Priority: Medium
Estimated Effort: Small
Focus Area: Linting
Description: Confirm
execcommandwithoutcontextandctxbackgroundrun againstpkg/cliin CI; if exempted, document and track a baseline that shrinks.Acceptance Criteria:
Code Region:
pkg/linters/registry.go,MakefileInvestigate why ~92 exec.Command sites are not failing the execcommandwithoutcontext linter and fix the configuration or document the baseline.📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
Short-term Actions (This Month)
Long-term Actions (This Quarter)
📈 Success Metrics
exec.Command: 92 → 0time.Sleep: 4 → 0Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-10-07 — Focus area selected by diversity algorithm
All reactions