feat: wire BYOK providers#240
Conversation
|
@microsoft-github-policy-service agree |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #240 +/- ##
=======================================
Coverage ? 75.81%
=======================================
Files ? 154
Lines ? 18014
Branches ? 0
=======================================
Hits ? 13657
Misses ? 3399
Partials ? 958
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a “custom/BYOK provider” lane to the copilot-sdk executor so Waza can route sessions through non-default Copilot SDK providers, label usage appropriately, and persist only sanitized provider metadata in results.
Changes:
- Thread
COPILOT_*provider environment configuration into Copilot SDK session create/resume and skip default Copilot auth checks when a custom provider is configured. - Extend usage stats to record
provider/provider_host, preserve them on aggregation, and update CLI usage labeling (e.g., “Provider Requests”). - Update docs to describe the new provider env vars and tweak token tests’ temp git repo setup to disable GPG signing.
Show a summary per file
| File | Description |
|---|---|
| site/src/content/docs/reference/cli.mdx | Documents custom provider env vars + clarifies auth requirement is for the default provider. |
| site/src/content/docs/quick-start.mdx | Updates quick start auth/prereqs; adds note about custom provider configuration. |
| README.md | Adds custom provider section and updates auth wording in CI guidance. |
| internal/models/outcome.go | Adds provider metadata fields/constants and preserves them during usage aggregation. |
| internal/models/outcome_test.go | Adds tests covering provider metadata preservation and “mixed” aggregation behavior. |
| internal/execution/copilot.go | Parses provider config from env, skips auth check in BYOK mode, passes provider config to sessions, and annotates usage with sanitized provider host. |
| internal/execution/copilot_test.go | Adds tests for BYOK auth-skip, provider pass-through on create/resume, and host sanitization. |
| docs/SKILLS_CI_INTEGRATION.md | Clarifies default route uses GITHUB_TOKEN, and custom providers use COPILOT_* vars instead. |
| docs/GETTING-STARTED.md | Updates mock executor guidance to mention custom provider configuration. |
| cmd/waza/tokens/internal/git/git_test.go | Disables GPG signing in temp repos used by token tests. |
| cmd/waza/tokens/compare_test.go | Disables GPG signing in temp repos used by token tests. |
| cmd/waza/cmd_run.go | Prints provider metadata and relabels request counters based on provider route. |
Copilot's findings
- Files reviewed: 12/12 changed files
- Comments generated: 1
spboyer
left a comment
There was a problem hiding this comment.
Reviewed the BYOK provider wiring and docs; the implementation looks sound, but two README auth/provider examples need correction before merge.
Issues to address:
- README.md:381 -
waza modelsstill lists models through the default Copilot API, so BYOK auth bypass wording is too broad - README.md:1173 - Azure OpenAI example uses OpenAI provider/path and an unsupported wire API value
Head branch was pushed to by a user without write access
spboyer
left a comment
There was a problem hiding this comment.
The current PR head fixes the README issues from my prior review. One site CLI reference page still has the same waza models custom-provider auth wording problem.
Issues to address:
- site/src/content/docs/reference/cli.mdx:909 -
waza modelsstill requires Copilot auth and does not use the custom provider session config
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
spboyer
left a comment
There was a problem hiding this comment.
Addressed the remaining review feedback and resolved the threads. LGTM.
) (#306) * fix: skip --model CLI startup arg when BYOK provider is configured (#305) PR #263 added --model <defaultModelID> to copilot.ClientOptions.CLIArgs so the embedded Copilot CLI honors the eval-configured model. However, the CLI validates that startup --model against the GitHub Copilot catalog BEFORE the per-session ProviderConfig from #240 is applied. For BYOK / custom provider model IDs that are not in the Copilot catalog (e.g. minimax-m2.7), startup fails with 'Model "..." is not available'. Suppress the startup --model arg whenever providerFromEnv() reports an enabled custom provider. SessionConfig.Model + SessionConfig.Provider are still passed per session via Execute, so the SDK selects the right model against the custom provider without pre-validating against the GitHub catalog. Normal GitHub Copilot models retain the #263 behavior. Adds a regression test covering the BYOK + non-empty defaultModelID case, and hardens the existing CLIArgs tests against environments that already have COPILOT_BASE_URL set. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor(test): properly unset COPILOT_* env vars in clearCustomProviderEnv Replace t.Setenv(name, "") with os.Unsetenv + t.Cleanup so the helper actually removes variables from the environment rather than setting them to empty strings. This matches the comment ("unsets") and avoids any potential confusion for future readers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(test): ignore os.Setenv/Unsetenv return values in clearCustomProviderEnv Satisfies errcheck in golangci-lint v2.10.1; these calls don't realistically fail in tests and t.Cleanup ensures restoration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Shayne Boyer <spboyer@users.noreply.github.com>
Summary
Adds a clean custom-provider lane for the Copilot SDK executor:
COPILOT_*provider env vars into session create/resumeProvider RequestsAlso disables GPG signing in temp git repos used by token tests.
Validation
go test ./...cd site && npm ci --include=optionalcd site && npm run build