fix(github): drop trailing assistant prefill for Copilot chat (#5802)

Integrated into release/v3.8.43
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-01 21:54:43 -03:00
committed by GitHub
parent 3323b5b617
commit e7ae29d607
4 changed files with 156 additions and 0 deletions

View File

@@ -112,6 +112,11 @@ test("GithubExecutor.transformRequest injects JSON response instructions for Cla
reasoning_text: "internal",
reasoning_content: "internal",
},
// Trailing user turn: dropTrailingAssistantPrefill (9router#2143) strips a
// conversation that ends in "assistant", which would otherwise remove the very
// message this test inspects below. Keep the array ending in "user" so this test
// stays focused on response_format injection + reasoning-field stripping.
{ role: "user", content: "thanks" },
],
};
@@ -225,6 +230,11 @@ test("GithubExecutor.transformRequest leaves string content and missing content
role: "assistant",
tool_calls: [{ id: "c1", type: "function", function: { name: "f", arguments: "{}" } }],
},
// Trailing tool response: dropTrailingAssistantPrefill (9router#2143) strips a
// conversation that ends in "assistant", which would otherwise remove the very
// tool_calls message this test inspects below. A real tool round-trip ends in
// "tool", not "assistant" — model that shape instead.
{ role: "tool", tool_call_id: "c1", content: "result" },
],
};
const result = executor.transformRequest("claude-sonnet-4.6", body, true, {});