



























@@ -81,6 +81,7 @@ const RESPONSE_FAILED_NO_DETAILS_MESSAGE = "Unknown error (no error details in r
8181const MAX_OPENAI_STRICT_TOOL_DOWNGRADE_DIAGNOSTIC_KEYS = 256;
8282const OPENAI_RESPONSES_REASONING_REPLAY_META_KEY = "__openclaw_replay";
8383const OPENAI_RESPONSES_REASONING_REPLAY_BLOCK_META_KEY = "openclawReasoningReplay";
84+const OPENAI_RESPONSES_REPLAY_ITEM_ID_MAX_LENGTH = 64;
8485const log = createSubsystemLogger("openai-transport");
8586const loggedOpenAIStrictToolDowngradeDiagnosticKeys = new Set<string>();
8687@@ -940,6 +941,27 @@ function shortHash(value: string): string {
940941return createHash("sha256").update(value).digest("hex").slice(0, 16);
941942}
942943944+function normalizeResponsesReplayItemId(
945+id: string | undefined,
946+prefix: string,
947+): string | undefined {
948+if (!id) {
949+return undefined;
950+}
951+if (id.length <= OPENAI_RESPONSES_REPLAY_ITEM_ID_MAX_LENGTH) {
952+return id;
953+}
954+return `${prefix}_${shortHash(id)}`;
955+}
956+957+function isSafeResponsesReplayItemId(id: unknown): id is string {
958+return (
959+typeof id === "string" &&
960+id.length > 0 &&
961+id.length <= OPENAI_RESPONSES_REPLAY_ITEM_ID_MAX_LENGTH
962+);
963+}
964+943965function encodeTextSignatureV1(id: string, phase?: "commentary" | "final_answer"): string {
944966return JSON.stringify({ v: 1, id, ...(phase ? { phase } : {}) });
945967}
@@ -1091,16 +1113,20 @@ function convertResponsesMessages(
10911113if (!shouldReplayResponsesItemIds) {
10921114delete replayableReasoningItem.id;
10931115}
1116+if (
1117+model.provider === "github-copilot" &&
1118+!isSafeResponsesReplayItemId(replayableReasoningItem.id)
1119+) {
1120+continue;
1121+}
10941122output.push(replayableReasoningItem as ResponseInputItem);
10951123}
10961124} else if (block.type === "text") {
10971125const textSignature = parseTextSignature(block.textSignature);
10981126let msgId = shouldReplayResponsesItemIds
10991127 ? (textSignature?.id ?? `msg_${msgIndex}`)
11001128 : undefined;
1101-if (msgId && msgId.length > 64) {
1102-msgId = `msg_${shortHash(msgId)}`;
1103-}
1129+msgId = normalizeResponsesReplayItemId(msgId, "msg");
11041130const messageItem: ReplayableResponseOutputMessage = {
11051131type: "message",
11061132role: "assistant",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。