Skip to content

refactor: compute sink-visibility at runtime instead of compile time#44245

Merged
pelikhan merged 2 commits into
mainfrom
copilot/refactor-skip-visibility-state
Jul 8, 2026
Merged

refactor: compute sink-visibility at runtime instead of compile time#44245
pelikhan merged 2 commits into
mainfrom
copilot/refactor-skip-visibility-state

Conversation

Copilot AI commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Previously, sink-visibility in the mcpg guard policy config was a static string (e.g. "public") baked in at compile time via gh api. This could go stale and required a network call during compilation.

Changes

  • Remove compile-time visibility resolution: Drop RepositoryVisibility from WorkflowData and the computeRepositoryVisibility() call in workflow_builder.go
  • Runtime expression for sink-visibility: Both deriveSafeOutputsGuardPolicyFromGitHub and deriveWriteSinkGuardPolicyFromWorkflow now emit:
    "sink-visibility": ${{ toJSON(steps.determine-automatic-lockdown.outputs.visibility) }}
    via the existing guardExprSentinel post-processing pattern
  • Always generate the lockdown detection step: generateGitHubMCPLockdownDetectionStep no longer skips when explicit guard policies are configured — the step must run to produce the visibility output regardless
  • Fix array serialization for GH_AW_GITHUB_REPOS: allowed-repos: [...] was being serialized via fmt.Sprintf("%v", slice)[github/gh-aw github/*], which YAML parses as a sequence. Added serializeEnvStringValue (JSON-encodes slices) and quoteYAMLEnvValue (single-quotes YAML scalars) to produce valid output
  • Recompiled all 258 workflows: lock files now contain the runtime expression instead of a static visibility string

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan July 8, 2026 07:56
@pelikhan
pelikhan marked this pull request as ready for review July 8, 2026 08:44
Copilot AI review requested due to automatic review settings July 8, 2026 08:44
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

No ADR enforcement needed: PR #44245 does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (78 additions detected, threshold is 100).

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

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

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

This PR refactors MCP gateway guard-policy generation so sink-visibility is resolved at workflow runtime (via a GitHub Actions expression) instead of being computed at compile time via gh api, avoiding stale visibility and removing a compile-time network dependency.

Changes:

  • Removed compile-time repository visibility plumbing (WorkflowData.RepositoryVisibility and related compiler wiring).
  • Updated guard-policy derivation to emit sink-visibility as a runtime expression referencing steps.determine-automatic-lockdown.outputs.visibility.
  • Updated generated workflow lock files and golden test fixtures to reflect the runtime sink-visibility expression.
Show a summary per file
File Description
pkg/workflow/workflow_data.go Removes RepositoryVisibility from WorkflowData.
pkg/workflow/workflow_builder.go Drops compile-time visibility resolution during workflow data construction.
pkg/workflow/mcp_github_config.go Emits runtime sink-visibility expression in derived write-sink policies; updates derivation call sites.
pkg/workflow/compiler_orchestrator_workflow_test.go Removes test that asserted compile-time visibility resolution into workflow data.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden Updates expected rendered guard-policies to include runtime sink-visibility.
.github/workflows/workflow-skill-extractor.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/workflow-normalizer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/workflow-health-manager.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/weekly-editors-health-check.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/visual-regression-checker.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/video-analyzer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/update-astro.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/unbloat-docs.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/uk-ai-operational-resilience.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/ubuntu-image-analyzer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/tidy.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/test-workflow.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/test-quality-sentinel.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/test-project-url-default.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/test-dispatcher.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/terminal-stylist.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/technical-doc-writer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/super-linter.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/sub-issue-closer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/step-name-alignment.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/stale-pr-cleanup.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/spec-librarian.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/spec-extractor.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/spec-enforcer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-workflow-call.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-workflow-call-with-inputs.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-update-cross-repo-pr.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-test-tools.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-temporary-id.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-service-ports.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-project.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-pi.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-otel-backends.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-multi-pr.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-create-cross-repo-pr.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-copilot-sub-agents.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-copilot-sdk.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-copilot-arm.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-codex.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-ci.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/smoke-call-workflow.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/slide-deck-maintainer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/security-compliance.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/schema-feature-coverage.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/schema-consistency-checker.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/research.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/repository-quality-improver.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/repo-tree-map.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/repo-audit-analyzer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/release.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/refactoring-cadence.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/python-data-charts.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/pr-description-caveman.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/pdf-summary.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/outcome-collector.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/objective-impact-report.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/notion-issue-summary.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/necromancer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/metrics-collector.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/mergefest.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/linter-miner.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/lint-monster.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/layout-spec-maintainer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/jsweep.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/instructions-janitor.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/hourly-ci-cleaner.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/gpclean.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/go-logger.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/glossary-maintainer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/github-remote-mcp-auth-test.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/github-mcp-tools-report.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/functional-pragmatist.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/firewall.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/firewall-escape.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/example-permissions-warning.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/example-failure-category-filter.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/eslint-refiner.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/eslint-monster.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/eslint-miner.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/duplicate-code-detector.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/draft-pr-cleanup.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/docs-noob-tester.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/dictation-prompt.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/dev.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/dev-hawk.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/designer-drift-audit.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/design-decision-gate.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/deployment-incident-monitor.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/dependabot-repair.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/dependabot-go-checker.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/dependabot-burner.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/delight.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/dead-code-remover.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-workflow-updater.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-windows-terminal-integration-builder.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-testify-uber-super-expert.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-syntax-error-quality.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-spdd-spec-planner.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-skill-optimizer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-sentrux-report.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-semgrep-scan.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-security-red-team.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-security-observability.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-secrets-analysis.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-safeoutputs-git-simulator.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-safe-output-integrator.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-repo-chronicle.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-regulatory.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-performance-summary.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-observability-report.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-model-resolution.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-model-inventory.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-mcp-concurrency-analysis.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-max-ai-credits-test.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-malicious-code-scan.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-geo-optimizer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-formal-spec-verifier.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-firewall-report.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-file-diet.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-fact.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-experiment-report.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-credit-limit-test.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-compiler-threat-spec-optimizer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-compiler-quality.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-community-attribution.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-cli-tools-tester.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-cli-performance.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-choice-test.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-cache-strategy-analyzer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-byok-ollama-test.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-assign-issue-to-user.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-architecture-diagram.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/daily-ambient-context-optimizer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/craft.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/copilot-pr-prompt-analysis.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/copilot-pr-nlp-analysis.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/copilot-opt.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/copilot-cli-deep-research.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/copilot-centralization-optimizer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/copilot-centralization-drilldown.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/copilot-agent-analysis.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/constraint-solving-potd.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/codex-github-remote-mcp-test.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/code-simplifier.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/code-scanning-fixer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/cli-consistency-checker.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/ci-doctor.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/ci-coach.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/changeset.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/breaking-change-checker.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/brave.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/bot-detection.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/blog-auditor.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/avenger.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/artifacts-summary.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/architecture-guardian.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/archie.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/approach-validator.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/agentic-token-trend-audit.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/agentic-token-optimizer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/agentic-token-audit.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/agent-performance-analyzer.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).
.github/workflows/ace-editor.lock.yml Recompiled lock content to use runtime sink-visibility expression (and updated MCP config heredoc delimiter).

Review details

Tip

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

  • Files reviewed: 265/265 changed files
  • Comments generated: 0
  • Review effort level: Low

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

🔶 Test Quality Score: 62/100 — Acceptable

Analyzed 7 test modifications: 0 design tests, 7 implementation tests, 1 violation concern.

📊 Metrics (7 table-driven test cases modified)
Metric Value
Analyzed 7 test cases (all Go table-driven)
✅ Design 0 (0%)
⚠️ Implementation 7 (100%)
Edge/error coverage 5 (71%)
Duplicate clusters 0
Inflation YES (mixed)
🚨 Violations 1 structural concern

Detailed Test Analysis

Test Case File Classification Issues
TestDeriveWriteSinkGuardPolicyFromWorkflow (3 cases) non_github_mcp_guard_policy_test.go Implementation ✅ Assertions check runtime expression constant
TestAllNonGitHubMCPServersGetWriteSinkWhenGitHubHasAllowOnly (4 cases) non_github_mcp_guard_policy_test.go Implementation ⚠️ Removed visibility value assertions; now only checks string presence
TestDeriveSafeOutputsGuardPolicyFromGitHub (13+ cases) safeoutputs_guard_policy_test.go Implementation ⚠️ Loss of visibility value verification (e.g., "private" vs "public")
⚠️ Flagged Concerns (1 structural violation)

Test Coverage Loss: The PR removes compile-time repository visibility verification without adding comprehensive runtime verification tests. Specifically:

  • 1 test deleted (TestBuildInitialWorkflowData_SetsRepositoryVisibilityForGitHubTool)
  • Multiple test cases lost sinkVisibility parameters and now verify a constant string expression
  • No new tests added to verify runtime visibility detection in determineAutomaticLockdown step
  • The refactor shifts responsibility to runtime, but tests only verify that the runtime expression is present, not that it evaluates correctly

Missing Coverage:

  • ❌ No test for the new runtime expression evaluation logic in the lockdown detection step
  • ❌ No test for visibility detection at workflow execution time
  • ❌ No integration test for the compile-time → runtime migration

Test Inflation:

  • safeoutputs_guard_policy_test.go: 34 net additions in test file vs unknown production changes
  • Changes are mostly modifications to existing test data, not new test functions
  • Net test function count decreased by 1 (deletion of compile-time test)

Verdict

⚠️ PASS WITH CONCERNS. 0% implementation-design ratio (threshold: ≤30%). However, structural concern: test coverage shifted rather than evolved. The refactor moves responsibility from compile-time to runtime, but test suite does not comprehensively verify runtime behavior.

Specific Issues:

  1. ⚠️ Test Simplification Pattern: Tests now verify string constants exist rather than visibility values are correct. This reduces behavioral coverage.
  2. ⚠️ Migration Verification Gap: No tests confirm the runtime expression (steps.determine-automatic-lockdown.outputs.visibility) is properly computed and used.
  3. ⚠️ Deleted Test Not Replaced: TestBuildInitialWorkflowData_SetsRepositoryVisibilityForGitHubTool verified compile-time propagation—no equivalent test added for runtime behavior.

Positive Aspects:

  • ✅ Build tags present (//go:build !integration)
  • ✅ No Go mock library violations
  • ✅ Assertions use descriptive failure messages
  • ✅ Table-driven test pattern maintained

Recommendation: The test suite should be enhanced with integration tests to verify:

  1. The lockdown detection step correctly outputs repository visibility
  2. Runtime expression is properly substituted in the final guard policy
  3. Visibility semantics (public → accept=[*], private → accept=[private:*]) are enforced at runtime

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🧪 Test quality analysis by Test Quality Sentinel · 25.6 AIC · ⌖ 17.9 AIC · ⊞ 6.8K ·
Comment /review to run again

@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.

❌ Test Quality Sentinel: 62/100. The PR simplifies tests by removing compile-time visibility verification, but does not add comprehensive runtime verification. The refactor shifts responsibility from compile time to runtime, but test coverage for the runtime behavior is incomplete. Consider adding integration tests for the determineAutomaticLockdown step to verify visibility detection and guard policy enforcement at runtime.

@pelikhan

pelikhan commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@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 /tdd — requesting changes on two correctness gaps.

📋 Key Themes & Highlights

Key Themes

  • Stale integration test: The "No auto detection when guard policy explicitly configured" case in github_lockdown_autodetect_test.go still asserts expectAutoDetectionStep: false, but the PR's central change (remove the early-return guard) means the step now always runs. This test actively contradicts the new invariant and is only caught on integration builds.
  • Missing unit tests for new helpers: serializeEnvStringValue and quoteYAMLEnvValue (the GH_AW_GITHUB_REPOS bugfix) have no unit tests. These are non-trivial serialisation edge cases (embedded single quotes, non-string slices) with no regression guard.
  • Duplicated runtime expression literal: The sentinel string guardExprSentinel + "${{ toJSON(steps.determine-automatic-lockdown.outputs.visibility) }}" is copy-pasted in two production call sites. The test layer already defines sinkVisibilityExpr as a const — the same pattern should be applied in production code.

Positive Highlights

  • ✅ Eliminating the compile-time API call for visibility is the right architectural move — fresher data, faster compilation, no auth requirement at build time.
  • ✅ The guardExprSentinel post-processing pattern is used consistently and correctly extended here.
  • ✅ Test suite is broadly updated to reflect the new invariant (runtime expr vs. static string) — the coverage is thorough except for the two gaps above.
  • ✅ All 258 lock files regenerated cleanly and consistently, which validates the compiler-level change.
  • serializeEnvStringValue / quoteYAMLEnvValue cleanly fix the YAML-sequence misparse bug.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 126.8 AIC · ⌖ 9.12 AIC · ⊞ 6.6K
Comment /matt to run again

// serializeEnvStringValue converts a workflow config value to a string suitable for a
// YAML env variable. Strings are returned as-is; slices are JSON-encoded so that
// e.g. ["github/gh-aw", "github/*"] becomes `["github/gh-aw","github/*"]`.
func serializeEnvStringValue(v any) string {

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.

[/tdd] No unit tests for the new serializeEnvStringValue and quoteYAMLEnvValue helpers. These functions handle edge cases that are easy to regress: slices with embedded single quotes, empty slices, non-string non-slice types, marshal failure paths.

💡 Suggested tests to add in a new file or alongside the function
func TestSerializeEnvStringValue(t *testing.T) {
    assert.Equal(t, "myorg/repo", serializeEnvStringValue("myorg/repo"))
    assert.Equal(t, `["github/gh-aw","github/*"]`, serializeEnvStringValue([]any{"github/gh-aw", "github/*"}))
}

func TestQuoteYAMLEnvValue(t *testing.T) {
    assert.Equal(t, "'hello'", quoteYAMLEnvValue("hello"))
    assert.Equal(t, "'it''s'", quoteYAMLEnvValue("it's"))  // embedded single-quote escaped
    assert.Equal(t, "'[\"a\",\"b\"]'", quoteYAMLEnvValue(`["a","b"]`))
}

Without these, the bugfix for GH_AW_GITHUB_REPOS serialisation has no regression guard.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7a281dd. Added focused coverage in pkg/workflow/compiler_github_mcp_steps_test.go for serializeEnvStringValue, quoteYAMLEnvValue, and the generated lockdown-step env output.

Comment thread pkg/workflow/mcp_github_config.go Outdated
if sinkVisibility != "" {
writeSink["sink-visibility"] = sinkVisibility
"accept": acceptList,
"sink-visibility": guardExprSentinel + "${{ toJSON(steps.determine-automatic-lockdown.outputs.visibility) }}",

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.

[/codebase-design] The sink-visibility expression is now duplicated in two places: deriveSafeOutputsGuardPolicyFromGitHub (line 508) and deriveWriteSinkGuardPolicyFromWorkflow (line 572). The tests solve this by defining sinkVisibilityExpr as a package-level const, but the production code repeats the raw string literal twice. A named constant or a sinkVisibilityRuntimeExpr variable at package scope would make future changes (e.g. a step rename) a one-line edit and make the intent self-documenting.

💡 Suggested approach

In mcp_renderer_guard.go (where guardExprSentinel lives) or mcp_github_config.go:

// sinkVisibilityRuntimeExpr is the guard-policy expression that resolves repository visibility at runtime.
const sinkVisibilityRuntimeExpr = guardExprSentinel + "${{ toJSON(steps.determine-automatic-lockdown.outputs.visibility) }}"

Both call sites then use sinkVisibilityRuntimeExpr — the tests' sinkVisibilityExpr constant can alias or reuse it.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7a281dd. I extracted sinkVisibilityRuntimeExpr into production code in pkg/workflow/mcp_renderer_guard.go and both guard-policy call sites now reuse it.

@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.

REQUEST_CHANGES — one correctness bug that must be fixed before merge; two stale artifacts that erode safety guarantees.

### Critical: TOML format silently drops `sink-visibility`

renderGuardPoliciesToml only handles []string-typed fields. The new sink-visibility field is a string (even after sentinel removal), so it is silently discarded for every engine that uses TOML config (Codex). Those workflows ship with no public/private/internal enforcement in their write-sink guard policy. The JSON path (Copilot engine) works correctly; TOML does not.

Separately: even if the TOML renderer were fixed to emit string fields, it would need a runtime-substitution mechanism for ${{ }} expressions — the TOML heredoc is written before determine-automatic-lockdown runs.

### High: Stale integration test assertion

github_lockdown_autodetect_test.go line 79 asserts expectAutoDetectionStep: false for the "guard policy explicitly configured" case. This PR removes that early-return, so the assertion is wrong. Because the test is integration-build-tag only, it won't catch regressions in CI.

### Medium: Stale comment in `mcp_environment.go`

Line 97 says "determine-automatic-lockdown step is not generated" when guardPoliciesExplicit is true — this is no longer true after this PR.

### Medium: Inconsistent YAML quoting for env vars

GH_AW_GITHUB_MIN_INTEGRITY is written without quoteYAMLEnvValue; GH_AW_GITHUB_REPOS is quoted. The inconsistency is a latent risk.

🔎 Code quality review by PR Code Quality Reviewer · 265.1 AIC · ⌖ 6.01 AIC · ⊞ 5.4K
Comment /review to run again

@@ -75,14 +68,39 @@ func (c *Compiler) generateGitHubMCPLockdownDetectionStep(yaml *strings.Builder,
fmt.Fprintf(yaml, " GH_AW_GITHUB_MIN_INTEGRITY: %s\n", configuredMinIntegrity)

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.

GH_AW_GITHUB_MIN_INTEGRITY written unquoted while GH_AW_GITHUB_REPOS is single-quoted: configuredRepos is passed through quoteYAMLEnvValue (line 71) but configuredMinIntegrity is not (line 68). While the current set of allowed min-integrity values is safe, the inconsistency is a latent risk if validation is ever relaxed or the pattern is copied elsewhere.

💡 Suggested fix
if configuredMinIntegrity != "" {
    fmt.Fprintf(yaml, "          GH_AW_GITHUB_MIN_INTEGRITY: %s\n", quoteYAMLEnvValue(configuredMinIntegrity))
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7a281dd. GH_AW_GITHUB_MIN_INTEGRITY is now emitted through quoteYAMLEnvValue in generateGitHubMCPLockdownDetectionStep.

// serializeEnvStringValue converts a workflow config value to a string suitable for a
// YAML env variable. Strings are returned as-is; slices are JSON-encoded so that
// e.g. ["github/gh-aw", "github/*"] becomes `["github/gh-aw","github/*"]`.
func serializeEnvStringValue(v any) string {

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.

serializeEnvStringValue and quoteYAMLEnvValue have no unit tests: A nil input to serializeEnvStringValue will produce the string literal "null" (written as GH_AW_GITHUB_REPOS: 'null'), which the lockdown script would interpret as a literal repos value. Map or struct inputs produce a JSON object. These edge cases are unverified.

💡 Suggested fix

Add a unit test covering at least: nil input, empty slice, []string{"a", "b"}, plain string, and a string containing a single quote. For example:

func TestSerializeEnvStringValue(t *testing.T) {
    assert.Equal(t, "myvalue", serializeEnvStringValue("myvalue"))
    assert.Equal(t, `["a","b"]`, serializeEnvStringValue([]string{"a", "b"}))
    assert.Equal(t, "null", serializeEnvStringValue(nil)) // document the behavior
    assert.Equal(t, "[]", serializeEnvStringValue([]string{}))
}
func TestQuoteYAMLEnvValue(t *testing.T) {
    assert.Equal(t, `'foo'`, quoteYAMLEnvValue("foo"))
    assert.Equal(t, `'it''s'`, quoteYAMLEnvValue("it's"))
    assert.Equal(t, `'["a","b"]'`, quoteYAMLEnvValue(`["a","b"]`))
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7a281dd. The new unit tests cover plain strings, slices, empty slices, nil, embedded single quotes, and the rendered YAML env values.

@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: refactor: compute sink-visibility at runtime instead of compile time

The refactor is sound and correctly eliminates the compile-time gh api call for repository visibility. The lockdown detection step now always runs when the GitHub tool is present, and both deriveSafeOutputsGuardPolicyFromGitHub and deriveWriteSinkGuardPolicyFromWorkflow consistently emit the guardExprSentinel-prefixed runtime expression for sink-visibility. The fallback in determine_automatic_lockdown.cjs (emits "unknown" on error) ensures the field is always populated.

Two issues in changed code worth addressing:

  1. GH_AW_GITHUB_MIN_INTEGRITY is emitted inconsistently (blocking): the PR adds serializeEnvStringValue + quoteYAMLEnvValue for GH_AW_GITHUB_REPOS but the parallel GH_AW_GITHUB_MIN_INTEGRITY still uses raw fmt.Sprintf("%v", v) and no quoting. If min-integrity ever carries a non-scalar value this path will produce broken YAML — for symmetry it should use the same helpers. (See inline comment.)

  2. Minor nit on val in default branch of serializeEnvStringValue (non-blocking): val shadows v in the default case but equals v (any). json.Marshal(val) vs json.Marshal(v) makes no difference here; using v directly would be clearer. (See inline comment.)

What the PR gets right
  • Removing RepositoryVisibility from WorkflowData eliminates a compile-time network call and prevents stale cached values.
  • Always generating the lockdown detection step regardless of guard-policy configuration ensures visibility output is always available for the runtime expression.
  • serializeEnvStringValue + quoteYAMLEnvValue correctly fix the GH_AW_GITHUB_REPOS YAML serialization bug for slice values.
  • Tests are updated to match the new runtime expression constant, and the removed TestBuildInitialWorkflowData_SetsRepositoryVisibilityForGitHubTool test is correctly deleted since that code path no longer exists.
  • All 258 lock files are consistently recompiled.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 167.8 AIC · ⌖ 6.15 AIC · ⊞ 4.8K

@@ -75,14 +68,39 @@ func (c *Compiler) generateGitHubMCPLockdownDetectionStep(yaml *strings.Builder,
fmt.Fprintf(yaml, " GH_AW_GITHUB_MIN_INTEGRITY: %s\n", configuredMinIntegrity)

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.

Inconsistency: GH_AW_GITHUB_MIN_INTEGRITY is not quoted, but GH_AW_GITHUB_REPOS is

This PR introduces quoteYAMLEnvValue to wrap GH_AW_GITHUB_REPOS in single-quotes so YAML cannot misinterpret JSON arrays as sequences. However, GH_AW_GITHUB_MIN_INTEGRITY is emitted without quoting, and configuredMinIntegrity is still set via fmt.Sprintf("%v", v) rather than serializeEnvStringValue.

Although min-integrity is always a string today, the asymmetry is a latent footgun. For consistency and safety the same pattern should be applied:

configuredMinIntegrity = serializeEnvStringValue(v)
// ...
fmt.Fprintf(yaml, "          GH_AW_GITHUB_MIN_INTEGRITY: %s\n", quoteYAMLEnvValue(configuredMinIntegrity))

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7a281dd. min-integrity now follows the same path as repos: serializeEnvStringValue at read time and quoteYAMLEnvValue when rendered to YAML.

func serializeEnvStringValue(v any) string {
switch val := v.(type) {
case string:
return val

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.

val is declared but only used in one branch of the type switch

In the case string branch, val is used correctly (return val). However, in the default branch, the function uses v (the original any) for json.Marshal(val)val in the default branch is any, same as v. This is harmless but the shadowing may cause confusion. Consider:

case string:
    return val
default:
    encoded, err := json.Marshal(v) // use v directly; val == v here

Not blocking, just a minor clarity nit. @copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 7a281dd. I switched the fallback marshal branch to use v directly so the type-switch shadowing is clearer.

@pelikhan

pelikhan commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan merged commit 3d76433 into main Jul 8, 2026
29 of 30 checks passed
@pelikhan
pelikhan deleted the copilot/refactor-skip-visibility-state branch July 8, 2026 09:27
Copilot stopped work on behalf of pelikhan due to an error July 8, 2026 09:27
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.5

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants