[repository-quality] Context Propagation & Process Cancellability — Reuse Run #38123
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-06-10T13:54:32.783Z.
|
Beta Was this translation helpful? Give feedback.
0 replies
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 & Process Cancellability (Reuse)
Analysis Date: 2026-06-09
Focus Area: Context Propagation & Process Cancellability
Strategy Type: Reuse (random=93, 10% tier — most impactful area from last 10 runs)
Custom Area: No
Executive Summary
Zero progress has been made since the June 3 analysis. The repository still has 109 bare
exec.Commandcalls in non-test Go source across 32 files, versus only 24exec.CommandContextcalls — a context-adoption rate of 18%. This means 82% of subprocess spawns are completely un-cancellable regardless of timeouts or signals held by callers.The most acute risk is in network-touching operations:
pkg/parser/remote_fetch.gospawns 13 git processes (clone, ls-remote, archive, ls-tree) with no cancellation hooks, andpkg/cli/run_push.goexecutes git push/commit/stage without thectxthat its callers already hold. The existingctxbackgroundlinter coverscontext.Background()misuse but does not flagexec.Commandcalled inside functions that already receive acontext.Context.Current State Assessment
Metrics Collected:
exec.Command(non-test)exec.CommandContext(non-test)exec.Commandpkg/cli/git.gobare callspkg/parser/remote_fetch.gobare callspkg/cli/run_push.gobare callspkg/workflow/git_helpers.gobare callsctxbackgroundlinter scopecontext.Background()onlyKey Findings:
pushWorkflowFiles()inrun_push.go(line 373) has 4 git subprocess calls; callers hold ctx but do not pass itpkg/cli/git.go: 18 bare calls, no function in file accepts ctx — push, commit, checkout all un-cancellablepkg/parser/remote_fetch.go: 13 network-touching git calls in functions with no ctx parameterpkg/workflow/github_cli.gohas a workingsetupGHCommand(ctx, ...)pattern that serves as a templatectxbackgroundlinter exists but does not catchexec.Commandin context-receiving functions🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Thread Context into
pushWorkflowFilesinrun_push.goPriority: High
Estimated Effort: Small
Focus Area: Context Propagation
Description:
pushWorkflowFiles()(line 373) executes 4 git subprocesses (lines 387, 400, 543, 557) using bareexec.Command. Addctx context.Contextas the first parameter and replace all four calls withexec.CommandContext(ctx, ...). Update call sites.Acceptance Criteria:
pushWorkflowFiles(ctx context.Context, ...)signature updatedexec.Command("git", ...)inside function converted toexec.CommandContext(ctx, "git", ...)go build ./...passesCode Region:
pkg/cli/run_push.goTask 2: Add Context-Aware Git Variants in
pkg/cli/git.goPriority: High
Estimated Effort: Medium
Focus Area: Context Propagation
Description:
pkg/cli/git.gohas 18 bareexec.Commandcalls; no function accepts a context. Network-touching functions —getCurrentBranch,createAndCheckoutBranch,checkoutBranch,commitAll,pushBranch,getGitStatus,stageWorkflowChanges— should acceptctx context.Contextand useexec.CommandContext. Follow the pattern inpkg/workflow/github_cli.go::setupGHCommand.Acceptance Criteria:
pkg/cli/git.goacceptctx context.Contextexec.Commandreplaced withexec.CommandContext(ctx, ...)in those functionspkg/cli/updated to pass ctx from cobra command contextgo build ./...passesCode Region:
pkg/cli/git.goTask 3: Add
execcommandnocontextLinterPriority: Medium
Estimated Effort: Medium
Focus Area: Context Propagation
Description: Create an analyzer
pkg/linters/execcommandnocontext/that flagsexec.Command(...)calls inside functions already receiving acontext.Contextparameter. Modeled afterpkg/linters/ctxbackground/. Register incmd/linters/main.go, add tospec_test.goandREADME.md.Acceptance Criteria:
pkg/linters/execcommandnocontext/execcommandnocontext.gocreatedexec.Command(...)in functions with acontext.Contextparameter; suggestsexec.CommandContext(<ctx_param>, ...)filecheck.IsTestFilecmd/linters/main.gopkg/linters/spec_test.goandpkg/linters/README.mdpkg/linters/execcommandnocontext/testdata/go test ./pkg/linters/...passesCode Region:
pkg/linters/execcommandnocontext/,cmd/linters/main.go,pkg/linters/spec_test.goTask 4: Thread Context into
git_helpers.goand Keyremote_fetch.goOperationsPriority: Medium
Estimated Effort: Medium
Focus Area: Context Propagation
Description:
runGitWithSpinner/RunGitCombinedingit_helpers.gouse bareexec.Command. Also updateresolveRefToSHAViaGit,downloadFileViaGit,downloadFileViaGitCloneinremote_fetch.goto accept ctx and useexec.CommandContext.Acceptance Criteria:
runGitWithSpinner(ctx context.Context, ...)andRunGitCombined(ctx, ...)updatedRunGitCombinedpass ctxresolveRefToSHAViaGit,downloadFileViaGit,downloadFileViaGitCloneaccept ctx and useexec.CommandContextgo build ./...passesCode Region:
pkg/workflow/git_helpers.go,pkg/parser/remote_fetch.go📊 Historical Context
Previous Focus Areas (last 5)
🎯 Recommendations
Immediate Actions (This Week)
pushWorkflowFiles()— 4 call sites, quick win — Priority: Highpkg/cli/git.go— Priority: HighShort-term Actions (This Month)
execcommandnocontextlinter to prevent regression — Priority: Mediumgit_helpers.go+ top-riskremote_fetch.gofunctions — Priority: MediumLong-term Actions (This Quarter)
📈 Success Metrics
Next Steps
References: §27210400253
Beta Was this translation helpful? Give feedback.
All reactions