[repository-quality] Repository Quality Improvement Report - Context Propagation & Process Cancellability (Reuse Run) #40796
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-06-23T14:52:49.737Z.
|
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
Analysis Date: 2026-06-22
Focus Area: Context Propagation & Process Cancellability
Strategy Type: Reuse (random=95, 10% tier)
Custom Area: No — highest-impact area; original 2026-06-03 (high: 3), confirmed zero progress 2026-06-09
Executive Summary
exec.CommandContextadoption grew from 18% → 23.9% since June 9:run_push.gowas fixed (4 git ops now use CommandContext) and theexeccommandwithoutcontextlinter was added. These are meaningful wins.102 bare
exec.Commandcalls remain in production source. The linter guards new ctx-receiving functions, but cannot force ctx threading into utility functions that don't yet accept ctx. The biggest gaps arepkg/cli/git.go(18 calls, 8 uncancellable git utilities),pkg/cli/pr_command.go(20 calls inapplyPatchToRepo), andpkg/cli/trial_helpers.go(5 calls incopyTrialResultsToHostRepo). One active linter violation also exists inremote_fetch.go:628.Full Analysis Report
Current State Assessment
exec.Command(non-test, non-testdata)exec.CommandContext(non-test, non-testdata)run_push.gofixed since June 9execcommandwithoutcontextlinter activeProgress since 2026-06-09:
pushWorkflowFilesinpkg/cli/run_push.go— FIXED (4 git ops use CommandContext) ✅execcommandwithoutcontextlinter registered incmd/linters/main.go+spec_test.go✅Findings
Strengths
run_push.gois now fully context-awareexeccommandwithoutcontextlinter prevents new violations in ctx-receiving functionsmcp_inspect_mcp.goalready correctly usesexec.CommandContextfor both docker and command pathsAreas for Improvement
pkg/parser/remote_fetch.go:628— active linter violation:downloadFileViaGit(ctx, ...)calls bareexec.Command("git", "archive", ...)— one-line fixpkg/cli/git.go— 18 bareexec.Commandacross 8 functions with no ctx param; all called from ctx-aware callerspkg/cli/trial_helpers.go:282—copyTrialResultsToHostRepo(5 bare calls) invoked fromexecuteTrialRun(ctx, ...)without threading ctxpkg/cli/pr_command.go:257—applyPatchToRepo(20 bare calls);transferPRcaller also lacks ctxDetailed Analysis
pkg/cli/git.gogap summary:Functions
createAndSwitchBranch,switchBranch,commitChanges,pushBranch,checkCleanWorkingDirectory,stageAllChanges,stageWorkflowChanges,ensureGitAttributes— 18 bare exec.Command calls total, called frompkg/cli/pr_helpers.gowhich is already invoked with cobracmd.Context().Active linter violation in
remote_fetch.go:🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Fix Active Linter Violation in
downloadFileViaGitPriority: High
Estimated Effort: Small
Focus Area: Context Propagation
Description:
downloadFileViaGitinpkg/parser/remote_fetch.goreceivesctxbut calls bareexec.Command("git", "archive", ...)at line 628.Acceptance Criteria:
exec.Command("git", "archive", ...)at line 628 →exec.CommandContext(ctx, "git", "archive", ...)#nosec G204comment preservedmake lintpassesCode Region:
pkg/parser/remote_fetch.go:628Task 2: Add
ctxtopkg/cli/git.goUtility FunctionsPriority: High
Estimated Effort: Large
Focus Area: Context Propagation
Description: 8 git utility functions in
pkg/cli/git.gohave 18 bareexec.Commandcalls and noctxparameter. All are called from cobra RunE handlers (which havecmd.Context()) viapkg/cli/pr_helpers.go.Acceptance Criteria:
createAndSwitchBranch,switchBranch,commitChanges,pushBranch,checkCleanWorkingDirectory,stageAllChanges,stageWorkflowChanges,ensureGitAttributesgainctx context.Contextfirst parameterexec.Command→exec.CommandContext(ctx, ...)pr_helpers.goandadd_interactive_git.goupdated to pass ctxmake lintandmake testpassCode Region:
pkg/cli/git.go,pkg/cli/pr_helpers.goTask 3: Thread
ctxThroughcopyTrialResultsToHostRepoPriority: Medium
Estimated Effort: Small
Focus Area: Context Propagation
Description:
copyTrialResultsToHostRepoinpkg/cli/trial_helpers.go(line 282) has 5 bareexec.Commandgit operations. Called fromexecuteTrialRun(ctx, ...)at line 183 without passing ctx.Acceptance Criteria:
copyTrialResultsToHostRepogainsctx context.Contextfirst parameterexec.Command→exec.CommandContext(ctx, ...)ctxmake lintandmake testpassCode Region:
pkg/cli/trial_helpers.go:282Task 4: Thread
ctxThroughapplyPatchToRepoandtransferPRPriority: Medium
Estimated Effort: Medium
Focus Area: Context Propagation
Description:
applyPatchToRepo(line 257) has 20 bareexec.Commandcalls; its callertransferPR(line 536) also lacks ctx. The cobra RunE handler providescmd.Context().Acceptance Criteria:
applyPatchToRepogainsctx context.Contextfirst parameter; 20 bare calls →exec.CommandContext(ctx, ...)transferPRgainsctx context.Context; passes toapplyPatchToRepoNewPRTransferSubcommandRunE passescmd.Context()totransferPRmake lintandmake testpassCode Region:
pkg/cli/pr_command.go:257,536📊 Historical Context
Previous Focus Areas (last 5)
🎯 Recommendations
Immediate Actions (This Week)
remote_fetch.go:628linter violation — Priority: High (one-line change)Short-term Actions (This Month)
pkg/cli/git.goutility functions — Priority: HighcopyTrialResultsToHostRepo— Priority: MediumLong-term Actions (This Quarter)
applyPatchToRepo/transferPR— Priority: Medium📈 Success Metrics
pkg/cli/git.gofunctions with ctx: 0/8 → 8/8Next Steps
References:
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgSee Network Configuration for more information.
Beta Was this translation helpful? Give feedback.
All reactions