[sergo] Sergo Report: 24th-Linter execcommandwithoutcontext — Control-Flow Precision & Enforce-Readiness - 2026-06-10 #38283
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.
-
Executive Summary
Run R32 detected a tool change — the 24th custom linter,
execcommandwithoutcontext, has landed (cmd/linters/main.go:52). Notably, it landed fully documented, breaking the 2-runnew_linter_doc_lagstreak: the team now syncsdoc.go,README.md, andspec_test.goat landing. With the doc-sync and syntactic-precision angles closed, this run pivoted to a control-flow precision audit and uncovered a novel false-positive class plus a clean enforce-readiness path.execcommandwithoutcontext).#38281,#38282). Status: ✅Critical Findings
1. Nil-guard false positive — unsafe autofix (Issue
#38281)execcommandwithoutcontextflagsexec.Commandin the nil branch of an explicit guard:On this path
ctxis provablynil, and the suggested fixexec.CommandContext(ctx, ...)panics at runtime (Go'sexec.CommandContextpanics on a nil context). This is the intentional dual-path behindExecGH(nil) /ExecGHContext(ctx). The diagnostic is wrong and the autofix is unsafe.2. Genuine context-propagation gap (Issue
#38282)connectStdioMCPServer(pkg/cli/mcp_inspect_mcp.go:150, :155) receives a real 30s-timeoutctxbut spawns subprocesses withexec.Command, so the MCP server process is not bound to the timeout. Safe to convert toexec.CommandContext(ctx, ...).Strategy: 50/50 Split
Cached reuse (50%) — reverify + apply established patterns
doc.go/README/spec_testand uses type identity). Theteam_closes_fastpattern holds — zero opensergoissues.new_linter_doc_lagto the 24th linter → gap = 0.doc.gosays "All 24",documentedAnalyzers()has 24 entries includingexeccommandwithoutcontext. Pattern downgraded from "automatic finding" to "watch".new_linter_precision_audit→ the analyzer uses type identity (ObjectOf -> *types.PkgName -> Imported().Path() == "os/exec",types.Identicalfor ctx), so there is no syntactic-match bug like sortslice had.New exploration (50%) — control-flow precision + enforce-readiness
With type-identity clean, the audit pivoted to control-flow precision and violation triage:
exec.Commandsites across 30 files; mapped each to its enclosing function to find which are inside context-receiving functions.github_cli.go:32(FP),mcp_inspect_mcp.go:150and:155(genuine).if ctx != nil { CtxVariant } else { PlainVariant }dual-path APIs are mis-flagged, and autofixing into the nil path panics.internal/nolintsupport (cannot suppress the FP), making it a prerequisite for enforcement.Run targets: ≥1 proven-to-land precision issue; a concrete enforce roadmap for the new linter; cache + pattern updates. All met.
Generated Tasks
#38281execcommandwithoutcontext.gorun()+ testdata#38282mcp_inspect_mcp.go, linter,cgo.ymlMetrics
cgo.yml:1122)Historical context
lenstringzero— undocumented (doc-lag) → lenstringzero (22nd custom linter) is registered in the driver but undocumented — sync doc.go, README, and spec_test to 22 analy [Content truncated due to length] #37740/lenstringzero precision: flag len() stored in an intermediate variable (n := len(s); n == 0) using the alias-tracking pattern th [Content truncated due to length] #37741 landed.sortslice— undocumented (doc-lag) + syntactic-match precision → sortslice (23rd custom linter) is registered in the driver but undocumented — sync doc.go, README, and spec_test to 23 analyzers #38028/sortslice precision: match sort.Slice/SliceStable via package identity (pass.TypesInfo), not the syntactic identifier name "sort [Content truncated due to length] #38029 landed.execcommandwithoutcontext— documented at landing (no doc-lag), type-identity correct → pivoted to control-flow precision.The doc-lag pattern (confirmed 2×) broke this run — evidence the team internalized sergo's repeated doc-sync findings.
Recommendations
#38281first — it is the blocker for enforcement and the autofix is currently unsafe.#38282— convert the 2 MCP sites, addinternal/nolint, append the 13th CI flag.ctxbackgroundfor the same nil-guard FP class (it is the other context-propagation linter).Next-Run Focus (R33)
#38281+#38282landed.new_linter_doc_lag(expect gap 0 now) then precision audit (type identity → then control-flow/nil-guard).lenstringzeroenforce-roadmap;sortsliceenforce auto-follows the lint-monster migration ([lint-monster] Sort Type-Safety: Migrate from sort.Slice to slices.SortFunc #38012/[lint-monster] Migrate unsafe sort.Slice calls to type-safe slices.SortFunc #38014).References: §27254549539
Beta Was this translation helpful? Give feedback.
All reactions