Repository navigation
[repository-quality] Repository Quality Improvement Report - Subprocess Execution and Cancellation Hygiene #69359
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-10-17T13:04:40.685Z.
|
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 - Subprocess Execution and Cancellation Hygiene
Analysis Date: 2026-10-16
Focus Area: Subprocess Execution and Cancellation Hygiene
Strategy Type: Custom
Custom Area: Yes — the CLI shells out heavily to git/gh/docker/npm/pip; cancellation, timeouts and file permissions are repo-specific risks not covered by earlier runs.
Executive Summary
Non-test Go code under
pkg/has ~100exec.Command(calls versus ~68exec.CommandContext(calls. Theexeccommandwithoutcontextlinter only flags calls inside functions that already receive acontext.Context. Context-less helpers such asensureCleanGitWorktreeandresetGitWorktreeToHEADinpkg/cli/pr_command.go:262-281are called from ctx-aware flows yet cannot be cancelled.pkg/cli/git.goalone has 20exec.Commandcalls.File permissions are well centralised via
constants.FilePermPublic/Sensitive(~180 uses), with one stray literal (pkg/cli/edit_command.go:160).pkg/cli/dispatch.go:232,251writes workflow files withFilePermSensitive(0600); confirm this is intentional.Full Analysis Report
Focus Area: Subprocess Execution and Cancellation Hygiene
Current State Assessment
Metrics Collected:
exec.Command(non-test calls in pkgexec.CommandContext(non-test callsexec.Command((cli/workflow/parser)pkg/cli/git.goexec.Command callspkg/cli/pr_command.goexec.Command callsFindings
Strengths
pkg/constants/constants.go.Areas for Improvement
pkg/cli/git.goandpkg/cli/pr_command.gorun git without cancellation.docker pull/npm view/pip indexvalidators inpkg/workflow/*_validation.gohave no timeout.0o644literal inedit_command.go:160; verify 0600 in dispatch.go.🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Thread context through git helpers in pkg/cli/git.go
Priority: High
Estimated Effort: Medium
Focus Area: Subprocess cancellation
Description: Convert the 20
exec.Commandcalls ingit.gotoexec.CommandContext, adding a ctx parameter to helpers and updating callers.Acceptance Criteria:
exec.Command(remains inpkg/cli/git.gomake fmtand impacted unit tests passCode Region:
pkg/cli/git.goTask 2: Make PR transfer and trial git helpers cancellable
Priority: Medium
Estimated Effort: Small
Focus Area: Subprocess cancellation
Description:
ensureCleanGitWorktree,resetGitWorktreeToHEADand other calls inpr_command.goshould take ctx.Acceptance Criteria:
pr_command.gouse CommandContexttrial_helpers.goandtrial_repository.gowhere ctx is availableCode Region:
pkg/cli/pr_command.go,pkg/cli/trial_helpers.go,pkg/cli/trial_repository.goTask 3: Add timeouts to package validators
Priority: Medium
Estimated Effort: Small
Focus Area: Robustness
Description: docker/pip/npm validators run network subprocesses with no deadline; a hung registry stalls compilation.
Acceptance Criteria:
Code Region:
pkg/workflow/docker_validation.go,pkg/workflow/pip_validation.go,pkg/workflow/npm_validation.goTask 4: Extend linter and tidy permissions
Priority: Low
Estimated Effort: Medium
Focus Area: Tooling / permissions
Description: Extend
execcommandwithoutcontextto flag exec.Command in same-package helpers called from ctx-aware functions. Replace the literal inedit_command.go:160withconstants.FilePermPublic; review dispatch.go modes.Acceptance Criteria:
Code Region:
pkg/linters/execcommandwithoutcontext/,pkg/cli/edit_command.go,pkg/cli/dispatch.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
pkg/cli/git.goto context-aware exec — Priority: HighShort-term Actions (This Month)
Long-term Actions (This Quarter)
📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-10-17 — Focus area selected by diversity algorithm
All reactions