Skip to content

Fix Copilot SDK sample driver BYOK session configuration in Daily Model Inventory workflow#37454

Merged
pelikhan merged 6 commits into
mainfrom
copilot/fix-daily-model-inventory-checker
Jun 7, 2026
Merged

Fix Copilot SDK sample driver BYOK session configuration in Daily Model Inventory workflow#37454
pelikhan merged 6 commits into
mainfrom
copilot/fix-daily-model-inventory-checker

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 7, 2026

Daily Model Inventory Checker failed because the Copilot SDK sample Node driver created a session without provider configuration, causing SDK auth initialization to fail (Session was not created with authentication info or custom provider) despite harness-resolved BYOK metadata.

  • Root cause

    • The workflow uses .github/drivers/copilot_sdk_driver_sample_node.cjs.
    • Harness resolved and exported GH_AW_COPILOT_SDK_PROVIDER_BASE_URL, but the sample driver did not pass provider into createSession(...).
  • What changed

    • Sample driver session config now includes BYOK provider when present
      • Added buildSessionConfig(...) in .github/drivers/copilot_sdk_driver_sample_node.cjs.
      • If GH_AW_COPILOT_SDK_PROVIDER_BASE_URL is set, session config now includes:
        • provider: { type: "openai", baseUrl: ... }
      • createSession(...) now consumes this config.
    • Driver module structure adjusted for safe import
      • Exported buildSessionConfig(...).
      • Wrapped execution with require.main === module so importing the driver does not execute main().
function buildSessionConfig(model, onPermissionRequest) {
  const config = { onPermissionRequest, model };
  const providerBaseUrl = process.env.GH_AW_COPILOT_SDK_PROVIDER_BASE_URL;
  if (providerBaseUrl) {
    config.provider = { type: "openai", baseUrl: providerBaseUrl };
  }
  return config;
}

Copilot AI linked an issue Jun 7, 2026 that may be closed by this pull request
Copilot AI and others added 4 commits June 7, 2026 00:41
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix daily model inventory checker workflow failure Fix Copilot SDK sample driver BYOK session configuration in Daily Model Inventory workflow Jun 7, 2026
Copilot AI requested a review from pelikhan June 7, 2026 00:44
import { createRequire } from "module";

const require = createRequire(import.meta.url);
const { buildSessionConfig } = require("../../../.github/drivers/copilot_sdk_driver_sample_node.cjs");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot delete this file

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.

Done in 573e0b7 — the file actions/setup/js/copilot_sdk_driver_sample_node.test.cjs has been deleted.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan June 7, 2026 00:58
@pelikhan pelikhan marked this pull request as ready for review June 7, 2026 01:01
Copilot AI review requested due to automatic review settings June 7, 2026 01:01
@pelikhan pelikhan merged commit ec4582f into main Jun 7, 2026
@pelikhan pelikhan deleted the copilot/fix-daily-model-inventory-checker branch June 7, 2026 01:02
Copy link
Copy Markdown
Contributor

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

This PR updates the Copilot SDK sample Node driver used by the Daily Model Inventory workflow so it can correctly include BYOK provider configuration when the harness exports GH_AW_COPILOT_SDK_PROVIDER_BASE_URL, and so the driver can be safely imported without executing its main().

Changes:

  • Added buildSessionConfig(model, onPermissionRequest) to include provider: { type: "openai", baseUrl } when GH_AW_COPILOT_SDK_PROVIDER_BASE_URL is set.
  • Updated createSession(...) to consume the new session config builder.
  • Wrapped execution with if (require.main === module) and exported buildSessionConfig for safe import.
Show a summary per file
File Description
.github/drivers/copilot_sdk_driver_sample_node.cjs Adds BYOK-aware session config construction and prevents side effects on import.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment on lines 42 to +43
async function main() {
const { CopilotClient, approveAll } = require("@github/copilot-sdk");
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.

[aw] Daily Model Inventory Checker failed

3 participants