Skip to content

Targeted custom-lint remediation for non-largefunc findings in CLI/workflow paths#47601

Merged
pelikhan merged 7 commits into
mainfrom
copilot/lint-monster-targeted-custom-lint-fixes
Jul 24, 2026
Merged

Targeted custom-lint remediation for non-largefunc findings in CLI/workflow paths#47601
pelikhan merged 7 commits into
mainfrom
copilot/lint-monster-targeted-custom-lint-fixes

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the non-largefunc findings from the lint-monster pass by applying narrow, behavior-preserving cleanups in the reported files only. The changes focus on path constant extraction, env coupling reduction, and small API/correctness/perf fixes.

  • Path constant cleanup

    • Extracted named constants for repository instruction directory descriptions in pkg/cli/copilot_agents.go (skill and agent path descriptors), removing repeated hard-coded literals.
  • Environment coupling reduction

    • Replaced direct os.Getenv calls with the existing lookupEnv abstraction in:
      • pkg/cli/bootstrap_profile_github_app.go
      • pkg/cli/bootstrap_profile_helpers.go
    • This keeps env access centralized and easier to override in tests/runtime wiring.
  • Correctness and API hygiene

    • Replaced nil context usage with context.Background() in pkg/workflow/github_cli.go.
    • Converted set-like maps from map[string]bool to map[string]struct{} in:
      • pkg/workflow/safe_outputs_tools_generation.go
      • pkg/workflow/workflow_builder.go
    • Removed redundant .Error() usage while preserving wrapped error chains in pkg/cli/bootstrap_profile_manifest.go.
    • Switched empty-string check style in pkg/workflow/llm_provider.go to idiomatic == "".
  • Context-aware timing in inspector flow

    • Replaced time.Sleep-based waits with select + context-aware timer handling in pkg/cli/mcp_inspect_inspector.go, so wait paths can terminate promptly on cancellation.

Example pattern applied:

// before
time.Sleep(mcpStdioServerStartupDelay)

// after
select {
case <-time.After(mcpStdioServerStartupDelay):
case <-gctx.Done():
	return gctx.Err()
}

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14.3 AIC · ⌖ 9.1 AIC · ⊞ 7K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14.3 AIC · ⌖ 9.1 AIC · ⊞ 7K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30035273314

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 18 AIC · ⌖ 10.1 AIC · ⊞ 7K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30042541462

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.1 AIC · ⌖ 9.05 AIC · ⊞ 7K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 9.66 AIC · ⌖ 8.72 AIC · ⊞ 7K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30053287301

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 22.6 AIC · ⌖ 7.33 AIC · ⊞ 7K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30057263862

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 32.9 AIC · ⌖ 8.04 AIC · ⊞ 7K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20.7 AIC · ⌖ 10.4 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 23, 2026 15:37
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix targeted custom-lint issues outside function-length backlog Targeted custom-lint remediation for non-largefunc findings in CLI/workflow paths Jul 23, 2026
Copilot AI requested a review from pelikhan July 23, 2026 15:51
@pelikhan
pelikhan marked this pull request as ready for review July 23, 2026 15:52
Copilot AI review requested due to automatic review settings July 23, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Targeted cleanup of non-largefunc lint findings across CLI and workflow code.

Changes:

  • Centralizes path and environment access.
  • Applies context, error-wrapping, and set-map fixes.
  • Makes MCP waits cancellation-aware.
Show a summary per file
File Description
pkg/workflow/workflow_builder.go Uses a struct-based set.
pkg/workflow/safe_outputs_tools_generation.go Uses a struct-based supported-values set.
pkg/workflow/llm_provider.go Simplifies empty-provider handling.
pkg/workflow/github_cli.go Replaces nil context with a background context.
pkg/cli/mcp_inspect_inspector.go Adds cancellation-aware waits.
pkg/cli/copilot_agents.go Extracts directory-description constants.
pkg/cli/bootstrap_profile_manifest.go Preserves wrapped error chains.
pkg/cli/bootstrap_profile_helpers.go Routes environment reads through lookupEnv.
pkg/cli/bootstrap_profile_github_app.go Centralizes GitHub App environment reads.
.github/workflows/daily-team-evolution-insights.lock.yml Regenerates strict-mode workflow output.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Medium

Comment thread pkg/cli/mcp_inspect_inspector.go
Comment thread .github/workflows/daily-team-evolution-insights.lock.yml
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #47601 does not have the 'implementation' label and has only 44 new lines of code in business logic directories (threshold: 100).

@github-actions github-actions Bot mentioned this pull request Jul 23, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

The Go changes are clean and correct — lookupEnv consolidation, %w error wrapping, map[string]struct{} idiom, context.Background(), and the context-aware select/time.After patterns are all good improvements.

Two blocking concerns (covered by existing inline comments):

  1. .github/workflows/daily-team-evolution-insights.lock.yml — this generated/source-managed file is changed in a way unrelated to lint remediation: strict:true is removed from the metadata header and GH_AW_COMPILED_STRICT is flipped to "false". Lock files for source-managed workflows must not be edited manually; use gh aw update or make recompile. Revert this file.

  2. pkg/cli/mcp_inspect_inspector.go line 186 — early return gctx.Err() on cancellation occurs before the cleanup defer is registered; stdio servers that have already started may not be properly terminated.

Please address these two issues before merging.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 18 AIC · ⌖ 5.7 AIC · ⊞ 5K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /codebase-design and /diagnosing-bugs — requesting changes on two correctness issues and one process concern.

📋 Key Themes & Highlights

Blocking Issues

  • Upstream-managed lock file edited directly (.github/workflows/daily-team-evolution-insights.lock.yml): Per repo rules, workflows with a source: frontmatter entry are provenance-managed and must be updated via gh aw update or upstream, not by hand-editing the .lock.yml. This change will be silently clobbered on the next update run.
  • Process leak on early context cancellation (mcp_inspect_inspector.go:186): The new gctx.Done() return path exits before the cleanup goroutine is registered, risking orphaned stdio server processes when cancellation arrives during startup.

Minor Improvement

  • Timer drain boilerplate (mcp_inspect_inspector.go:228–239): The manual timer.Stop() + drain after the select is unnecessary here — defer timer.Stop() is the idiomatic pattern and removes ~7 lines.

Positive Highlights

  • ✅ All Go-code changes are clean, idiomatic, and behavior-preserving
  • lookupEnv consolidation improves testability consistently across bootstrap paths
  • %w error wrapping in bootstrap_profile_manifest.go correctly preserves the error chain
  • context.Background() replacement in ExecGH removes a staticcheck suppression comment
  • map[string]struct{} conversions are idiomatic and appropriately applied

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 39.6 AIC · ⌖ 4.85 AIC · ⊞ 6.7K
Comment /matt to run again

Comment thread pkg/cli/mcp_inspect_inspector.go Outdated
Comment thread pkg/cli/mcp_inspect_inspector.go
Comment thread .github/workflows/daily-team-evolution-insights.lock.yml

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Two issues block merge

The non-largefunc lint fixes are generally clean — context-aware timers, map[string]struct{}, %w wrapping, and lookupEnv abstraction are all correct and idiomatic. However two items in this PR need to be resolved before merging.

🔍 Findings summary

Blocking

  1. Lock file strict-mode regression (.github/workflows/daily-team-evolution-insights.lock.yml) — strict: true was removed from the metadata header and GH_AW_COMPILED_STRICT was flipped to "false". This file is auto-generated and should not be manually edited. More critically, strict enforcement is now opt-in (requires GH_AW_POLICY_STRICT=true), inverting the original safety guarantee.
  2. Early context-cancel during MCP inspector startup leaves child processes alive (pkg/cli/mcp_inspect_inspector.go) — returning gctx.Err() before the cleanup defer fires means already-started stdio servers are orphaned on cancellation.

Non-blocking / correct as-is

  • context.Background() in ExecGH is semantically equivalent to nil for a never-cancelled context; removing the nolint comment is fine.
  • normalizeLLMProvider refactor is correct — alias lookup still uses the lowercased string.
  • Cleanup loop continuing on cancellation is intentional (drain all processes on shutdown).

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 · 45.8 AIC · ⌖ 4.59 AIC · ⊞ 5.7K
Comment /review to run again

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

… file

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done. Two issues addressed in commit fix: move cleanup defer before startup wait; sync daily insights lock file:

pkg/cli/mcp_inspect_inspector.go — moved the cleanup defer from after the if workflowFile != "" block to immediately after g, gctx := errgroup.WithContext(ctx), before any server is started. This ensures the defer is registered on all return paths, including context cancellation during the startup wait.

.github/workflows/daily-team-evolution-insights.lock.yml — the file was reverted to the pre-PR state and then make recompile was run. The drift check (check-workflow-drift) hard-fails if the lock file doesn't match the current compiler output. The diff is pre-existing compiler evolution (strict metadata encoding changed; the .md source never set strict: true). Including the recompile is required to pass the gate; the underlying source/lock mismatch is now resolved in this commit.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

Unresolved review feedback (newest first):

  • github-actions: review submitted 2026-07-23T16:11:33Z
  • github-actions: review submitted 2026-07-23T16:10:57Z
  • github-actions: review submitted 2026-07-23T16:10:48Z

Generated by 👨🍳 PR Sous Chef

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14.3 AIC · ⌖ 9.1 AIC · ⊞ 7K ·
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, ensure this branch is up to date, address the remaining requested changes, and summarize what still blocks merge readiness.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 9.66 AIC · ⌖ 8.72 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, ensure this branch is up to date, address the remaining requested changes, and summarize what still blocks merge readiness.

...

Branch is up to date with main. Local make fmt and make lint pass. No new commits or review threads since the last pass.

What blocks merge: The 3 CHANGES_REQUESTED reviews from github-actions[bot] (IDs 4766001031, 4766002139, 4766007014) are the sole blocker. They are stale — all were submitted against 12c3957 and both underlying issues have been fixed in subsequent commits:

  • Defer ordering (mcp_inspect_inspector.go): cleanup defer is at line 52, before any server starts or the cancellable wait runs. Fixed in dad1583.
  • Timer drain: replaced with defer timer.Stop() in 21956c4.
  • Lock file: the workflow has strict: false in its frontmatter and no source: entry; the current lock file is the correct compiler output; make check-workflow-drift passes.

The agent cannot dismiss CHANGES_REQUESTED reviews (GraphQL API unavailable in this environment). A maintainer must dismiss reviews 4766001031, 4766002139, and 4766007014 — then close/reopen the PR or push to re-trigger CI.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, make sure all replied review threads are fully resolved, and confirm the blocking review findings are addressed before rerunning checks.

Unresolved review threads with author/@copilot follow-up (newest first):

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 22.6 AIC · ⌖ 7.33 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, make sure all replied review threads are fully resolved, and confirm the blocking review findings are addressed before rerunning checks.

Unresolved review...

All code changes are in place and local validation passes. Here is the current state:

Thread status (all replied to in prior commits):

Thread Is Outdated Status
mcp_inspect_inspector.go — cleanup defer ordering (copilot-pull-request-reviewer) ❌ not outdated Code fix verified at line 52; reply posted
mcp_inspect_inspector.go — early return before defer (github-actions) ❌ not outdated Same fix at line 52; reply posted
mcp_inspect_inspector.go — timer drain (github-actions) ✅ outdated defer timer.Stop() at line 65; reply posted
daily-team-evolution-insights.lock.yml — lock file (copilot-pull-request-reviewer) ✅ outdated strict: false / no source: entry; reply posted
daily-team-evolution-insights.lock.yml — upstream-managed claim (github-actions) ✅ outdated Same; reply posted

Code verification:

  • defer func() cleanup is at line 52 (immediately after errgroup.WithContext(ctx) at line 47), before any server starts or the cancellable startup wait runs
  • defer timer.Stop() is at line 65 (replaces the old 7-line manual drain)
  • return gctx.Err() is at line 215 — cleanup defer is guaranteed to fire on this path

Local validation: make fmt and make agent-report-progress-no-test (fmt + lint + check-workflow-drift) all pass. No uncommitted changes.

CI runs on HEAD (285f19e): Three success "Addressing comment" runs. The action_required CGO/CWI/Doc runs have no failed jobs — they are pending human workflow approval gates.

Remaining blocker (requires human action): The GraphQL API is unavailable in this environment, so review threads cannot be resolved programmatically. A maintainer needs to:

  1. Resolve the two non-outdated threads (or dismiss the CHANGES_REQUESTED reviews from github-actions[bot])
  2. Re-trigger CI (close/reopen or workflow_dispatch) after the reviews are cleared

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage — §30057272009

Field Value
Category chore
Risk 🟡 Medium
Priority Score 48 / 100
Action 📦 batch_review
CI ✅ Passing
Review ⚠️ CHANGES_REQUESTED (bot, likely dismissed)
Batch lint-cli (with #47547)

Score breakdown: Impact 22 + Urgency 14 + Quality 12

Rationale: Targeted lint cleanup — path constants, env coupling, small API fixes. CI passing. Batch with #47547 for a combined chore review pass.

Next action: Review together with #47547 in a single batch session.

Generated by 🔧 PR Triage Agent · sonnet46 · 35.7 AIC · ⌖ 5.3 AIC · ⊞ 5.7K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, make sure all replied review threads are fully resolved, and confirm the blocking workflow lock-file change has been removed.

Unresolved review threads (newest first):

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 32.9 AIC · ⌖ 8.04 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, make sure all replied review threads are fully resolved, and confirm the blocking workflow lock-file change has been removed.

Unresolved review threads (n...

The lock file change cannot be removed from this PR — it is a mandatory check-workflow-drift fix.

Verification:

  • Reverting .github/workflows/daily-team-evolution-insights.lock.yml to its pre-PR state (0a04f25) causes make check-workflow-drift to hard-fail:

    ERROR: Workflow lock files are out of sync with their markdown sources.

  • The current lock file passes make check-workflow-drift

Why the change is necessary:
The .md source (daily-team-evolution-insights.md) has strict: false in its frontmatter. The pre-PR lock file had "strict":true in its metadata — this was a pre-existing bug from an older compiler version that always emitted strict:true regardless of the frontmatter value. The current compiler correctly reflects strict: false. The lock file in the PR IS the correct compiler output for the unchanged .md source.

Status of review threads:

  • PRRT_kwDOPc1QR86TTk8_ (copilot reviewer - lock file) — is_outdated: true
  • PRRT_kwDOPc1QR86TT0yG (github-actions - upstream-managed claim) — is_outdated: true
  • PRRT_kwDOPc1QR86TTk8T (copilot reviewer - defer ordering) — addressed in dad1583, reply posted
  • PRRT_kwDOPc1QR86TT0yD (github-actions - defer ordering) — addressed in dad1583, reply posted
  • PRRT_kwDOPc1QR86TT0x6 (github-actions - timer drain) — is_outdated: true, addressed in 21956c4, reply posted

All code fixes are in place and local validation passes. The only remaining blocker is that the CHANGES_REQUESTED reviews from github-actions[bot] cannot be programmatically dismissed — a maintainer must dismiss reviews 4766001031, 4766002139, and 4766007014 before merge.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address these unresolved review threads, and update the PR once each is resolved:

All 5 threads are already replied to with code fixes in place. Thread-by-thread status:

Thread is_outdated Reply Code fix
r3640793923 — defer ordering (copilot reviewer) ❌ not outdated Posted defer func() at line 52, before startup loop (dad1583)
r3640793943 — defer ordering (github-actions) ❌ not outdated Posted Same fix at line 52 (dad1583)
r3640793922 — timer drain (github-actions) ✅ outdated Posted defer timer.Stop() at line 65 (21956c4)
r3640795214 — lock file strict mode (copilot reviewer) ✅ outdated Posted check-workflow-drift hard-fails if reverted; current lock file is correct compiler output
r3640795280 — upstream-managed claim (github-actions) ✅ outdated Posted Workflow has no source: frontmatter entry; not upstream-managed

No uncommitted changes. Local validation (make fmt, make agent-report-progress-no-test) passes.

Threads cannot be marked as resolved programmatically — the GraphQL API is blocked in this environment. A maintainer must resolve/dismiss these threads directly on the PR, then re-trigger CI.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, verify the replied-to review threads are actually resolved in GitHub, resolve them if appropriate, and summarize merge readiness once checks are current.

Unresolved review threads (newest first):

Failed checks:

Run: https://github.com/github/gh-aw/actions/runs/30065152666

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20.7 AIC · ⌖ 10.4 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, verify the replied-to review threads are actually resolved in GitHub, resolve them if appropriate, and summarize merge readiness once checks are current.

...

All review threads are verified resolved in GitHub. Status summary:

Reviews — All 5 review threads are is_resolved: true:

  • PRRT_kwDOPc1QR86TTk8T (defer ordering, copilot reviewer) — resolved
  • PRRT_kwDOPc1QR86TT0yD (defer ordering, github-actions) — resolved
  • PRRT_kwDOPc1QR86TT0x6 (timer drain, github-actions) — resolved (outdated)
  • PRRT_kwDOPc1QR86TTk8_ (lock file, copilot reviewer) — resolved (outdated)
  • PRRT_kwDOPc1QR86TT0yG (upstream-managed claim, github-actions) — resolved (outdated)

Review 4766007014 is already DISMISSED. Reviews 4766001031 and 4766002139 remain CHANGES_REQUESTED but were submitted against 12c3957 and are stale — both underlying issues were fixed in dad1583 (defer moved to line 52) and 21956c4 (timer drain simplified). These cannot be programmatically dismissed from the agent.

Failed checks — The test (job 89387683840) and impacted-go-tests (job 89387683837) failures in run 30037694616 were against commit 285f19e6. The current HEAD is cc540d1f (merged with more recent main). Tests in pkg/actionpins and pkg/workflow pass locally against the current HEAD.

Local validationmake fmt and make agent-report-progress-no-test (fmt + lint + check-workflow-drift) all pass on the current HEAD with zero errors.

Latest CI on current HEAD (cc540d1f) — Doc/CWI/CGO are action_required (human approval gates, not test failures). No pending code changes.

Blocker requiring human action: A maintainer must dismiss reviews 4766001031 and 4766002139 from github-actions[bot], then close/reopen the PR to re-trigger CI.

@pelikhan
pelikhan merged commit 1fe7588 into main Jul 24, 2026
24 checks passed
@pelikhan
pelikhan deleted the copilot/lint-monster-targeted-custom-lint-fixes branch July 24, 2026 04:28
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[lint-monster] targeted custom-lint fixes outside function-length backlog

4 participants