Skip to content

Commit 236ac94

Browse files
patnikoCopilot
andcommitted
fix: add missing onPermissionRequest to all scenario tests
Scenarios were created before PR #554 required permission handlers on session creation. Add approve_all / ApproveAll / PermissionHandler to all ~100 scenario test files across TypeScript, Python, Go, and C#. Co-authored-by: Copilot <[email protected]>
1 parent f7fe4c1 commit 236ac94

File tree

99 files changed

+156
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+156
-86
lines changed

test/scenarios/auth/byok-anthropic/csharp/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
{
2222
await using var session = await client.CreateSessionAsync(new SessionConfig
2323
{
24+
OnPermissionRequest = PermissionHandler.ApproveAll,
2425
Model = model,
2526
Provider = new ProviderConfig
2627
{

test/scenarios/auth/byok-anthropic/go/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func main() {
3535

3636
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
3737
Model: model,
38+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
3839
Provider: &copilot.ProviderConfig{
3940
Type: "anthropic",
4041
BaseURL: baseUrl,

test/scenarios/auth/byok-anthropic/python/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22
import os
33
import sys
4-
from copilot import CopilotClient
4+
from copilot import CopilotClient, PermissionHandler
55

66
ANTHROPIC_API_KEY = os.environ.get("ANTHROPIC_API_KEY")
77
ANTHROPIC_MODEL = os.environ.get("ANTHROPIC_MODEL", "claude-sonnet-4-20250514")
@@ -20,6 +20,7 @@ async def main():
2020

2121
try:
2222
session = await client.create_session({
23+
"on_permission_request": PermissionHandler.approve_all,
2324
"model": ANTHROPIC_MODEL,
2425
"provider": {
2526
"type": "anthropic",

test/scenarios/auth/byok-anthropic/typescript/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CopilotClient } from "@github/copilot-sdk";
1+
import { CopilotClient, approveAll } from "@github/copilot-sdk";
22

33
async function main() {
44
const apiKey = process.env.ANTHROPIC_API_KEY;
@@ -14,7 +14,7 @@ async function main() {
1414
});
1515

1616
try {
17-
const session = await client.createSession({
17+
const session = await client.createSession({ onPermissionRequest: approveAll,
1818
model,
1919
provider: {
2020
type: "anthropic",

test/scenarios/auth/byok-azure/csharp/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
{
2323
await using var session = await client.CreateSessionAsync(new SessionConfig
2424
{
25+
OnPermissionRequest = PermissionHandler.ApproveAll,
2526
Model = model,
2627
Provider = new ProviderConfig
2728
{

test/scenarios/auth/byok-azure/go/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func main() {
3636

3737
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
3838
Model: model,
39+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
3940
Provider: &copilot.ProviderConfig{
4041
Type: "azure",
4142
BaseURL: endpoint,

test/scenarios/auth/byok-azure/python/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22
import os
33
import sys
4-
from copilot import CopilotClient
4+
from copilot import CopilotClient, PermissionHandler
55

66
AZURE_OPENAI_ENDPOINT = os.environ.get("AZURE_OPENAI_ENDPOINT")
77
AZURE_OPENAI_API_KEY = os.environ.get("AZURE_OPENAI_API_KEY")
@@ -21,6 +21,7 @@ async def main():
2121

2222
try:
2323
session = await client.create_session({
24+
"on_permission_request": PermissionHandler.approve_all,
2425
"model": AZURE_OPENAI_MODEL,
2526
"provider": {
2627
"type": "azure",

test/scenarios/auth/byok-azure/typescript/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CopilotClient } from "@github/copilot-sdk";
1+
import { CopilotClient, approveAll } from "@github/copilot-sdk";
22

33
async function main() {
44
const endpoint = process.env.AZURE_OPENAI_ENDPOINT;
@@ -15,7 +15,7 @@ async function main() {
1515
});
1616

1717
try {
18-
const session = await client.createSession({
18+
const session = await client.createSession({ onPermissionRequest: approveAll,
1919
model,
2020
provider: {
2121
type: "azure",

test/scenarios/auth/byok-ollama/csharp/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
{
1818
await using var session = await client.CreateSessionAsync(new SessionConfig
1919
{
20+
OnPermissionRequest = PermissionHandler.ApproveAll,
2021
Model = model,
2122
Provider = new ProviderConfig
2223
{

test/scenarios/auth/byok-ollama/go/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func main() {
3232

3333
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
3434
Model: model,
35+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
3536
Provider: &copilot.ProviderConfig{
3637
Type: "openai",
3738
BaseURL: baseUrl,

0 commit comments

Comments
 (0)