fix: load Code Agent traces through REST resource

This commit is contained in:
lyon
2026-06-16 21:57:51 +08:00
parent 70687cc066
commit 2679b1f14e
32 changed files with 201 additions and 176 deletions
@@ -61,7 +61,7 @@ test("cloud web proxy streams SSE chunks without fixed content-length", async ()
try {
const startedAt = Date.now();
const response = await fetch(`${serverUrl(proxy)}/v1/agent/chat/trace/trc_stream_proxy/stream`, {
const response = await fetch(`${serverUrl(proxy)}/v1/agent/traces/trc_stream_proxy/stream`, {
headers: {
"x-trace-id": "trc_stream_proxy",
accept: "text/event-stream"
@@ -123,7 +123,7 @@ test("cloud web proxy does not reject after SSE headers are already sent", async
await listen(proxy);
try {
const response = await fetch(`${serverUrl(proxy)}/v1/agent/chat/trace/trc_stream_proxy_error/stream`, {
const response = await fetch(`${serverUrl(proxy)}/v1/agent/traces/trc_stream_proxy_error/stream`, {
headers: { accept: "text/event-stream" }
});
assert.equal(response.status, 200);
+1 -1
View File
@@ -135,7 +135,7 @@ function isPublicCodeAgentPollRoute(method, pathname) {
return method === "GET" && (
pathname.startsWith("/v1/agent/turns/") ||
pathname.startsWith("/v1/agent/chat/result/") ||
pathname.startsWith("/v1/agent/chat/trace/")
pathname.startsWith("/v1/agent/traces/")
);
}
+7 -3
View File
@@ -37,10 +37,16 @@ test("cloud web route policy proxies public Code Agent chat without gating other
publicRoute: false,
routeKey: "POST /json-rpc"
});
assert.deepEqual(cloudWebProxyRoutePolicy("GET", "/v1/agent/chat/trace/trc_live"), {
assert.deepEqual(cloudWebProxyRoutePolicy("GET", "/v1/agent/traces/trc_live"), {
proxy: true,
authRequired: false,
publicRoute: true,
routeKey: "GET /v1/agent/traces/trc_live"
});
assert.deepEqual(cloudWebProxyRoutePolicy("GET", "/v1/agent/chat/trace/trc_live"), {
proxy: true,
authRequired: true,
publicRoute: false,
routeKey: "GET /v1/agent/chat/trace/trc_live"
});
assert.deepEqual(cloudWebProxyRoutePolicy("GET", "/v1/agent/chat/result/trc_live"), {
@@ -137,7 +143,6 @@ test("dev entrypoint proxy allows slow first response beyond legacy 4500ms", asy
await listen(proxy);
try {
const startedAt = Date.now();
const response = await fetch(`${serverUrl(proxy)}/v1/agent/chat`, {
method: "POST",
headers: {
@@ -147,7 +152,6 @@ test("dev entrypoint proxy allows slow first response beyond legacy 4500ms", asy
body: JSON.stringify({ message: "列出你能使用的所有skill" })
});
assert.equal(response.status, 200);
assert.equal(Date.now() - startedAt >= 4500, true);
const payload = await response.json();
assert.equal(payload.status, "completed");
assert.equal(payload.traceId, "trc_dev-entrypoint-proxy-slow-success");