Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions e2e/perstack-cli/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,30 @@ describe.concurrent("CLI Options", () => {

describe.concurrent("CLI Options - Filter", () => {
/** Verifies --filter option with single type.
* Retries up to 3 times because --filter completeRun only outputs the final
* event; when the LLM call errors the runtime emits stopRunByError (blocked
* by the filter) and exits 0 with zero events.
* Uses startRun (emitted before LLM calls) to avoid flakiness from LLM
* errors that produce stopRunByError instead of completeRun.
*/
it(
"should filter events to only completeRun",
"should filter events to only startRun",
async () => {
const args = [
"run",
"--config",
GLOBAL_RUNTIME_CONFIG,
"--filter",
"completeRun",
"e2e-global-runtime",
"Say hello",
]
let result = withEventParsing(await runCli(args, { timeout: LLM_TIMEOUT }))
for (
let attempt = 1;
attempt < 3 && result.exitCode === 0 && result.events.length === 0;
attempt++
) {
result = withEventParsing(await runCli(args, { timeout: LLM_TIMEOUT }))
}
const cmdResult = await runCli(
[
"run",
"--config",
GLOBAL_RUNTIME_CONFIG,
"--filter",
"startRun",
"e2e-global-runtime",
"Say hello",
],
{ timeout: LLM_TIMEOUT },
)
const result = withEventParsing(cmdResult)
expect(result.exitCode).toBe(0)

// All events should be completeRun
// All events should be startRun
const eventTypes = result.events.map((e) => e.type)
expect(eventTypes.every((t) => t === "completeRun")).toBe(true)
expect(eventTypes.every((t) => t === "startRun")).toBe(true)
expect(eventTypes.length).toBeGreaterThan(0)
},
LLM_TIMEOUT,
Expand Down