Skip to content

Emit authoritative Copilot custom-routing signal in lock metadata - #49991

Merged
pelikhan merged 8 commits into
mainfrom
copilot/emit-default-copilot-configuration-signal
Aug 3, 2026
Merged

Emit authoritative Copilot custom-routing signal in lock metadata#49991
pelikhan merged 8 commits into
mainfrom
copilot/emit-default-copilot-configuration-signal

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Lock metadata exposed agent/schema fields but not whether Copilot ran with default GitHub routing vs customized provider/base URL/api target. Downstream consumers had to infer from compiled step env, which misses engine.api-target and is brittle against compiler output changes.

  • Metadata surface

    • Added engine_base_url_customized to # gh-aw-metadata (LockMetadata).
    • Wired field through AgentMetadataInfoGenerateLockMetadata → header emission.
  • Single-source routing predicate

    • Introduced shared Copilot predicates in workflow helpers:
      • isCopilotBYOKMode(...)
      • isCopilotCustomConfig(...)
    • isCopilotCustomConfig combines:
      • BYOK signals (engine.model-provider gateway + COPILOT_PROVIDER_BASE_URL)
      • explicit/derived API target (GetCopilotAPITarget, including engine.api-target and GITHUB_COPILOT_BASE_URL).
  • Drift prevention

    • Reused the shared BYOK predicate in Copilot execution path so runtime behavior and emitted metadata are derived from the same logic.
  • Coverage updates

    • Added focused tests for:
      • custom/default classification cases,
      • metadata serialization/omitempty behavior,
      • compile output metadata for default and customized Copilot configs.
# gh-aw-metadata
{
  "schema_version": "v4",
  "agent_id": "copilot",
  "engine_base_url_customized": true
}

branch-refresh requested by PR Sous Chef run: https://github.com/github/gh-aw/actions/runs/30830929419

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12 AIC · ⌖ 5.86 AIC · ⊞ 8.3K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20.5 AIC · ⌖ 9.4 AIC · ⊞ 5.9K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 15.3 AIC · ⌖ 9 AIC · ⊞ 8.3K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.5 AIC · ⌖ 11.2 AIC · ⊞ 8.3K ·
Comment /souschef to run again

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Triage

Category: feature · Risk: low · Total score: 15/100

Impact Urgency Quality
10/50 3/30 2/20

Draft PR just opened (0 files changed yet) to add a default-Copilot-configuration signal to lock file metadata. Agent has not started substantive work.

Recommended action: defer — too early-stage to review; re-triage once implementation lands.

Generated by 🔧 PR Triage Agent · auto · 55.7 AIC · ⌖ 4.24 AIC · ⊞ 8K ·

Co-authored-by: salmanmkc <32169182+salmanmkc@users.noreply.github.com>
Copilot AI changed the title [WIP] Add signal for default Copilot configuration in lock file metadata Emit authoritative Copilot custom-routing signal in lock metadata Aug 3, 2026
Copilot AI requested a review from salmanmkc August 3, 2026 13:55
@pelikhan
pelikhan marked this pull request as ready for review August 3, 2026 14:49
Copilot AI review requested due to automatic review settings August 3, 2026 14:49
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

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

Adds authoritative Copilot custom-routing metadata to compiled lock files, resolving #49990.

Changes:

  • Adds and emits engine_base_url_customized.
  • Centralizes Copilot BYOK/custom-routing detection.
  • Adds unit, compile, serialization, and regenerated workflow coverage.
Show a summary per file
File Description
pkg/workflow/lock_schema.go Adds the routing metadata field.
pkg/workflow/lock_schema_test.go Tests serialization and omission.
pkg/workflow/engine_api_targets.go Defines shared routing predicates.
pkg/workflow/copilot_engine_execution.go Reuses shared BYOK detection.
pkg/workflow/compiler_yaml_header.go Populates lock metadata.
pkg/workflow/compiler_yaml_test.go Tests compiled metadata.
pkg/workflow/awf_helpers_test.go Covers custom-routing cases.
.github/workflows/smoke-copilot-aoai-entra.lock.yml Regenerates Entra BYOK metadata.
.github/workflows/smoke-copilot-aoai-apikey.lock.yml Regenerates API-key BYOK metadata.
.github/workflows/daily-byok-ollama-test.lock.yml Regenerates Ollama BYOK metadata.

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: 0
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 72/100 — Acceptable

Analyzed 10 test(s): 9 design, 1 implementation, 0 violation(s).

📊 Metrics (10 tests)
Metric Value
Analyzed 10 (Go: 10, JS: 0)
✅ Design 9 (90%)
⚠️ Implementation 1 (10%)
Edge/error coverage 7 (70%)
Duplicate clusters 0
Inflation Yes (147 test lines / 51 prod lines ≈ 2.9:1)
🚨 Violations 0
Test File Classification Issues
TestIsCopilotCustomConfig (6 subtests) awf_helpers_test.go design_test, high_value None
TestCompileWorkflowMetadataMarksCopilotCustomConfig compiler_yaml_test.go design_test, high_value None
TestCompileWorkflowMetadataWithCopilotSDK (modified) compiler_yaml_test.go design_test, high_value None
TestGenerateLockMetadataWithAgentInfo (modified) lock_schema_test.go design_test, high_value None
TestGenerateLockMetadataAgentFieldsOmittedWhenEmpty (modified) lock_schema_test.go design_test, high_value None
TestLockMetadataToJSONWithAgentFields (modified) lock_schema_test.go design_test, high_value None
⚠️ Flagged Tests (1)

TestCompileWorkflowMetadataMarksCopilotCustomConfig (compiler_yaml_test.go) — Minor: covers only the positive case (api-target set → flag true). The negative case (default config → flag false) is covered in the adjacent modification to TestCompileWorkflowMetadataWithCopilotSDK. No hard violation. Consider consolidating into a table-driven test.

Verdict

passed. 10% implementation tests (threshold: 30%). Inflation ratio 2.9:1 reduces score by 10 points but is not a hard failure. No guideline violations (build tags ✅, no mock libraries ✅). Strong behavioral coverage of the new EngineBaseURLCustomized field.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 45.3 AIC · ⌖ 8.32 AIC · ⊞ 8.4K ·
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: 72/100. 10% implementation tests (threshold: 30%). No violations.

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

Verdict: Request changes — the new "authoritative" custom-routing signal has a false-positive edge case

One correctness bug undermines the PR's core claim of an authoritative engine_base_url_customized signal: isCopilotBYOKMode treats a present-but-empty COPILOT_PROVIDER_BASE_URL env value as BYOK mode (key-presence check, not value check), so a blank/templated-empty override will incorrectly flag the workflow as customized. Also flagged a test-coverage gap: the new BYOK/custom-config predicate is only tested through the combined isCopilotCustomConfig wrapper, leaving the sandbox-gated branch of isCopilotBYOKMode unverified in isolation.

💡 Themes and highlights
  • Correctness: engineEnvHasKey checks map key presence only; combined with the new metadata surfacing, this can misreport default configs as customized.
  • Predicate reuse: Good — isCopilotBYOKMode is now shared between the execution path and the metadata predicate, preventing drift between runtime behavior and reported metadata. This part of the design is sound.
  • Test coverage: New tests thoroughly cover the OR'd isCopilotCustomConfig outcome and omitempty/serialization behavior of EngineBaseURLCustomized, but do not isolate the BYOK sandbox-gating branch.
  • Struct field additions and lock schema wiring look mechanically correct and consistent with existing patterns (alphabetized struct tags, omitempty usage matching sibling bool Strict).

🔎 Code quality review by PR Code Quality Reviewer · auto · 101 AIC · ⌖ 6.54 AIC · ⊞ 7.9K
Comment /review to run again

Comments that could not be inline-anchored

pkg/workflow/engine_api_targets.go:187

isCopilotBYOKMode treats a present-but-empty COPILOT_PROVIDER_BASE_URL as BYOK mode, which will falsely mark the new engine_base_url_customized signal as true for a default configuration.

<details>
<summary>💡 Details</summary>

engineEnvHasKey (pkg/workflow/engine_helpers.go) only checks map key presence via _, ok := workflowData.EngineConfig.Env[key] — it does not check that the value is non-empty. A workflow with engine.env: {COPILOT_PROVIDER_BASE_URL: &quot;&quot;} (e.g. an accidentall…

pkg/workflow/awf_helpers_test.go:37

New test coverage exercises isCopilotCustomConfig end-to-end but never isolates isCopilotBYOKMode, leaving the sandbox/firewall-gated providerOverrideBYOK branch under-tested on its own.

<details>
<summary>💡 Details</summary>

All new tests (TestIsCopilotCustomConfig, TestCompileWorkflowMetadataMarksCopilotCustomConfig) go through the combined isCopilotCustomConfig predicate, which OR's together isCopilotBYOKMode(...) and GetCopilotAPITarget(...) != &quot;&quot;. There is no direct unit…

@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 /tdd and /codebase-design — two focused comments; no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Missing direct test for isCopilotBYOKMode: The predicate now drives both the runtime BYOK path and metadata emission. It is covered transitively through TestIsCopilotCustomConfig, but a dedicated test table would pin the contract and give faster signal if the implementation changes.
  • Silent divergence between engineEnvHasKey and GetCopilotAPITarget for COPILOT_PROVIDER_BASE_URL: Worth a brief comment to clarify intent for future readers.

Positive Highlights

  • ✅ Clean single-source-of-truth: isCopilotCustomConfig and isCopilotBYOKMode correctly unify runtime and metadata paths, eliminating the previous drift risk.
  • ✅ Good omitempty discipline — engine_base_url_customized is absent from the lock file for default configs, keeping metadata small.
  • ✅ 7-case test table in TestIsCopilotCustomConfig covers all documented signal combinations.
  • ✅ Schema and AgentMetadataInfo are updated consistently; no dangling references.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 70.9 AIC · ⌖ 13.6 AIC · ⊞ 7.1K
Comment /matt to run again

Comment thread pkg/workflow/engine_api_targets.go
Comment thread pkg/workflow/engine_api_targets.go
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (198 new lines in pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/49991-emit-copilot-custom-routing-signal-in-lock-metadata.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — add context the AI couldn't infer, refine the decision rationale, and list real alternatives you considered
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:
    ADR: [ADR-49991: Emit Copilot Custom-Routing Signal in Lock Metadata](docs/adr/49991-emit-copilot-custom-routing-signal-in-lock-metadata.md)

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 49991-emit-copilot-custom-routing-signal-in-lock-metadata.md for PR #49991).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · sonnet46 · 74.5 AIC · ⌖ 33.6 AIC · ⊞ 9.6K ·
Comment /review to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot sous-chef triage:

The branch is green and the latest fix is in; please run the pr-finisher skill, double-check the empty COPILOT_PROVIDER_BASE_URL edge case raised in review, and summarize merge readiness.

Generated by 👨🍳 PR Sous Chef · run: https://github.com/github/gh-aw/actions/runs/30830929419

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12 AIC · ⌖ 5.86 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot sous-chef triage:

The branch is green and the latest fix is in; please run the pr-finisher skill, double-check the empty COPILOT_PROVIDER_BASE_URL edge case raised in review, and summari...

Implemented and pushed 3160bd6 after running the pr-finisher pass and re-checking the edge case.

  • ❌ Reviews — 2 unresolved github-actions review threads are still open.
  • ✅ Checks (local) — make fmt, targeted Copilot routing tests, and go test ./pkg/workflow pass.
  • ❓ Checks (CI) — prior branch run was green, but CI is stale on new head 3160bd6; maintainer re-trigger is required.
  • ✅ Mergeable — PR is open, not draft, and has no merge conflicts (currently mergeable_state: unstable due stale checks).

Actions taken: empty COPILOT_PROVIDER_BASE_URL no longer enables BYOK/custom config, Copilot secret validation now requires non-empty BYOK env values, and direct BYOK predicate/edge-case tests were added.

Hand-off: CI must be re-triggered by a maintainer (close/reopen PR, workflow_dispatch, or maintainer push) before merge.
Still needed: resolve the two open review threads and rerun CI on the current head.

Copilot AI requested a review from gh-aw-bot August 3, 2026 16:38
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot sous-chef triage:

There are still two unresolved review threads even though your latest follow-up says the fix is in.

Generated by 👨🍳 PR Sous Chef · run: https://github.com/github/gh-aw/actions/runs/30835268189

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8.36 AIC · ⌖ 8.38 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot sous-chef triage:

There are still two unresolved review threads even though your latest follow-up says the fix is in....

Done. I addressed both open review comments and pushed c6cc595 (follow-up cleanup) on top of the earlier functional fix in 3160bd6.

  • TestIsCopilotBYOKMode is now present and directly covers the BYOK predicate paths in /home/runner/work/gh-aw/gh-aw/pkg/workflow/awf_helpers_test.go.
  • The BYOK-vs-target contract is documented inline in /home/runner/work/gh-aw/gh-aw/pkg/workflow/engine_api_targets.go above isCopilotBYOKMode.

I can’t resolve review threads via the available agent APIs in this environment, but both threads are now replied to and ready to be resolved.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot sous-chef triage:

Your latest follow-up says both open review comments were addressed on c6cc595, but the threads are still unresolved.

Generated by PR Sous Chef · run: https://github.com/github/gh-aw/actions/runs/30838483274

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 20.5 AIC · ⌖ 9.4 AIC · ⊞ 5.9K ·
Comment /souschef to run again

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot sous-chef triage:

Your latest follow-up says both open review comments were addressed on c6cc595, but the threads are still unresolved....

Completed PR-finisher pass on current head c6cc595.

I’m still blocked from programmatically resolving review threads from this agent environment (reply is supported, thread-resolution mutation is not exposed), so the two threads remain open even though they are substantively addressed:

Merge-readiness snapshot:

  • Reviews: open only due unresolved thread state; content has been addressed.
  • Checks (local): make fmt, make lint, TEST_UNIT_RUN_FULL=1 make test-unit, make test, make recompile all passed.
  • Checks (branch/CI): current branch runs are not green (action_required on current head workflows, including CWI/CGO/Doc Build), and one dynamic run is still in progress.
  • Mergeable: PR is open/not draft, but mergeable_state=blocked.

Handoff: please resolve the two addressed threads in the UI and re-trigger/reconcile required checks for c6cc595.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR Triage: #49991

  • Category: feature
  • Risk: low
  • Score: 32/100 (Impact 15 + Urgency 5 + Quality 12)
  • Recommended action: defer

Carry-over from a prior triage run (previously deferred). Emits Copilot custom-routing signal in lock metadata. mergeable_state is blocked.

Generated by 🔧 PR Triage Agent · auto · 51.1 AIC · ⌖ 4.08 AIC · ⊞ 8K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Your latest follow-up says both open review threads were addressed, but they are still unresolved. Please resolve the remaining threads directly after confirming the current head includes the fixes, then run the pr-finisher skill and summarize merge readiness.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 15.3 AIC · ⌖ 9 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Your latest follow-up says both open review threads were addressed, but they are still unresolved. Please resolve the remaining threads directly after confirming the current head includes the...

Confirmed on current head c6cc595 that both requested fixes are present (TestIsCopilotBYOKMode and the BYOK/API-target contract comment), and the two referenced review threads are already in is_resolved=true state.

PR-finisher merge-readiness snapshot:

  • ✅ Reviews — no unresolved in-scope review threads remain.
  • ✅ Checks (local) — make fmt, make lint, make test-unit, make test, and make recompile all pass.
  • ❓ Checks (CI) — one current dynamic copilot run is still in progress; prior workflow runs on this head include action_required entries with no jobs/logs available from the run API. CI on this head remains unverified until a maintainer re-triggers.
  • ❓ Mergeable — GitHub API currently reports mergeable_state: unknown.

Hand-off: please re-trigger required CI as a maintainer (close/reopen PR, workflow_dispatch, or maintainer push) and complete final mergeability/check verification in UI before merge.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot sous-chef triage:

This PR still needs another pass before maintainers can investigate quickly. Please refresh the branch if needed, address remaining blockers, then run the pr-finisher skill and post a concise merge-readiness summary for the current head.

Generated by PR Sous Chef · run: https://github.com/github/gh-aw/actions/runs/30848087243

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.5 AIC · ⌖ 11.2 AIC · ⊞ 8.3K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit 1b97ba0 into main Aug 3, 2026
32 checks passed
@pelikhan
pelikhan deleted the copilot/emit-default-copilot-configuration-signal branch August 3, 2026 20:29
@salmanmkc

Copy link
Copy Markdown
Collaborator

ty @pelikhan

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.4

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.

Emit a default-Copilot-configuration signal in lock file metadata

5 participants