Skip to content

Fix universal-consumer Copilot credential routing - #73578

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan/copilot-credential-routing
Nov 1, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan/copilot-credential-routing

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Universal-consumer engines using a Copilot model must not expose their Copilot credential through an OpenAI credential alias, which can enable an unintended upstream adapter during AWF startup.

Remove the shared profile's OPENAI_API_KEY alias and supply OpenAI-compatible clients with a non-secret placeholder only inside the AWF sandbox command, after credential discovery. Preserve Copilot gateway URL aliases, other provider profiles, and direct/harness execution, including protected session capture.

  • Add regression coverage for both Copilot authentication modes, compiled YAML, and simulated AWF startup versus client environments.
  • Regenerate 19 affected workflow locks and document the routing contract in compiler threat specification 1.0.80 (CTR-017).
  • Add a patch changeset and migration guidance: deployed workflows must be recompiled with the fixed compiler.

Focused provider, engine, generated-lock, and formal conformance tests pass, along with scoped lint/build/schema checks and the full 353-workflow drift check. No live credential requests or workflow dispatches were performed. The simulated startup test does not constitute end-to-end AWF verification.

Upstream partial-key redaction, explicit author-owned credential overrides, and previously uploaded artifacts are outside this change.

Keep provider credentials scoped to their upstream and introduce the OpenAI-compatible client placeholder only inside the AWF sandbox. Add regression coverage, regenerate affected workflows, and specify the CTR-017 boundary.

Co-authored-by: Copilot App <[email protected]>
@pelikhan
pelikhan marked this pull request as ready for review October 31, 2026 23:40
Copilot AI adaptive review requested due to automatic review settings October 31, 2026 23:40
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · ~19 AIC · ⌖ ~6 AIC · ⊞ 15.1K · ◷

Generated by Ponytail Reviewer for #73578

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · haiku45 · ~5 AIC · ⌖ ~9 AIC · ◇ ~3 AIC · ⊞ 9.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@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: no actionable findings

The changed credential-routing logic is internally consistent: Copilot credentials stay provider-scoped, the client placeholder is introduced only inside AWF execution, and the added tests cover both credential modes and protected capture. No blocking correctness issue was identified from the capped diff. The grumpy-coder specialist pass was unavailable because its tool invocation was rejected; its output was discarded.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines): the pre-fetched gate summary reports 276 additions in the default business-logic directories. It is not labeled implementation and does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/73578-isolate-universal-consumer-copilot-credentials.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 could not 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-73578: Isolate Universal-Consumer Copilot Credentials (link unavailable: invalid HTTPS URL)

The draft is grounded in pkg/workflow/universal_llm_consumer_engine.go, pkg/workflow/behavior_defined_engine.go, the provider-routing regression tests, generated lock updates, and the CTR-017 specification update. It records the decision to keep the real Copilot credential in COPILOT_GITHUB_TOKEN and introduce a non-secret OpenAI-compatible placeholder only inside the AWF sandbox after credential discovery.

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

❓ Why ADRs Matter

ADRs create a searchable, permanent record of why the codebase looks the way it does and make architectural trade-offs reviewable by future contributors.

📋 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 was decided and why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs, both positive and negative?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: gpt56 max · ~6 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷
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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd (plus /codebase-design for one minor note) — this is a solid, well-tested security fix. Approving.

📋 Key Themes & Highlights

Root cause & fix

  • Correctly identifies the root cause: aliasing COPILOT_GITHUB_TOKEN as OPENAI_API_KEY in the shared universal-consumer provider profile let the client-side OPENAI_API_KEY leak into the AWF startup environment, enabling an unintended upstream OpenAI adapter.
  • The fix removes the alias from getUniversalLLMBackendProfile and instead introduces a non-secret COPILOT_DUMMY_BYOK placeholder only inside the sandbox command, after AWF credential discovery — mirroring the existing pattern already used in claude_engine.go, codex_engine.go, and copilot_engine_execution.go. Good consistency with established conventions (/codebase-design).

Test coverage (/tdd)

  • behavior_defined_engine_provider_test.go (176 new lines) covers harness vs. direct execution, protected session capture, sandbox-disabled paths, and compiled-YAML assertions that the secret key never appears in the runner step env.
  • TestBehaviorDefinedEngine_CopilotAWFStartupEnvironment is a strong regression test: it parses the generated shell command with the shell syntax parser, extracts the actual AWF invocation, and executes it against a fake startup function with synthetic credentials to prove the startup/client environment boundary holds at the shell level.
  • universal_llm_consumer_engine_test.go adds isolation tests for both Copilot credential sources (secrets.COPILOT_GITHUB_TOKEN and copilot-requests: write -> github.token) and confirms non-Copilot providers are unaffected.

Minor note

  • Left one non-blocking inline comment (/codebase-design) on behavior_defined_engine.go about resolveBackend being computed twice per execution path — low risk today since both calls share the same workflowData, but worth threading through as a single value if the function grows further.

Positive highlights

  • ✅ Spec (CTR-017, Section 7.6) updated in the same change set with concrete evidence mapping to tests — good practice for a security-relevant routing change.
  • ✅ 19 lock files regenerated and changeset/migration guidance included so operators know to recompile.
  • ✅ Unrelated SplitN to Cut cleanup is small and safe, doesn't conflate with the credential fix.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~60 AIC · ⌖ ~15 AIC · ⊞ 10.7K
Comment /matt to run again

Comment thread pkg/workflow/behavior_defined_engine.go Resolved

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.

🔵 Needs a closer look

The security-sensitive credential-routing change depends on AWF runtime behavior that simulated startup tests do not verify, so credential isolation and client compatibility across 19 workflows still require human validation.

No open issues 🎉

What changed in this PR

This PR updates gh-aw’s universal-consumer credential routing so Copilot tokens are not exposed through OpenAI credential aliases during AWF startup. OpenAI-compatible clients instead receive a non-secret placeholder inside the sandbox.

Changes:

  • Removes the shared Copilot-to-OpenAI credential alias while preserving gateway URL routing.
  • Adds provider, generated-YAML, and simulated startup regression coverage; regenerates 19 workflow locks.
  • Documents the CTR-017 routing contract and adds patch-release guidance requiring deployed workflows to be recompiled.
File Description
specs/​compiler-threat-detection-spec.md Defines routing boundaries in version 1.0.80.
specs/​compiler-threat-detection-changelog.md Records the contract and migration requirements.
pkg/​workflow/​universal_llm_consumer_engine.go Removes the Copilot credential’s OpenAI alias.
pkg/​workflow/​universal_llm_consumer_engine_test.go Tests credential isolation and provider preservation.
pkg/​workflow/​behavior_defined_engine.go Introduces the client placeholder inside AWF execution.
pkg/​workflow/​behavior_defined_engine_provider_test.go Tests startup timing and generated credential placement.
.github/​workflows/​smoke-pydantic.lock.yml Applies corrected routing to Pydantic smoke execution.
.github/​workflows/​smoke-opencode.lock.yml Applies corrected routing to OpenCode smoke execution.
.github/​workflows/​smoke-goose.lock.yml Applies corrected routing to Goose smoke execution.
.github/​workflows/​smoke-factory.lock.yml Applies corrected routing to Factory smoke execution.
.github/​workflows/​smoke-deepseek-harness.lock.yml Applies corrected routing to DeepSeek harness smoke execution.
.github/​workflows/​smoke-crush.lock.yml Applies corrected routing to Crush smoke execution.
.github/​workflows/​smoke-aider.lock.yml Applies corrected routing to Aider smoke execution.
.github/​workflows/​engine-conformance-pydantic-ai.lock.yml Updates Pydantic AI conformance execution.
.github/​workflows/​engine-conformance-opencode.lock.yml Updates OpenCode conformance execution.
.github/​workflows/​engine-conformance-goose.lock.yml Updates Goose conformance execution.
.github/​workflows/​engine-conformance-factory.lock.yml Updates Factory conformance execution.
.github/​workflows/​engine-conformance-deepseek-harness.lock.yml Updates DeepSeek harness conformance execution.
.github/​workflows/​engine-conformance-crush.lock.yml Updates Crush conformance execution.
.github/​workflows/​engine-conformance-aider.lock.yml Updates Aider conformance execution.
.github/​workflows/​daily-token-consumption-report.lock.yml Updates agent and evaluation credential routing.
.github/​workflows/​daily-team-evolution-insights.lock.yml Updates daily Goose execution routing.
.github/​workflows/​daily-security-red-team.lock.yml Updates agent and evaluation credential routing.
.github/​workflows/​daily-go-test-stubs-aider.lock.yml Updates daily Aider test-stub execution routing.
.github/​workflows/​daily-code-debt-aider.lock.yml Updates daily Aider code-debt execution routing.
.github/​aw/​configure-agentic-engine.md Explains credential placement and recompilation.
.changeset/​patch-universal-copilot-credentials.md Adds patch-release and migration guidance.

Review effort: Max (auto)

Resolve universal-consumer routing once per execution and share it across provider environment, firewall command, and secret filtering.

Co-authored-by: Copilot App <[email protected]>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.0

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.

2 participants