Skip to content

Commit b75acfe

Browse files
committed
Isolate reasoning model switch fixtures
Load the gpt-5.4 catalog in dedicated test contexts so model-switch assertions exercise the selected reasoning-capable model across SDKs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9b80f6cb-b851-4598-8294-f4431c6f3143
1 parent d85ddc1 commit b75acfe

5 files changed

Lines changed: 47 additions & 23 deletions

File tree

dotnet/test/E2E/SessionE2ETests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,10 @@ public async Task Should_Set_Model_On_Existing_Session()
611611
[Fact]
612612
public async Task Should_Set_Model_With_ReasoningEffort()
613613
{
614-
var session = await CreateSessionAsync();
614+
await using var isolatedCtx = await E2ETestContext.CreateAsync();
615+
await isolatedCtx.ConfigureForTestAsync("session", nameof(Should_Set_Model_With_ReasoningEffort));
616+
var isolatedClient = isolatedCtx.CreateClient();
617+
await using var session = await isolatedCtx.CreateSessionAsync(isolatedClient);
615618

616619
var modelChangedTask = TestHelper.GetNextEventOfTypeAsync<SessionModelChangeEvent>(session);
617620

go/internal/e2e/session_e2e_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,12 @@ func getSystemMessage(exchange testharness.ParsedHttpExchange) string {
10471047
}
10481048

10491049
func TestSetModelWithReasoningEffortE2E(t *testing.T) {
1050+
t.Run("should set model with reasoningeffort", runSetModelWithReasoningEffortE2E)
1051+
}
1052+
1053+
func runSetModelWithReasoningEffortE2E(t *testing.T) {
10501054
ctx := testharness.NewTestContext(t)
1055+
ctx.ConfigureForTest(t)
10511056
client := ctx.NewClient()
10521057
t.Cleanup(func() { client.ForceStop() })
10531058

nodejs/test/e2e/session.e2e.test.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -964,15 +964,21 @@ describe("Send Blocking Behavior", async () => {
964964
expect(event.data.newModel).toBe("gpt-4.1");
965965
});
966966

967-
it("should set model with reasoningEffort", async () => {
968-
await using session = await client.createSession({ onPermissionRequest: approveAll });
967+
describe("reasoning effort model switch (isolated to avoid models cache contamination)", async () => {
968+
const { copilotClient: reasoningClient } = await createSdkTestContext();
969969

970-
const modelChangePromise = getNextEventOfType(session, "session.model_change");
970+
it("should set model with reasoningEffort", async () => {
971+
await using session = await reasoningClient.createSession({
972+
onPermissionRequest: approveAll,
973+
});
971974

972-
await session.setModel("gpt-5.4", { reasoningEffort: "high" });
975+
const modelChangePromise = getNextEventOfType(session, "session.model_change");
973976

974-
const event = await modelChangePromise;
975-
expect(event.data.newModel).toBe("gpt-5.4");
976-
expect(event.data.reasoningEffort).toBe("high");
977+
await session.setModel("gpt-5.4", { reasoningEffort: "high" });
978+
979+
const event = await modelChangePromise;
980+
expect(event.data.newModel).toBe("gpt-5.4");
981+
expect(event.data.reasoningEffort).toBe("high");
982+
});
977983
});
978984
});

python/e2e/test_session_e2e.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -679,27 +679,36 @@ async def test_should_set_model_with_reasoning_effort(self, ctx: E2ETestContext)
679679
"""Test that setModel passes reasoningEffort and it appears in the model_change event."""
680680
import asyncio
681681

682-
session = await ctx.client.create_session(
683-
on_permission_request=PermissionHandler.approve_all
684-
)
682+
isolated_ctx = E2ETestContext()
683+
await isolated_ctx.setup()
684+
try:
685+
await isolated_ctx.configure_for_test(
686+
"session", "should_set_model_with_reasoningeffort"
687+
)
688+
session = await isolated_ctx.client.create_session(
689+
on_permission_request=PermissionHandler.approve_all
690+
)
685691

686-
model_change_event = asyncio.get_event_loop().create_future()
692+
model_change_event = asyncio.get_event_loop().create_future()
687693

688-
def on_event(event):
689-
if model_change_event.done():
690-
return
694+
def on_event(event):
695+
if model_change_event.done():
696+
return
691697

692-
match event.data:
693-
case SessionModelChangeData() as data:
694-
model_change_event.set_result(data)
698+
match event.data:
699+
case SessionModelChangeData() as data:
700+
model_change_event.set_result(data)
695701

696-
session.on(on_event)
702+
session.on(on_event)
697703

698-
await session.set_model("gpt-5.4", reasoning_effort="high")
704+
await session.set_model("gpt-5.4", reasoning_effort="high")
699705

700-
data = await asyncio.wait_for(model_change_event, timeout=30)
701-
assert data.new_model == "gpt-5.4"
702-
assert data.reasoning_effort == "high"
706+
data = await asyncio.wait_for(model_change_event, timeout=30)
707+
assert data.new_model == "gpt-5.4"
708+
assert data.reasoning_effort == "high"
709+
await session.disconnect()
710+
finally:
711+
await isolated_ctx.teardown()
703712

704713
async def test_should_accept_blob_attachments(self, ctx: E2ETestContext):
705714
# Write the image to disk so the model can view it

test/snapshots/session/should_set_model_with_reasoningeffort.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
models:
22
- claude-sonnet-4.5
3+
- gpt-5.4
34
conversations:
45
- messages:
56
- role: system

0 commit comments

Comments
 (0)