























@@ -2298,6 +2298,85 @@ describe("openai transport stream", () => {
22982298});
22992299});
230023002301+it("normalizes overlong Copilot Responses replay tool ids before dispatch", () => {
2302+const longToolItemId = "iVec" + "A".repeat(360);
2303+const longToolCallId = `call_ug6lFGKwZDjHfzW8H0PDQRwN|${longToolItemId}`;
2304+const params = buildOpenAIResponsesParams(
2305+{
2306+id: "gpt-5.5",
2307+name: "GPT-5.5",
2308+api: "openai-responses",
2309+provider: "github-copilot",
2310+baseUrl: "https://api.githubcopilot.com",
2311+reasoning: true,
2312+input: ["text"],
2313+cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
2314+contextWindow: 200000,
2315+maxTokens: 8192,
2316+} satisfies Model<"openai-responses">,
2317+{
2318+systemPrompt: "system",
2319+messages: [
2320+{ role: "user", content: "read the queue", timestamp: 0 },
2321+{
2322+role: "assistant",
2323+api: "openai-responses",
2324+provider: "github-copilot",
2325+model: "gpt-5.5",
2326+usage: {
2327+input: 0,
2328+output: 0,
2329+cacheRead: 0,
2330+cacheWrite: 0,
2331+totalTokens: 0,
2332+cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
2333+},
2334+stopReason: "toolUse",
2335+timestamp: 1,
2336+content: [
2337+{
2338+type: "toolCall",
2339+id: longToolCallId,
2340+name: "exec",
2341+arguments: { command: "gh pr list --limit 1" },
2342+},
2343+],
2344+},
2345+{
2346+role: "toolResult",
2347+toolCallId: longToolCallId,
2348+toolName: "exec",
2349+content: [{ type: "text", text: "[]" }],
2350+isError: false,
2351+timestamp: 2,
2352+},
2353+{ role: "user", content: "continue", timestamp: 3 },
2354+],
2355+tools: [],
2356+} as never,
2357+{ sessionId: "session-123" },
2358+) as {
2359+input?: Array<{ type?: string; id?: string; call_id?: string }>;
2360+};
2361+2362+const functionCall = params.input?.find((item) => item.type === "function_call");
2363+const functionOutput = params.input?.find((item) => item.type === "function_call_output");
2364+expect(functionCall).toBeDefined();
2365+expect(functionOutput).toBeDefined();
2366+expect(functionCall?.id).toMatch(/^fc_/);
2367+expect(functionCall?.id?.length).toBeLessThanOrEqual(64);
2368+expect(functionCall?.call_id).toBe("call_ug6lFGKwZDjHfzW8H0PDQRwN");
2369+expect(functionOutput?.call_id).toBe(functionCall?.call_id);
2370+for (const item of params.input ?? []) {
2371+if (item.id !== undefined) {
2372+expect(item.id.length).toBeLessThanOrEqual(64);
2373+}
2374+if (item.call_id !== undefined) {
2375+expect(item.call_id.length).toBeLessThanOrEqual(64);
2376+}
2377+}
2378+});
2379+23012380it("adds minimal user input for Codex responses when only the system prompt is present", () => {
23022381const params = buildOpenAIResponsesParams(
23032382{
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。