Skip to content

Commit 156029e

Browse files
Phase B fixup: regenerate codegen, fix scenario create_session calls
Two issues surfaced by Phase B CI: 1. The committed Python generated files were stale relative to the rest of the cross-language generators. Re-running `npm run generate` syncs them. No semantic change beyond round-tripping each variant dataclass through `from_dict(obj: Any) -> "Name":` quoting (matches what codegen has produced for a while; the on-disk file just hadn't been resynced). 2. `test/scenarios/**/python/main.py` were calling `client.create_session({...})` and `client.resume_session(session_id, {...})` with positional dicts. `CopilotClient.create_session` and `CopilotClient.resume_session` are kwargs-only — these always TypeError'd at runtime. Converted all 18 scenarios to explicit kwargs (`create_session(model="...", ...)`). Caught by github-code-quality CodeQL on PR #1376. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f037503 commit 156029e

29 files changed

Lines changed: 798 additions & 857 deletions

File tree

python/copilot/generated/rpc.py

Lines changed: 501 additions & 515 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/copilot/generated/session_events.py

Lines changed: 184 additions & 184 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/src/generated/api_types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use super::session_events::{
1010
AbortReason, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule,
1111
ReasoningSummary, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval,
1212
};
13-
use crate::types::{RequestId, SessionEvent, SessionId};
13+
use crate::types::SessionEvent;
14+
use crate::types::{RequestId, SessionId};
1415

1516
/// JSON-RPC method name constants.
1617
pub mod rpc_methods {

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ async def main():
1818

1919
try:
2020
session = await client.create_session(
21-
{
22-
"model": ANTHROPIC_MODEL,
23-
"provider": {
24-
"type": "anthropic",
25-
"base_url": ANTHROPIC_BASE_URL,
26-
"api_key": ANTHROPIC_API_KEY,
27-
},
28-
"available_tools": [],
29-
"system_message": {
30-
"mode": "replace",
31-
"content": "You are a helpful assistant. Answer concisely.",
32-
},
33-
}
21+
model=ANTHROPIC_MODEL,
22+
provider={
23+
"type": "anthropic",
24+
"base_url": ANTHROPIC_BASE_URL,
25+
"api_key": ANTHROPIC_API_KEY,
26+
},
27+
available_tools=[],
28+
system_message={
29+
"mode": "replace",
30+
"content": "You are a helpful assistant. Answer concisely.",
31+
},
3432
)
3533

3634
response = await session.send_and_wait("What is the capital of France?")

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,20 @@ async def main():
1919

2020
try:
2121
session = await client.create_session(
22-
{
23-
"model": AZURE_OPENAI_MODEL,
24-
"provider": {
25-
"type": "azure",
26-
"base_url": AZURE_OPENAI_ENDPOINT,
27-
"api_key": AZURE_OPENAI_API_KEY,
28-
"azure": {
29-
"api_version": AZURE_API_VERSION,
30-
},
22+
model=AZURE_OPENAI_MODEL,
23+
provider={
24+
"type": "azure",
25+
"base_url": AZURE_OPENAI_ENDPOINT,
26+
"api_key": AZURE_OPENAI_API_KEY,
27+
"azure": {
28+
"api_version": AZURE_API_VERSION,
3129
},
32-
"available_tools": [],
33-
"system_message": {
34-
"mode": "replace",
35-
"content": "You are a helpful assistant. Answer concisely.",
36-
},
37-
}
30+
},
31+
available_tools=[],
32+
system_message={
33+
"mode": "replace",
34+
"content": "You are a helpful assistant. Answer concisely.",
35+
},
3836
)
3937

4038
response = await session.send_and_wait("What is the capital of France?")

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ async def main():
1616

1717
try:
1818
session = await client.create_session(
19-
{
20-
"model": OLLAMA_MODEL,
21-
"provider": {
22-
"type": "openai",
23-
"base_url": OLLAMA_BASE_URL,
24-
},
25-
"available_tools": [],
26-
"system_message": {
27-
"mode": "replace",
28-
"content": COMPACT_SYSTEM_PROMPT,
29-
},
30-
}
19+
model=OLLAMA_MODEL,
20+
provider={
21+
"type": "openai",
22+
"base_url": OLLAMA_BASE_URL,
23+
},
24+
available_tools=[],
25+
system_message={
26+
"mode": "replace",
27+
"content": COMPACT_SYSTEM_PROMPT,
28+
},
3129
)
3230

3331
response = await session.send_and_wait("What is the capital of France?")

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ async def main():
1818

1919
try:
2020
session = await client.create_session(
21-
{
22-
"model": OPENAI_MODEL,
23-
"provider": {
24-
"type": "openai",
25-
"base_url": OPENAI_BASE_URL,
26-
"api_key": OPENAI_API_KEY,
27-
},
28-
}
21+
model=OPENAI_MODEL,
22+
provider={
23+
"type": "openai",
24+
"base_url": OPENAI_BASE_URL,
25+
"api_key": OPENAI_API_KEY,
26+
},
2927
)
3028

3129
response = await session.send_and_wait("What is the capital of France?")

test/scenarios/auth/gh-app/python/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def main():
8282
client = CopilotClient(CopilotClientOptions(github_token=token))
8383

8484
try:
85-
session = await client.create_session({"model": "claude-haiku-4.5"})
85+
session = await client.create_session(model="claude-haiku-4.5")
8686
response = await session.send_and_wait("What is the capital of France?")
8787
if response:
8888
print(response.data.content)

test/scenarios/bundling/app-backend-to-server/python/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async def ask_copilot(prompt: str) -> str:
1717
client = CopilotClient(CopilotClientOptions(connection=RuntimeConnection.uri(CLI_URL)))
1818

1919
try:
20-
session = await client.create_session({"model": "claude-haiku-4.5"})
20+
session = await client.create_session(model="claude-haiku-4.5")
2121

2222
response = await session.send_and_wait(prompt)
2323

test/scenarios/bundling/app-direct-server/python/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async def main():
1414
)
1515

1616
try:
17-
session = await client.create_session({"model": "claude-haiku-4.5"})
17+
session = await client.create_session(model="claude-haiku-4.5")
1818

1919
response = await session.send_and_wait("What is the capital of France?")
2020

0 commit comments

Comments
 (0)