feat(opencode-go): muse-spark-1.2 and Responses tool fixes (#3820)
- Add muse-spark-1.2-contributor as responses-only model on OpenCode Go - Normalize object tool schemas without properties in OpenCode Go executor - Make fallback Responses call_ids unique across same-millisecond calls - Make Responses output coercion fail-soft for circular and non-stringifiable values
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import "../translator/registerAll.js";
|
||||
import { openaiResponsesToOpenAIResponse } from "../../open-sse/translator/response/openai-responses.js";
|
||||
import { clampResponsesCallId, coerceResponsesOutput, MAX_RESPONSES_CALL_ID_LEN } from "../../open-sse/translator/formats/responsesApi.js";
|
||||
import { initState, translateResponse } from "../../open-sse/translator/index.js";
|
||||
import { FORMATS } from "../../open-sse/translator/formats.js";
|
||||
|
||||
@@ -138,3 +139,27 @@ describe("responses → claude end-to-end keeps parallel tool_use blocks separat
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("fallback call_ids stay unique within a batch", () => {
|
||||
it("same-millisecond fallbacks never collide", () => {
|
||||
const ids = new Set(Array.from({ length: 50 }, () => clampResponsesCallId(undefined)));
|
||||
expect(ids.size).toBe(50);
|
||||
for (const id of ids) {
|
||||
expect(id.startsWith("call_")).toBe(true);
|
||||
expect(id.length).toBeLessThanOrEqual(MAX_RESPONSES_CALL_ID_LEN);
|
||||
}
|
||||
expect(new Set([clampResponsesCallId(""), clampResponsesCallId(null)]).size).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("output coercion stays fail-soft on unstringifiable values", () => {
|
||||
it("never throws on BigInt/circular array elements", () => {
|
||||
const circular = {};
|
||||
circular.self = circular;
|
||||
const input = [1n, circular, { text: "ok" }];
|
||||
expect(() => coerceResponsesOutput(input)).not.toThrow();
|
||||
const out = coerceResponsesOutput(input);
|
||||
expect(typeof out).toBe("string");
|
||||
expect(out).toContain("ok");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user