fix: broaden thread id capture
This commit is contained in:
@@ -700,6 +700,28 @@ async function run() {
|
||||
assert(streamThreadEntry?.response_id === "resp_stream", "stream 请求记录未保留 response_id");
|
||||
assert(streamThreadEntry?.thread_id === "thread_stream_ok", "stream 请求记录未保留 thread_id");
|
||||
|
||||
const metadataThreadResponse = await fetch(`http://127.0.0.1:${gatewayPort}/responses`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"thread-id": "thread_header_fallback",
|
||||
"x-client-request-id": "thread_header_request_id",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
test_reasoning_tokens: 128,
|
||||
client_metadata: {
|
||||
thread_id: "thread_client_metadata",
|
||||
"x-codex-thread-id": "thread_client_metadata_alias",
|
||||
},
|
||||
}),
|
||||
});
|
||||
assert(metadataThreadResponse.status === 200, `metadata thread 请求失败: ${metadataThreadResponse.status}`);
|
||||
await metadataThreadResponse.json();
|
||||
const metadataThreadRequestsResponse = await fetch(`http://127.0.0.1:${gatewayPort}/__codex_retry_gateway/api/requests?query=${encodeURIComponent("thread_client_metadata")}`);
|
||||
const metadataThreadRequestsPayload = await metadataThreadRequestsResponse.json();
|
||||
const metadataThreadEntry = (metadataThreadRequestsPayload?.entries || []).find((entry) => entry.thread_id === "thread_client_metadata");
|
||||
assert(metadataThreadEntry?.thread_id === "thread_client_metadata", "client_metadata.thread_id 未写入请求记录");
|
||||
|
||||
const streamDisconnectedRetryResponse = await fetch(`http://127.0.0.1:${gatewayPort}/responses`, {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
|
||||
Reference in New Issue
Block a user