diff --git a/packages/api-client/src/schema.d.ts b/packages/api-client/src/schema.d.ts index f8c4e712..a0cd9f9a 100644 --- a/packages/api-client/src/schema.d.ts +++ b/packages/api-client/src/schema.d.ts @@ -1175,7 +1175,9 @@ export interface paths { }; /** * List runs - * @description Requires the runs:read scope. + * @description Returns tenant-authorized runs. When sort is supplied, ordering is applied before cursor pagination; statuses sort lexically by their persisted state, missing values sort last, and ties use run ID. Without sort, runs remain newest-created first. + * + * Requires the runs:read scope. * * Accepts a scoped bearer token or interactive owner session. */ @@ -4895,6 +4897,8 @@ export interface operations { jobId?: string; state?: "queued" | "starting" | "running" | "done" | "blocked" | "failed" | "ignored" | "succeeded" | "stopping" | "stopped"; contextQuery?: string; + sort?: "run" | "status" | "created" | "agent"; + direction?: "asc" | "desc"; limit?: number; cursor?: string; }; diff --git a/packages/api/src/api-contract.ts b/packages/api/src/api-contract.ts index 6408c3e9..174cf802 100644 --- a/packages/api/src/api-contract.ts +++ b/packages/api/src/api-contract.ts @@ -783,6 +783,7 @@ export const API_ROUTES: RouteContract[] = [ "runs:read", { summary: "List runs", + description: "Returns tenant-authorized runs. When sort is supplied, ordering is applied before cursor pagination; statuses sort lexically by their persisted state, missing values sort last, and ties use run ID. Without sort, runs remain newest-created first.", responses: { "200": { description: "Paginated runs", diff --git a/packages/api/src/flow-schemas.ts b/packages/api/src/flow-schemas.ts index f50f07f7..f5a1aa06 100644 --- a/packages/api/src/flow-schemas.ts +++ b/packages/api/src/flow-schemas.ts @@ -10,8 +10,10 @@ export const matchRuleSchema = z.object({ export const listRunsSchema = z.object({ jobId: z.string().min(1).optional(), state: runStateSchema.optional(), contextQuery: z.string().min(1).max(50_000).optional(), + sort: z.enum(["run", "status", "created", "agent"]).optional(), + direction: z.enum(["asc", "desc"]).optional(), limit: z.coerce.number().int().min(1).max(100).default(50), cursor: z.string().min(1).optional(), -}); +}).refine(value => !value.direction || value.sort, { message: "direction requires sort" }); export const runIdSchema = z.object({ runId: z.string().min(1) }); const webhookCommonSchema = z.object({ conditions: conditionsSchema.optional() }); diff --git a/packages/api/src/postgres/run-query-repository.ts b/packages/api/src/postgres/run-query-repository.ts index f5c6b758..06962107 100644 --- a/packages/api/src/postgres/run-query-repository.ts +++ b/packages/api/src/postgres/run-query-repository.ts @@ -1,22 +1,43 @@ import { traceRevisionSql } from "../run-read-contracts"; import type { Database } from "./database"; -const encodeCursor = (createdAt: Date, id: string) => btoa(JSON.stringify([createdAt.toISOString(), id])).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", ""); -const decodeCursor = (value?: string | null): [string, string] | null => { if (!value) return null; try { const padded = value.replaceAll("-", "+").replaceAll("_", "/") + "===".slice((value.length + 3) % 4), parsed = JSON.parse(atob(padded)); return Array.isArray(parsed) && parsed.length === 2 ? [String(parsed[0]), String(parsed[1])] : null; } catch { return null; } }; +const encodeCursor = (value: unknown[]) => btoa(JSON.stringify(value)).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", ""); +const decodeCursor = (value?: string | null): unknown[] | null => { if (!value) return null; try { const padded = value.replaceAll("-", "+").replaceAll("_", "/") + "===".slice((value.length + 3) % 4), parsed = JSON.parse(atob(padded)); return Array.isArray(parsed) ? parsed : null; } catch { return null; } }; + +const sortExpressions = { + run: "COALESCE(NULLIF(r.run_name, ''), NULLIF(r.issue_title, ''), 'Run')", + status: "r.state", + created: "r.created_at", + agent: "r.agent_kind", +} as const; +type RunSort = keyof typeof sortExpressions; export class RunQueryRepository { constructor(private database: Database, private tenantId: string) { if (!tenantId) throw new Error("tenantId is required"); } async list(query: URLSearchParams) { - const limit = Math.max(1, Math.min(100, Number(query.get("limit") ?? 50))), cursor = decodeCursor(query.get("cursor")), values: unknown[] = [this.tenantId], clauses = ["r.tenant_id=$1"]; + const limit = Math.max(1, Math.min(100, Number(query.get("limit") ?? 50))), cursor = decodeCursor(query.get("cursor")), sortParam = query.get("sort"), sort = sortParam && Object.hasOwn(sortExpressions, sortParam) ? sortParam as RunSort : null, direction = sort ? (query.get("direction") === "desc" ? "DESC" : "ASC") : "DESC", values: unknown[] = [this.tenantId], clauses = ["r.tenant_id=$1"]; if (query.get("jobId")) { values.push(query.get("jobId")); clauses.push(`r.job_id=$${values.length}`); } if (query.get("state")) { values.push(query.get("state") === "done" ? ["done", "succeeded"] : [query.get("state")]); clauses.push(`r.state=ANY($${values.length}::text[])`); } if (query.get("contextQuery")) { values.push(`%${query.get("contextQuery")}%`); clauses.push(`i.context::text ILIKE $${values.length}`); } - if (cursor) { values.push(cursor[0], cursor[1]); clauses.push(`(r.created_at,r.id)<($${values.length - 1}::timestamptz,$${values.length}::uuid)`); } + if (sort && cursor?.length === 5 && cursor[0] === sort && cursor[1] === direction.toLowerCase()) { + const expression = sortExpressions[sort], nullFlag = `(CASE WHEN ${expression} IS NULL THEN 1 ELSE 0 END)`, after = direction === "ASC" ? ">" : "<"; + values.push(Number(cursor[2]), cursor[3] ?? null, cursor[4]); + const valuePlaceholder = sort === "created" ? `$${values.length - 1}::timestamptz` : `$${values.length - 1}`; + clauses.push(`(${nullFlag} > $${values.length - 2} OR (${nullFlag} = $${values.length - 2} AND ((${expression} ${after} ${valuePlaceholder}) OR (${expression} IS NOT DISTINCT FROM ${valuePlaceholder} AND r.id ${after} $${values.length}::uuid))))`); + } else if (!sort && cursor?.length === 2) { + values.push(cursor[0], cursor[1]); clauses.push(`(r.created_at,r.id)<($${values.length - 1}::timestamptz,$${values.length}::uuid)`); + } values.push(limit + 1); + const order = sort ? `CASE WHEN ${sortExpressions[sort]} IS NULL THEN 1 ELSE 0 END ASC, ${sortExpressions[sort]} ${direction} NULLS LAST, r.id ${direction}` : "r.created_at DESC,r.id DESC"; const result = await this.database.pool.query(`SELECT r.id,r.job_id,r.issue_id,r.issue_url,r.issue_title,r.run_name,r.agent_name,r.workspace_name,r.agent_kind,r.state,r.provider,r.execution_backend_kind backend_kind,r.execution_capabilities capabilities,r.destination_url,r.artifact_state,r.artifact_error,r.created_at,r.updated_at,jr.started_at - FROM app.runs r JOIN app.job_runs jr ON jr.tenant_id=r.tenant_id AND jr.id=r.id JOIN app.invocations i ON i.tenant_id=r.tenant_id AND i.id=r.invocation_id WHERE ${clauses.join(" AND ")} ORDER BY r.created_at DESC,r.id DESC LIMIT $${values.length}`, values); + FROM app.runs r JOIN app.job_runs jr ON jr.tenant_id=r.tenant_id AND jr.id=r.id JOIN app.invocations i ON i.tenant_id=r.tenant_id AND i.id=r.invocation_id WHERE ${clauses.join(" AND ")} ORDER BY ${order} LIMIT $${values.length}`, values); const rows = result.rows.slice(0, limit), hasMore = result.rows.length > limit; - return { items: rows, nextCursor: hasMore && rows.length ? encodeCursor(rows.at(-1).created_at, rows.at(-1).id) : null }; + const last = rows.at(-1); + const nextCursor = hasMore && last ? sort ? (() => { + const value = sort === "run" ? (last.run_name || last.issue_title || "Run") : last[sort === "status" ? "state" : sort === "created" ? "created_at" : "agent_kind"]; + return encodeCursor([sort, direction.toLowerCase(), sort === "run" || value != null ? 0 : 1, value, last.id]); + })() : encodeCursor([last.created_at, last.id]) : null; + return { items: rows, nextCursor }; } async get(runId: string) { return (await this.database.pool.query(`SELECT r.*,j.name job_name,jr.started_at,jr.encrypted_prompt,i.source invocation_source,i.claim_key invocation_claim_key,i.trigger_id invocation_trigger_id,i.context,i.occurrence,i.created_at invocation_created_at diff --git a/packages/api/src/protected-api.ts b/packages/api/src/protected-api.ts index a2c4dd50..ca2e7cda 100644 --- a/packages/api/src/protected-api.ts +++ b/packages/api/src/protected-api.ts @@ -99,7 +99,7 @@ function createMcpServer(service: ApiService): McpServer { }); tool("list_exe_connections", "List safe metadata for saved exe.dev connections. API tokens are never returned.", z.object({}), () => service.listExeConnections()); tool("list_github_installations", "List connected GitHub App installations, including the installation IDs needed by GitHub Job triggers. Credentials are never returned.", z.object({}), () => service.listGitHubInstallations()); - tool("list_runs", "List authoritative job runs by job ID, state, and an optional case-insensitive literal substring of triggered context. Automatic webhook, schedule, and lifecycle signals coalesce, so query runs and the provider API for authoritative work. Context matches include only a bounded excerpt.", listRunsSchema, (input: any) => service.listRuns(queryOf(input))); + tool("list_runs", "List authoritative job runs by job ID, state, an optional case-insensitive literal substring of triggered context, and validated sort field/direction. Sorting is applied before cursor pagination with deterministic ID tie-breaking. Automatic webhook, schedule, and lifecycle signals coalesce, so query runs and the provider API for authoritative work. Context matches include only a bounded excerpt.", listRunsSchema, (input: any) => service.listRuns(queryOf(input))); tool("get_run", "Get a run with its rendered prompt, full triggered context, invocation metadata, execution metadata, output, and activity. For manual invocations, invocation.idempotency_key is the client-reusable value; invocation.claim_key is internal.", runIdSchema, ({ runId }: any) => service.getRun(runId)); tool("get_run_diagnostics", "Get credential-safe launch, prompt delivery, output capture, claim release, cleanup, and activity diagnostics for a run.", runIdSchema, ({ runId }: any) => service.getRunDiagnostics(runId)); tool("stop_run", "Stop an active run", runIdSchema, ({ runId }: any) => service.stopRun(runId)); diff --git a/packages/api/test/api-boundary.test.ts b/packages/api/test/api-boundary.test.ts index 4dd0e096..e4fee333 100644 --- a/packages/api/test/api-boundary.test.ts +++ b/packages/api/test/api-boundary.test.ts @@ -291,13 +291,15 @@ describe("Worker OpenAPI request/response boundaries", () => { .spyOn(ApiService.prototype, "listRuns") .mockResolvedValue({ items: [], nextCursor: null }); await assertResponse( - await request("GET", "/api/v1/runs?limit=100"), + await request("GET", "/api/v1/runs?limit=100&sort=agent&direction=desc"), "GET", "/api/v1/runs", 200, ); expect(list.mock.calls[0][0].get("limit")).toBe("100"); - for (const query of ["limit=0", "limit=101", "limit=NaN", "state=invalid"]) + expect(list.mock.calls[0][0].get("sort")).toBe("agent"); + expect(list.mock.calls[0][0].get("direction")).toBe("desc"); + for (const query of ["limit=0", "limit=101", "limit=NaN", "state=invalid", "sort=invalid", "direction=asc"]) await assertResponse( await request("GET", "/api/v1/runs?" + query), "GET", diff --git a/packages/api/test/api-contract.test.ts b/packages/api/test/api-contract.test.ts index 9e0080b3..76040215 100644 --- a/packages/api/test/api-contract.test.ts +++ b/packages/api/test/api-contract.test.ts @@ -8,6 +8,7 @@ import { isDeclaredApiOperation, matchApiOperation, } from "../src/api-contract"; +import { listRunsSchema } from "../src/flow-schemas"; export const openapi = parse( readFileSync(new URL("../../docs/openapi.yaml", import.meta.url), "utf8"), @@ -24,6 +25,11 @@ const methods = new Set([ ]); describe("versioned API contract", () => { + it("validates run sorting fields and directions", () => { + expect(listRunsSchema.safeParse({ sort: "agent", direction: "desc" }).success).toBe(true); + expect(listRunsSchema.safeParse({ sort: "not-a-column" }).success).toBe(false); + expect(listRunsSchema.safeParse({ direction: "asc" }).success).toBe(false); + }); it("has full bidirectional method/path equality with the executable catalog", () => { const documented = Object.entries(openapi.paths).flatMap(([path, item]) => Object.keys(item as object) diff --git a/packages/api/test/postgres-run-query-repository.test.ts b/packages/api/test/postgres-run-query-repository.test.ts index 000bfe8d..7f0d7e0a 100644 --- a/packages/api/test/postgres-run-query-repository.test.ts +++ b/packages/api/test/postgres-run-query-repository.test.ts @@ -13,4 +13,34 @@ describe("run timing queries", () => { expect(sql).toContain("jr.tenant_id=r.tenant_id AND jr.id=r.id"); } }); + + it.each([ + ["run", "asc", "COALESCE(NULLIF(r.run_name, ''), NULLIF(r.issue_title, ''), 'Run') ASC"], + ["run", "desc", "COALESCE(NULLIF(r.run_name, ''), NULLIF(r.issue_title, ''), 'Run') DESC"], + ["status", "asc", "r.state ASC"], + ["status", "desc", "r.state DESC"], + ["created", "asc", "r.created_at ASC"], + ["created", "desc", "r.created_at DESC"], + ["agent", "asc", "r.agent_kind ASC"], + ["agent", "desc", "r.agent_kind DESC"], + ] as const)("sorts %s %s before pagination with ID tie-breaking", async (sort, direction, ordering) => { + const rows = [{ id: "00000000-0000-4000-8000-000000000001", run_name: "Alpha", issue_title: "", state: "failed", agent_kind: "codex", created_at: new Date("2026-09-18T12:00:00Z") }, { id: "00000000-0000-4000-8000-000000000002", run_name: "Beta", issue_title: "", state: "succeeded", agent_kind: "claude", created_at: new Date("2026-09-18T12:01:00Z") }]; + const query = vi.fn(async () => ({ rows })); + const result = await new RunQueryRepository({ pool: { query } } as any, "tenant").list(new URLSearchParams({ sort, direction, limit: "1" })); + const [sql, values] = query.mock.calls[0] as unknown as [string, unknown[]]; + expect(sql).toContain(`ORDER BY CASE WHEN`); + expect(sql).toContain(ordering); + expect(sql).toContain("r.id"); + expect(values).toEqual(["tenant", 2]); + expect(result.nextCursor).toBeTruthy(); + }); + + it("uses a sort-aware cursor so the next page cannot restart or cross sort orders", async () => { + const query = vi.fn(async () => ({ rows: [{ id: "00000000-0000-4000-8000-000000000002", run_name: "Beta", issue_title: "", state: "succeeded", agent_kind: "codex", created_at: new Date("2026-09-18T12:01:00Z") }] })); + const cursor = btoa(JSON.stringify(["run", "asc", 0, "Alpha", "00000000-0000-4000-8000-000000000001"])); + await new RunQueryRepository({ pool: { query } } as any, "tenant").list(new URLSearchParams({ sort: "run", direction: "asc", cursor })); + const [sql, values] = query.mock.calls[0] as unknown as [string, unknown[]]; + expect(sql).toContain("IS NOT DISTINCT FROM"); + expect(values).toEqual(["tenant", 0, "Alpha", "00000000-0000-4000-8000-000000000001", 51]); + }); }); diff --git a/packages/app/src/features/jobs/routes.tsx b/packages/app/src/features/jobs/routes.tsx index 7ba24a68..12ef40ce 100644 --- a/packages/app/src/features/jobs/routes.tsx +++ b/packages/app/src/features/jobs/routes.tsx @@ -13,7 +13,7 @@ export function jobsRoutes(root: AnyRootRoute) { component: lazyRouteComponent(() => import("./list"), "JobsList"), }); const job = createRoute({ getParentRoute: () => root, path: "/jobs/$jobId", beforeLoad: guard, - validateSearch: (s: Record) => ({ cursor: typeof s.cursor === "string" ? s.cursor : undefined, previous: typeof s.previous === "string" ? s.previous.slice(0, 20_000) : undefined }), + validateSearch: (s: Record) => ({ cursor: typeof s.cursor === "string" ? s.cursor : undefined, previous: typeof s.previous === "string" ? s.previous.slice(0, 20_000) : undefined, sort: ["run", "status", "created", "agent"].includes(String(s.sort)) ? s.sort as "run" | "status" | "created" | "agent" : undefined, direction: s.direction === "asc" || s.direction === "desc" ? s.direction : undefined }), loader: ({ params }) => queryClient.ensureQueryData(jobQuery(params.jobId)), component: lazyRouteComponent(() => import("./detail"), "JobDetail"), }); diff --git a/packages/app/src/features/runs/history.tsx b/packages/app/src/features/runs/history.tsx index 449904e5..30e894f3 100644 --- a/packages/app/src/features/runs/history.tsx +++ b/packages/app/src/features/runs/history.tsx @@ -1,18 +1,26 @@ import { Badge, Button, buttonClasses } from "../../shared/ui"; -import { Link, useSearch } from "@tanstack/react-router"; +import { Link, useNavigate, useSearch } from "@tanstack/react-router"; import { useQuery } from "@tanstack/react-query"; import { historyQuery } from "./queries"; -export type HistorySearch = { cursor?: string; previous?: string }; +export type HistorySort = "run" | "status" | "created" | "agent"; +export type HistorySearch = { cursor?: string; previous?: string; sort?: HistorySort; direction?: "asc" | "desc" }; export function RunHistory({ jobId }: { jobId: string }) { const search = useSearch({ strict: false }) as HistorySearch; - const runs = useQuery(historyQuery(jobId, search.cursor)); + const navigate = useNavigate(); + const runs = useQuery(historyQuery(jobId, search.cursor, search.sort, search.direction)); const previous = search.previous === undefined ? [] : search.previous.split(","); const pageClasses = `inline-flex min-h-10 items-center rounded-lg border px-3 py-2 text-sm font-semibold ${buttonClasses.secondary}`; + const columns: Array<[HistorySort, string]> = [["run", "Run"], ["status", "Status"], ["created", "Created"], ["agent", "Agent"]]; + const sortColumn = (column: HistorySort) => { + const direction = search.sort === column && search.direction === "asc" ? "desc" : "asc"; + void navigate({ to: "/jobs/$jobId", params: { jobId }, search: { sort: column, direction, cursor: undefined, previous: undefined } }); + }; + const sortLabel = (column: HistorySort) => search.sort === column ? (search.direction === "desc" ? "sorted descending" : "sorted ascending") : "not sorted"; return
{runs.isPending &&

Loading run history…

}{runs.error &&

{runs.error.message}

} {runs.data && <>
- - +
Job runs, newest first
RunStatusCreatedAgent
+ {columns.map(([column, label]) => )}{runs.data.items.map(run => @@ -21,9 +29,9 @@ export function RunHistory({ jobId }: { jobId: string }) {
Job runs{search.sort ? "" : ", newest first"}
{run.run_name || run.issue_title || "Run"} {run.state}
}
; } diff --git a/packages/app/src/features/runs/queries.ts b/packages/app/src/features/runs/queries.ts index ed2a761b..03df1b5b 100644 --- a/packages/app/src/features/runs/queries.ts +++ b/packages/app/src/features/runs/queries.ts @@ -18,4 +18,4 @@ export const runTraceQuery = (runId: string, revision: string, after: number, po }); export const runDetailQuery = (runId: string) => queryOptions({ queryKey: ["runs", runId, "detail"], queryFn: async ({ signal }) => { const { data, error } = await api.GET("/api/v1/runs/{runId}", { signal, params: { path: { runId } } }); if (!data || error) throw new Error(messageOf(error)); return data; }, staleTime: 60_000 }); export const diagnosticsQuery = (runId: string) => queryOptions({ queryKey: ["runs", runId, "diagnostics"], queryFn: async ({ signal }) => { const { data, error } = await api.GET("/api/v1/runs/{runId}/diagnostics", { signal, params: { path: { runId } } }); if (!data || error) throw new Error(messageOf(error)); return data; }, staleTime: 30_000 }); -export const historyQuery = (jobId: string, cursor?: string, state?: "queued" | "starting" | "running" | "blocked" | "stopping" | "succeeded" | "failed" | "stopped", contextQuery?: string) => queryOptions({ queryKey: ["runs", "history", jobId, cursor, state, contextQuery], queryFn: async ({ signal }) => { const { data, error } = await api.GET("/api/v1/runs", { signal, params: { query: { jobId, cursor, state, contextQuery: contextQuery || undefined, limit: 30 } } }); if (!data || error) throw new Error(messageOf(error)); return data; }, staleTime: 10_000 }); +export const historyQuery = (jobId: string, cursor?: string, sort?: "run" | "status" | "created" | "agent", direction?: "asc" | "desc") => queryOptions({ queryKey: ["runs", "history", jobId, cursor, sort, direction], queryFn: async ({ signal }) => { const { data, error } = await api.GET("/api/v1/runs", { signal, params: { query: { jobId, cursor, sort, direction: direction ?? (sort ? "asc" : undefined), limit: 30 } } }); if (!data || error) throw new Error(messageOf(error)); return data; }, staleTime: 10_000 }); diff --git a/packages/app/test/jobs.browser.test.mjs b/packages/app/test/jobs.browser.test.mjs index a760ab27..9ddebb1a 100644 --- a/packages/app/test/jobs.browser.test.mjs +++ b/packages/app/test/jobs.browser.test.mjs @@ -174,6 +174,23 @@ test("job Runs tab paginates distinct records, supports refresh/back and keeps c await context.close(); }); +test("run table headers sort every column accessibly and persist in the URL", async () => { + const { page, context } = await contextFor(); + await page.route(`**/api/v1/jobs/${jobId}`, route => route.fulfill({ json: { ...summary, promptTemplate: "Template", executionTargetId: "local", triggers: [] } })); + const requests = []; + await page.route("**/api/v1/runs?**", route => { const url = new URL(route.request().url()); requests.push(url); return route.fulfill({ json: { items: [{ id: runId, run_name: "Run", issue_title: "", state: "succeeded", created_at: summary.createdAt, agent_kind: "codex" }], nextCursor: null } }); }); + await page.goto(origin + `/jobs/${jobId}`); + const table = page.getByRole("table"); + await table.getByRole("columnheader").nth(0).getByRole("button").waitFor(); + for (const index of [0, 1, 2, 3]) assert.equal(await table.getByRole("columnheader").nth(index).getByRole("button").count(), 1); + const runHeader = table.getByRole("button", { name: /Run, not sorted/ }); + await runHeader.focus(); await page.keyboard.press("Enter"); await page.waitForURL(`**/jobs/${jobId}?sort=run&direction=asc`); + assert.equal(await table.getByRole("columnheader", { name: /Run/ }).getAttribute("aria-sort"), "ascending"); + await table.getByRole("button", { name: /Run, sorted ascending/ }).click(); await page.waitForURL(`**/jobs/${jobId}?sort=run&direction=desc`); + assert.equal(requests.at(-1).searchParams.get("direction"), "desc"); + await context.close(); +}); + test("job with no runs has an empty table and disabled pagination", async () => { const { page, context } = await contextFor(); await page.route(`**/api/v1/jobs/${jobId}`, route => route.fulfill({ json: { ...summary, promptTemplate: "Template", executionTargetId: "local", triggers: [] } })); diff --git a/packages/app/test/visual/baselines/job-dark-1280.png b/packages/app/test/visual/baselines/job-dark-1280.png index 512e7c49..7b212175 100644 Binary files a/packages/app/test/visual/baselines/job-dark-1280.png and b/packages/app/test/visual/baselines/job-dark-1280.png differ diff --git a/packages/app/test/visual/baselines/job-dark-390.png b/packages/app/test/visual/baselines/job-dark-390.png index dabfbbcd..53b524a0 100644 Binary files a/packages/app/test/visual/baselines/job-dark-390.png and b/packages/app/test/visual/baselines/job-dark-390.png differ diff --git a/packages/app/test/visual/baselines/job-light-1280.png b/packages/app/test/visual/baselines/job-light-1280.png index d0f3d323..9d097f7d 100644 Binary files a/packages/app/test/visual/baselines/job-light-1280.png and b/packages/app/test/visual/baselines/job-light-1280.png differ diff --git a/packages/app/test/visual/baselines/job-light-390.png b/packages/app/test/visual/baselines/job-light-390.png index eaabc078..8e6b13bc 100644 Binary files a/packages/app/test/visual/baselines/job-light-390.png and b/packages/app/test/visual/baselines/job-light-390.png differ diff --git a/packages/app/test/visual/baselines/long-job-mobile.png b/packages/app/test/visual/baselines/long-job-mobile.png index d362e4b2..00f41752 100644 Binary files a/packages/app/test/visual/baselines/long-job-mobile.png and b/packages/app/test/visual/baselines/long-job-mobile.png differ diff --git a/packages/docs/openapi.yaml b/packages/docs/openapi.yaml index 56ca36f1..ba6b2fb8 100644 --- a/packages/docs/openapi.yaml +++ b/packages/docs/openapi.yaml @@ -7342,6 +7342,12 @@ paths: /api/v1/runs: get: summary: List runs + description: |- + Returns tenant-authorized runs. When sort is supplied, ordering is applied before cursor pagination; statuses sort lexically by their persisted state, missing values sort last, and ties use run ID. Without sort, runs remain newest-created first. + + Requires the runs:read scope. + + Accepts a scoped bearer token or interactive owner session. responses: "200": description: Paginated runs @@ -7365,10 +7371,6 @@ paths: $ref: "#/components/responses/Error500" "503": $ref: "#/components/responses/Error503" - description: |- - Requires the runs:read scope. - - Accepts a scoped bearer token or interactive owner session. operationId: get_api_v1_runs tags: - runs @@ -7407,6 +7409,24 @@ paths: type: string minLength: 1 maxLength: 50000 + - name: sort + in: query + required: false + schema: + type: string + enum: + - run + - status + - created + - agent + - name: direction + in: query + required: false + schema: + type: string + enum: + - asc + - desc - name: limit in: query required: false