close
Skip to content

feat: BYOK onboarding, provider commands, docs, and polish#135

Merged
ChrisRomp merged 10 commits intomainfrom
feature/byok-onboarding
Mar 23, 2026
Merged

feat: BYOK onboarding, provider commands, docs, and polish#135
ChrisRomp merged 10 commits intomainfrom
feature/byok-onboarding

Conversation

@ChrisRomp
Copy link
Copy Markdown
Owner

Summary

PR 3 of 3 in the BYOK provider series. Adds user-facing onboarding commands, documentation, error handling, and polish discovered during live testing.

What it does

  • /provider command with list, test, and add/remove subcommands
  • BYOK-aware error messages (connection refused, auth failure, model not found)
  • Provider connectivity testing (/provider test <name>)
  • Model-level wireApi override (mix completions and responses models on one provider)
  • providers topic in fetch_copilot_bridge_documentation tool (admin/non-admin variants)
  • Admin agent can manage provider config directly (/provider add detects admin role)
  • Fixed current" indicator when BYOK model shares name with Copilot modeldouble "
  • Fixed same-provider model switch creating new session when wireApi differs
  • Full BYOK documentation in docs/byok.md

Key changes

  • src/core/command-handler.ts: /provider commands, admin-aware add/remove, isCurrent fix
  • src/core/session-manager.ts: BYOK error wrapping, wireApi change detection in switchModel
  • src/index.ts: testProviderConnectivity(), provider_test action handler
  • src/config.ts: Model-level wireApi validation and resolution
  • src/core/bridge-docs.ts: New providers topic with full BYOK docs
  • docs/byok.md: Comprehensive BYOK guide
  • 559 total tests (18 new)

Known limitations (follow-up)

  • /provider test uses simplified connectivity check, not full SDK resolution path
  • Removing a provider while channels reference it logs a warning but doesn't auto-reset prefs

Prior PRs

ChrisRomp and others added 7 commits March 22, 2026 21:54
…test

- / list configured BYOK providers with detailsprovider
- /provider test < test provider connectivity (HTTP + model validation)name>
- /provider add| guide users to config.json workflowremove
- BYOK error context: connection refused, auth failure, model not found get clear messages
- Provider switch failure reverts prefs to avoid broken channel state
- Added /provider to /help all

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- docs/byok. full guide: config, examples, commands, resolution, troubleshootingmd
- README. BYOK in features, /provider commands in table, doc linkmd
- AGENTS. updated model matching, added BYOK providers sectionmd

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- 11 tests covering /provider list, test, add/remove guidance, unknown subcommand
- 552 total tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- New 'providers' topic in fetch_copilot_bridge_documentation with full
  BYOK config schema, commands, resolution, and session behavior docs
- Admin variant includes provider add/remove/validate instructions
- /provider add|remove now mentions admin bot can help
- Updated overview, commands, and config topics with BYOK references
- Added provider management section to admin agent template
- 3 new tests (555 total)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move wireApi from provider-only to per-model configurable. Model-level
wireApi overrides the provider default, allowing mixed endpoints (e.g.,
GPT-4o with chat + Codex with responses on the same Azure provider).

- Add wireApi to ProviderModelEntry type
- resolveProviderConfig accepts modelId, applies model-level override
- Config validation for model-level wireApi
- Updated all docs, config sample, and admin template
- 3 new tests (559 total)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When a BYOK provider is active,  current' marker now only appearsthe '
on the provider-prefixed model entry, not on the Copilot model with the
same bare name.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ame-provider wireApi switch

- Fix all docs to say 'completions' instead of 'chat' (matches SDK and validation)
- Force new session when switching models within same provider if wireApi differs
- Add wireApiChanged() helper to detect per-model wireApi mismatches

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 23, 2026 17:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Completes the BYOK provider feature series by adding user-facing /provider onboarding commands, richer BYOK documentation surfaced via bridge docs, model-level wireApi overrides, and improved session behavior/error messaging when working with external providers.

Changes:

  • Added /provider command (list + test) and admin-aware guidance for adding/removing providers.
  • Implemented model-level wireApi overrides (config validation + provider resolution) and session recreation when wireApi changes within the same provider.
  • Added BYOK documentation (docs/byok.md) and a new providers topic in fetch_copilot_bridge_documentation, plus supporting README/agent docs updates.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
templates/admin/AGENTS.md Admin runbook updates for BYOK provider management
src/types.ts Adds model-level wireApi to provider model entries
src/index.ts Adds provider connectivity test helper + provider_test action handling
src/core/session-manager.ts Applies model-level wireApi during session (re)create; recreates session on same-provider wireApi change; improves BYOK error messaging; adds docs topic enum
src/core/command-handler.ts Implements /provider(s) command UX + help updates; fixes “current model” indicator for BYOK models
src/core/byok-providers.test.ts Adds tests for model-level wireApi validation + resolution
src/core/byok-onboarding.test.ts New tests covering /provider UX behaviors
src/core/bridge-docs.ts Adds providers documentation topic with admin/non-admin variants
src/core/bridge-docs.test.ts Extends docs tests to cover new topic
src/config.ts Validates model-level wireApi; resolves provider config with per-model override
docs/byok.md New comprehensive BYOK guide
config.sample.json Updates sample BYOK config to demonstrate per-model wireApi
README.md Adds BYOK to feature list + links to BYOK docs
AGENTS.md Updates internal agent guidance to include BYOK behaviors and commands

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

Comment thread docs/byok.md
Comment thread src/index.ts
Comment thread src/core/command-handler.ts
Comment thread templates/admin/AGENTS.md Outdated
Comment thread src/core/bridge-docs.ts
ChrisRomp and others added 2 commits March 23, 2026 10:53
- Wrap provider examples in top-level 'providers' key for copy-paste clarity
- Add inline bearerToken to /provider auth display
- Fix type field: optional, includes 'anthropic' option

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Document SDK Azure URL construction pattern (baseUrl + /openai/deployments/{model})
- Add common 404 causes: baseUrl format, deployment name mismatch, apiVersion
- Clarify auth header differences by provider type (api-key vs Bearer vs x-api-key)
- Add non-standard Azure gateway notes
- Add tools-not-executing troubleshooting for models without structured function calling
- Update both docs/byok.md and bridge-docs.ts providers topic

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 23, 2026 18:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/index.ts:843

  • testProviderConnectivity() always sends Authorization: Bearer ... regardless of provider type. Azure OpenAI expects api-key, and Anthropic expects x-api-key (plus required version headers), so /provider test will give false negatives even when the provider config is correct. Suggest setting auth headers based on provider.type (reusing the same logic as the SDK/provider resolution where possible).
  const headers: Record<string, string> = { 'Accept': 'application/json' };
  if (apiKey) headers['Authorization'] = `Bearer ${apiKey}`;
  else if (bearerToken) headers['Authorization'] = `Bearer ${bearerToken}`;


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

Comment thread src/core/session-manager.ts Outdated
Comment thread AGENTS.md Outdated
Comment thread src/index.ts
…t doc

- Only apply BYOK-specific error messages when provider actually resolved
  (prevents misattributing Copilot errors as provider issues)
- Fix AGENTS.md: /provider test hits ${baseUrl}/models, not /v1/models

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ChrisRomp ChrisRomp merged commit b6c9e89 into main Mar 23, 2026
6 checks passed
@ChrisRomp ChrisRomp deleted the feature/byok-onboarding branch March 23, 2026 19:09
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