Skip to content

[lint-monster] Fix privileged MCP CLI context propagation and goroutine panic containment #49028

Description

@github-actions

Summary

Custom lint scan found 2 targeted correctness findings in pkg/cli/mcp_tools_privileged.go:

  • 1x context.Background() usage where the existing context.Context parameter should be propagated
  • 1x goroutine launched without a top-level defer/recover panic containment block

These should be remediated together because they affect the same privileged MCP CLI codepath and likely the same helper flow.

Findings

  • pkg/cli/mcp_tools_privileged.go:255 — use the function's context.Context parameter instead of context.Background()
  • pkg/cli/mcp_tools_privileged.go:259 — wrap the goroutine body with a top-level defer func() { if r := recover(); r != nil { ... } }()

Expected outcome

  • Preserve cancellation/timeout behavior by threading the existing context through the subprocess/logging path.
  • Ensure any panic inside the launched goroutine is contained and reported instead of crashing the process.
  • Keep edits minimal and scoped to this file / helper path only.

Remediation checklist

  • Replace context.Background() with the already-available context.Context parameter.
  • Add a top-level panic recovery defer inside the launched goroutine.
  • Prefer the smallest targeted refactor needed; avoid unrelated cleanup.
  • Validate with make golint-custom.

Generated by 🧌 LintMonster · gpt54 · 35.3 AIC · ⌖ 7.93 AIC · ⊞ 5.3K ·

  • expires on Aug 5, 2026, 7:41 PM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions