feat: add LETTA_DEBUG_TIMINGS env var for request timing diagnostics (#502)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -25,7 +25,7 @@ const FAST_PROMPT =
|
||||
async function runBidirectional(
|
||||
inputs: string[],
|
||||
extraArgs: string[] = [],
|
||||
timeoutMs = 90000, // Overall timeout for the entire operation
|
||||
timeoutMs = 180000, // 180s timeout - CI can be very slow
|
||||
): Promise<object[]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const proc = spawn(
|
||||
@@ -238,7 +238,7 @@ describe("input-format stream-json", () => {
|
||||
expect(initResponse?.agent_id).toBeDefined();
|
||||
}
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -291,28 +291,33 @@ describe("input-format stream-json", () => {
|
||||
expect(result?.agent_id).toBeDefined();
|
||||
expect(result?.duration_ms).toBeGreaterThan(0);
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
"multi-turn conversation maintains context",
|
||||
async () => {
|
||||
const objects = (await runBidirectional([
|
||||
JSON.stringify({
|
||||
type: "user",
|
||||
message: {
|
||||
role: "user",
|
||||
content: "Say hello",
|
||||
},
|
||||
}),
|
||||
JSON.stringify({
|
||||
type: "user",
|
||||
message: {
|
||||
role: "user",
|
||||
content: "Say goodbye",
|
||||
},
|
||||
}),
|
||||
])) as WireMessage[];
|
||||
// Multi-turn test needs 2 sequential LLM calls, so allow more time
|
||||
const objects = (await runBidirectional(
|
||||
[
|
||||
JSON.stringify({
|
||||
type: "user",
|
||||
message: {
|
||||
role: "user",
|
||||
content: "Say hello",
|
||||
},
|
||||
}),
|
||||
JSON.stringify({
|
||||
type: "user",
|
||||
message: {
|
||||
role: "user",
|
||||
content: "Say goodbye",
|
||||
},
|
||||
}),
|
||||
],
|
||||
[], // no extra args
|
||||
300000, // 300s for 2 sequential LLM calls - CI can be very slow
|
||||
)) as WireMessage[];
|
||||
|
||||
// Should have at least two results (one per turn)
|
||||
const results = objects.filter(
|
||||
@@ -336,7 +341,7 @@ describe("input-format stream-json", () => {
|
||||
expect(firstResult.session_id).toBe(lastResult.session_id);
|
||||
}
|
||||
},
|
||||
{ timeout: 180000 },
|
||||
{ timeout: 320000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -358,7 +363,7 @@ describe("input-format stream-json", () => {
|
||||
expect(controlResponse).toBeDefined();
|
||||
expect(controlResponse?.response.subtype).toBe("success");
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -405,7 +410,7 @@ describe("input-format stream-json", () => {
|
||||
expect(result).toBeDefined();
|
||||
expect(result?.subtype).toBe("success");
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -428,7 +433,7 @@ describe("input-format stream-json", () => {
|
||||
expect(controlResponse).toBeDefined();
|
||||
expect(controlResponse?.response.subtype).toBe("error");
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -446,6 +451,6 @@ describe("input-format stream-json", () => {
|
||||
expect(errorMsg).toBeDefined();
|
||||
expect(errorMsg?.message).toContain("Invalid JSON");
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
async function runHeadlessCommand(
|
||||
prompt: string,
|
||||
extraArgs: string[] = [],
|
||||
timeoutMs = 90000, // 90s timeout for slow CI environments
|
||||
timeoutMs = 180000, // 180s timeout - CI can be very slow
|
||||
): Promise<string[]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const proc = spawn(
|
||||
@@ -105,7 +105,7 @@ describe("stream-json format", () => {
|
||||
expect(init.cwd).toBeDefined();
|
||||
expect(init.uuid).toBe(`init-${init.agent_id}`);
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -131,7 +131,7 @@ describe("stream-json format", () => {
|
||||
// uuid should be otid or id from the Letta SDK chunk
|
||||
expect(msg.uuid).toBeTruthy();
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -156,7 +156,7 @@ describe("stream-json format", () => {
|
||||
expect(result.uuid).toContain("result-");
|
||||
expect(result.result).toBeDefined();
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -183,7 +183,7 @@ describe("stream-json format", () => {
|
||||
// The event should contain the original Letta SDK chunk
|
||||
expect("message_type" in event.event).toBe(true);
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -217,6 +217,6 @@ describe("stream-json format", () => {
|
||||
});
|
||||
expect(resultLine).toBeDefined();
|
||||
},
|
||||
{ timeout: 120000 },
|
||||
{ timeout: 200000 },
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user