Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

jobs: cap remote list_jobs at 500 rows per call and page it with next_cursor

garrytane46f7be2b915
diff --git a/src/commands/jobs/list.ts b/src/commands/jobs/list.ts
index c400a8bac7..542cdd14bb 100644
--- a/src/commands/jobs/list.ts
+++ b/src/commands/jobs/list.ts
@@ -22,10 +22,7 @@ export async function runJobsList({ args, queue, engine }: JobsCommandContext):
const cfg = loadConfig();
let jobs: MinionJob[];
if (isThinClient(cfg)) {
- const raw = await callRemoteTool(cfg!, 'list_jobs', {
- status, queue: queueName, limit,
- }, { timeoutMs: 30_000 });
- jobs = unpackToolResult<MinionJob[]>(raw).map((j) => rehydrateJobDates(j));
+ jobs = await listRemoteJobs(cfg!, { status, queue: queueName, limit });
} else {
try { await queue.ensureSchema(); }
catch (e) { console.error(e instanceof Error ? e.message : String(e)); process.exit(1); }
@@ -54,6 +51,22 @@ export async function runJobsList({ args, queue, engine }: JobsCommandContext):
console.log(`\n ${jobs.length} jobs shown`);
}
+/**
+ * The host returns at most one page per call (500 jobs over MCP); follow next_cursor, carried on the last job of a
+ * cut page, until the requested limit is met. A host without paging returns one page and no cursor.
+ */
+async function listRemoteJobs(cfg: NonNullable<ReturnType<typeof loadConfig>>, opts: { status?: string; queue?: string; limit: number }): Promise<MinionJob[]> {
+ const jobs: MinionJob[] = [];
+ let cursor: string | undefined;
+ do {
+ const raw = await callRemoteTool(cfg, 'list_jobs', { ...opts, limit: opts.limit - jobs.length, ...(cursor ? { cursor } : {}) }, { timeoutMs: 30_000 });
+ const page = unpackToolResult<Array<MinionJob & { truncated?: boolean; next_cursor?: string }>>(raw);
+ cursor = page[page.length - 1]?.next_cursor;
+ for (const { truncated: _t, next_cursor: _c, ...job } of page) jobs.push(rehydrateJobDates(job as MinionJob));
+ } while (cursor && jobs.length < opts.limit);
+ return jobs;
+}
+
/**
* `jobs list --finished-since <iso|cursor>` (#7242): every job that reached a terminal status after the cursor, oldest
* first, as one `{jobs, next_cursor}` document; pass next_cursor back to read the next events.
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index 2a5325aca3..66eed411b1 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -1177,6 +1177,8 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;
{ since: '0.60.401.0', text: '`gbrain sources reconcile --apply` that commits and leaves the page and its canonical file agreeing now clears that file\'s `preparation_stalled` or `write_interrupted` sync hold (the write owner stalled, not the file), and its result names the cleared row (`cleared_hold`); a file that still differs keeps its hold. A page write refused for a held file now names the hold row it read in its message (`Hold row: source <id>, incarnation <uuid>.`), and `gbrain sources retry-held --json` reports the rows it read (`hold_rows`) and each held file\'s `fingerprint`, so a refusal naming a row the listing does not show can be told apart (#7364).' },
// #7341 (GBRA-133 wave 3). `since` is restamped at the merge slot.
{ since: '0.60.401.0', text: 'A nested folder-scaffolding file (`index.md`, `README.md`, `log.md`, `schema.md`, `RESOLVER.md`) whose frontmatter `slug:` names another page, for example `slug: projects/acme-example` or just `slug: acme-example` in `projects/acme-example/index.md`, is skipped by sync again, as before 0.60.337.0, even when it has `type:` or `title:`. Since then it was imported only to be held `frontmatter_slug_conflict`, so a folder of such hubs became one hold per file. The next sync releases those holds. One whose `slug:` is its own path slug, or that has none, is still a page; remove the `slug:` line to make a skipped one a page.' },
+ // list_jobs row bound (GBRA-133 wave 4).
+ { since: 'TBD', text: 'A remote `list_jobs` call (an MCP client, or `gbrain jobs list` on a thin client) now returns at most 500 jobs whatever limit it names, so one call can no longer load the whole job table on a serve and run it out of memory. When more jobs match, the last job carries `truncated: true` and `next_cursor`; pass `cursor` to read the next older jobs. `gbrain jobs list --limit N` on a thin client follows the cursor itself. A `limit` that is not a positive integer is now `invalid_params` instead of falling back to 50. The trusted local CLI keeps any limit.' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */
diff --git a/src/core/minions/job-list-page.ts b/src/core/minions/job-list-page.ts
new file mode 100644
index 0000000000..eadfe719ce
--- /dev/null
+++ b/src/core/minions/job-list-page.ts
@@ -0,0 +1,46 @@
+/**
+ * list_jobs paging: one page of jobs, newest first, ordered on (created_at, id) at microsecond precision so a
+ * page boundary never repeats or skips a row. One extra row is read to know whether more remain; next_cursor
+ * resumes after the last row returned. The per-call cap for remote callers lives in ops/read-paging.ts.
+ */
+import type { BrainEngine } from '../engine.ts';
+import { rowToMinionJob, type MinionJob } from './types.ts';
+
+export class JobListCursorError extends Error {
+ constructor(message: string) { super(message); this.name = 'JobListCursorError'; }
+}
+
+const CREATED_US = '(EXTRACT(EPOCH FROM created_at) * 1000000)::bigint';
+
+/** `<created_at epoch microseconds>:<job id>`, the next_cursor of the previous page. */
+export function parseJobListCursor(raw: string): { micros: string; id: number } {
+ const m = /^(\d{1,19}):(\d{1,15})$/.exec(raw.trim());
+ if (!m || !Number.isSafeInteger(Number(m[2]))) throw new JobListCursorError('cursor must be the next_cursor value of the previous page (<micros>:<id>).');
+ return { micros: m[1], id: Number(m[2]) };
+}
+
+export async function listJobPage(engine: BrainEngine, opts: {
+ status?: string; queue?: string; name?: string; ownerClientId?: string; limit: number; cursor?: string;
+}): Promise<{ jobs: MinionJob[]; next_cursor?: string }> {
+ const params: unknown[] = [];
+ const where: string[] = [];
+ if (opts.cursor !== undefined) {
+ const cursor = parseJobListCursor(opts.cursor);
+ params.push(cursor.micros, cursor.id);
+ where.push(`(${CREATED_US}, id) < ($1::bigint, $2::bigint)`);
+ }
+ if (opts.status) { params.push(opts.status); where.push(`status = $${params.length}`); }
+ if (opts.queue) { params.push(opts.queue); where.push(`queue = $${params.length}`); }
+ if (opts.name) { params.push(opts.name); where.push(`name = $${params.length}`); }
+ if (opts.ownerClientId) { params.push(opts.ownerClientId); where.push(`data->>'__owner_client_id' = $${params.length}`); }
+ params.push(opts.limit + 1);
+ const rows = await engine.executeRaw<Record<string, unknown> & { created_us: string | number }>(
+ `SELECT *, ${CREATED_US}::text AS created_us FROM minion_jobs ${where.length ? `WHERE ${where.join(' AND ')}` : ''}
+ ORDER BY created_at DESC, id DESC LIMIT $${params.length}`, params);
+ const page = rows.slice(0, opts.limit);
+ const last = page[page.length - 1];
+ return {
+ jobs: page.map(rowToMinionJob),
+ ...(rows.length > opts.limit && last ? { next_cursor: `${last.created_us}:${Number(last.id)}` } : {}),
+ };
+}
diff --git a/src/core/ops/jobs.ts b/src/core/ops/jobs.ts
index 53bf17d17e..37b009e7fb 100644
--- a/src/core/ops/jobs.ts
+++ b/src/core/ops/jobs.ts
@@ -52,6 +52,7 @@ import { opError, type OperationError } from './contract.ts';
import type { Action } from '../agent-output.ts';
import { hostFix, invalidParam, readFix, scopeDeniedError } from './op-fix.ts';
import { hasScope } from '../scope.ts';
+import { LIST_JOBS_DEFAULT_LIMIT, LIST_JOBS_REMOTE_MAX_LIMIT, pagingLimit, reportJobPage } from './read-paging.ts';
import { SOURCE_ID_RE } from '../source-id.ts';
import {
assertEmbedBackfillQueueAdmission,
@@ -679,7 +680,8 @@ const list_jobs: Operation = {
status: { type: 'string', description: 'Filter by status (waiting, active, completed, failed, delayed, dead, cancelled)' },
queue: { type: 'string', description: 'Filter by queue name' },
name: { type: 'string', description: 'Filter by job type' },
- limit: { type: 'number', description: 'Max results (default: 50)' },
+ limit: { type: 'number', description: `Max results (default ${LIST_JOBS_DEFAULT_LIMIT}); MCP callers are capped at ${LIST_JOBS_REMOTE_MAX_LIMIT} per call.` },
+ cursor: { type: 'string', description: 'next_cursor from the last job of the previous page (it carries truncated: true): returns the next older jobs.' },
fields: { type: 'array', items: { type: 'string' }, description: 'Return only these job fields (e.g. ["id","name","status"]) to save tokens; omit for every field.' },
finished_since: { type: 'string', description: 'Terminal-event cursor: an ISO time or the next_cursor of the previous call. Returns {jobs, next_cursor}: jobs that finished after it, oldest first.' },
},
@@ -705,19 +707,26 @@ const list_jobs: Operation = {
throw e;
}
}
- const { MinionQueue } = await import('../minions/queue.ts');
- const queue = new MinionQueue(ctx.engine);
- const jobs = await queue.getJobs({
- status: p.status as string | undefined,
- queue: p.queue as string | undefined,
- name: p.name as string | undefined,
- limit: (p.limit as number) || 50,
- // #4098: SQL-side ownership fence for agent-scoped callers.
- ...(owner !== null ? { ownerClientId: owner } : {}),
- } as Parameters<typeof queue.getJobs>[0]);
+ const { listJobPage, JobListCursorError } = await import('../minions/job-list-page.ts');
+ const { limit, clampedFrom } = pagingLimit(ctx, 'list_jobs', p.limit, LIST_JOBS_DEFAULT_LIMIT, LIST_JOBS_REMOTE_MAX_LIMIT);
+ let page: Awaited<ReturnType<typeof listJobPage>>;
+ try {
+ page = await listJobPage(ctx.engine, {
+ status: p.status as string | undefined, queue: p.queue as string | undefined, name: p.name as string | undefined, limit,
+ ...(p.cursor !== undefined && p.cursor !== null ? { cursor: String(p.cursor) } : {}),
+ // #4098: SQL-side ownership fence for agent-scoped callers.
+ ...(owner !== null ? { ownerClientId: owner } : {}),
+ });
+ } catch (e) {
+ if (e instanceof JobListCursorError) throw invalidParam(ctx, 'list_jobs', 'cursor', `list_jobs: ${e.message}`, { example: '1792000000000000:42' });
+ throw e;
+ }
// private_queue_owner_token is a capability credential (lease renewal /
// attach), not job data — never expose it over MCP envelopes.
- return project(jobs);
+ const jobs = await project(page.jobs);
+ reportJobPage(ctx, p, { limit, clampedFrom, returned: jobs.length, nextCursor: page.next_cursor });
+ if (page.next_cursor === undefined || jobs.length === 0) return jobs;
+ return [...jobs.slice(0, -1), { ...jobs[jobs.length - 1], truncated: true, next_cursor: page.next_cursor }];
},
};
diff --git a/src/core/ops/read-paging.ts b/src/core/ops/read-paging.ts
index 273a9ce21f..d7380d40b4 100644
--- a/src/core/ops/read-paging.ts
+++ b/src/core/ops/read-paging.ts
@@ -1,7 +1,8 @@
/**
- * Large pages (Wave A): paging for the two by-slug row reads that used to
- * return everything, get_chunks (every chunk of a page) and get_versions
- * (every snapshot with its body). Both keep a bare array result, because
+ * Large pages (Wave A): paging for the row reads that used to return
+ * everything, get_chunks (every chunk of a page), get_versions (every
+ * snapshot with its body) and list_jobs (any limit a caller named, so one call
+ * could load and describe the whole job table on a serve). All keep a bare array result, because
* deployed thin clients and agents parse an array; the paging facts travel
* the way list_pages carries them:
*
@@ -10,8 +11,9 @@
* rows remain, whose fix is the exact next call;
* - one stderr line for the trusted local CLI when the caller named no limit
* and the default cut the result;
- * - get_chunks only: the last chunk of a cut list carries `truncated: true`
- * and `next_from_index`, so a client that reads only the array (and ignores
+ * - get_chunks and list_jobs: the last row of a cut list carries
+ * `truncated: true` and `next_from_index` (get_chunks) or `next_cursor`
+ * (list_jobs), so a client that reads only the array (and ignores
* `_meta` and notices) still sees the list is incomplete. Additive fields on
* one element keep the array shape older clients parse.
*/
@@ -23,6 +25,9 @@ export const GET_CHUNKS_DEFAULT_LIMIT = 50;
export const GET_CHUNKS_REMOTE_MAX_LIMIT = 500;
export const GET_VERSIONS_DEFAULT_LIMIT = 20;
export const GET_VERSIONS_REMOTE_MAX_LIMIT = 100;
+/** list_jobs: a serve never loads and describes an unbounded job table for one request; page with next_cursor. */
+export const LIST_JOBS_DEFAULT_LIMIT = 50;
+export const LIST_JOBS_REMOTE_MAX_LIMIT = 500;
/**
* The effective limit: the default when unset, an explicit value as given
@@ -90,3 +95,26 @@ export function reportVersionPage(ctx: OperationContext, p: Record<string, unkno
why: `Returns up to the newest ${GET_VERSIONS_REMOTE_MAX_LIMIT} versions.`,
} : undefined);
}
+
+/** list_jobs: meta, notice and local stderr when more jobs match than the page returned. */
+export function reportJobPage(ctx: OperationContext, p: Record<string, unknown>, page: { limit: number; clampedFrom?: number; returned: number; nextCursor?: string }): void {
+ ctx.emitResponseMeta?.('pagination', {
+ limit: page.limit, returned: page.returned,
+ ...(page.clampedFrom !== undefined ? { clamped_from: page.clampedFrom } : {}),
+ ...(page.nextCursor !== undefined ? { next_cursor: page.nextCursor } : {}),
+ });
+ if (page.nextCursor === undefined) return;
+ if (ctx.remote === false) {
+ if (p.limit === undefined || p.limit === null) {
+ console.error(`[list_jobs] showing the newest ${page.limit} jobs (default ${LIST_JOBS_DEFAULT_LIMIT}); older jobs match. Pass a larger limit, or cursor ${page.nextCursor} for the next page.`);
+ }
+ return;
+ }
+ const clamp = page.clampedFrom !== undefined ? ` (limit ${page.clampedFrom} was capped at ${page.limit})` : '';
+ const keep = Object.fromEntries(['status', 'queue', 'name', 'fields'].filter(k => p[k] !== undefined && p[k] !== null).map(k => [k, p[k]]));
+ emitTruncated(ctx, `Older jobs match than the newest ${page.returned} returned${clamp}, so this list is not complete.`, {
+ mcp: { tool: 'list_jobs', arguments: { ...keep, cursor: page.nextCursor, limit: page.limit } },
+ consent: [], actor: 'agent', requires_exclusive: false,
+ why: 'Fetches the next older jobs; every other parameter stays the same. Keep paging until no listing_truncated notice comes back.',
+ });
+}
diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.json
index 76d31b9fbd..7400005fa8 100644
--- a/test/fixtures/goldens/cli/tools-json.json
+++ b/test/fixtures/goldens/cli/tools-json.json
@@ -2,8 +2,8 @@
"golden": {
"exitCode": 0,
"stderr": "",
- "stdoutBytes": 262439,
- "stdoutSha256": "3a6a696129b534029d14fb5301ff3f6874724ad5e1983980f13f88d26ace18b9",
+ "stdoutBytes": 262702,
+ "stdoutSha256": "bfd962a82f16847c7969963ab23410170196491231dcdef214ab3863873b495e",
"toolNames": [
"remember",
"entity",
@@ -4337,6 +4337,7 @@
"mutating": false,
"name": "list_jobs",
"parameters": {
+ "cursor": "string?",
"fields": "array?",
"finished_since": "string?",
"limit": "number?",
@@ -4347,6 +4348,10 @@
"required_scopes": [],
"schema": {
"properties": {
+ "cursor": {
+ "description": "next_cursor from the last job of the previous page (it carries truncated: true): returns the next older jobs.",
+ "type": "string"
+ },
"fields": {
"description": "Return only these job fields (e.g. [\"id\",\"name\",\"status\"]) to save tokens; omit for every field.",
"items": {
@@ -4359,7 +4364,7 @@
"type": "string"
},
"limit": {
- "description": "Max results (default: 50)",
+ "description": "Max results (default 50); MCP callers are capped at 500 per call.",
"type": "number"
},
"name": {
diff --git a/test/list-jobs-row-bound.test.ts b/test/list-jobs-row-bound.test.ts
new file mode 100644
index 0000000000..2e0676afb0
--- /dev/null
+++ b/test/list-jobs-row-bound.test.ts
@@ -0,0 +1,126 @@
+/**
+ * list_jobs row bound: a serve never loads and describes the whole job table for one call.
+ *
+ * 1. Protects: a remote list_jobs call returns at most 500 jobs whatever limit it names, keeps the bare-array
+ * result, marks the last job of a cut page with truncated: true and next_cursor, and carries the paging facts on
+ * _meta.pagination plus a listing_truncated notice whose fix is the next call. Paging with next_cursor returns
+ * every job exactly once, newest first, across created_at ties and under the agent ownership fence. The trusted
+ * local caller keeps the limit it named.
+ * 2. Fails when: list_jobs passes a remote limit straight to SQL (a "jobs list --limit 100000" ran a serve out of
+ * memory), a page boundary repeats or skips a job, the fence is lost on a later page, or a bad cursor or limit
+ * reaches SQL.
+ * 3. No new seam: the real handler over PGLite, and over Postgres when DATABASE_URL is set.
+ */
+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
+import { PGLiteEngine } from '../src/core/pglite-engine.ts';
+import { MinionQueue } from '../src/core/minions/queue.ts';
+import { operationsByName, type OperationContext } from '../src/core/operations.ts';
+import type { Notice } from '../src/core/agent-output.ts';
+import type { BrainEngine } from '../src/core/engine.ts';
+import { isolatedPersistencePostgres } from './helpers/persistence-postgres.ts';
+
+const JOBS = 620;
+const OWNED = 30;
+
+interface Captured { notices: Notice[]; meta: Record<string, unknown> }
+type Row = { id: number; truncated?: boolean; next_cursor?: string };
+
+async function seed(engine: BrainEngine): Promise<number[]> {
+ const queue = new MinionQueue(engine);
+ const ids: number[] = [];
+ for (let i = 0; i < JOBS; i++) {
+ const data: Record<string, unknown> = { prompt: `job-${i}` };
+ if (i < OWNED) data.__owner_client_id = 'agent-a';
+ ids.push((await queue.add('subagent', data, { queue: 'default' }, { allowProtectedSubmit: true })).id);
+ }
+ // Ties: the first 300 jobs share one created_at, as jobs submitted in one transaction do.
+ await engine.executeRaw(`UPDATE minion_jobs SET created_at = now() - interval '1 hour' WHERE id = ANY($1::bigint[])`, [ids.slice(0, 300)]);
+ return ids;
+}
+
+function scenarios(name: 'PGLite' | 'Postgres'): void {
+ describe(`list_jobs row bound (${name})`, () => {
+ let engine: BrainEngine;
+ let close: () => Promise<void>;
+ let newestFirst: number[];
+ beforeAll(async () => {
+ if (name === 'Postgres') {
+ ({ engine, close } = await isolatedPersistencePostgres(process.env.DATABASE_URL!));
+ } else {
+ const pglite = new PGLiteEngine();
+ await pglite.connect({});
+ await pglite.initSchema();
+ engine = pglite;
+ close = () => pglite.disconnect();
+ }
+ await seed(engine);
+ const rows = await engine.executeRaw<{ id: number | string }>('SELECT id FROM minion_jobs ORDER BY created_at DESC, id DESC');
+ newestFirst = rows.map(r => Number(r.id));
+ }, 180_000);
+ afterAll(async () => { await close(); });
+
+ const ctx = (over: Partial<OperationContext>, captured?: Captured): OperationContext => ({
+ engine, config: {} as OperationContext['config'], sourceId: 'default', remote: true, dryRun: false,
+ logger: { info() {}, warn() {}, error() {}, debug() {} } as unknown as OperationContext['logger'],
+ auth: { clientId: 'admin-tok', scopes: ['admin'] } as OperationContext['auth'],
+ ...(captured ? { emitNotice: (n: Notice) => { captured.notices.push(n); }, emitResponseMeta: (k: string, v: unknown) => { captured.meta[k] = v; } } : {}),
+ ...over,
+ } as OperationContext);
+ const list = async (c: OperationContext, params: Record<string, unknown>) => await operationsByName.list_jobs.handler(c, params) as Row[];
+
+ test('a remote limit of 100000 returns 500 jobs, marks the cut, and the cursor reads the rest exactly once', async () => {
+ const first: Captured = { notices: [], meta: {} };
+ const page1 = await list(ctx({}, first), { limit: 100_000, fields: ['id'] });
+ expect(page1).toHaveLength(500);
+ const cursor = page1[499].next_cursor!;
+ expect(page1[499]).toEqual({ id: newestFirst[499], truncated: true, next_cursor: cursor });
+ expect(page1.slice(0, 499).every(r => r.truncated === undefined && r.next_cursor === undefined)).toBe(true);
+ expect(first.meta.pagination).toEqual({ limit: 500, returned: 500, clamped_from: 100_000, next_cursor: cursor });
+ expect(first.notices.map(n => n.code)).toEqual(['listing_truncated']);
+ expect(first.notices[0].fix?.mcp).toEqual({ tool: 'list_jobs', arguments: { fields: ['id'], cursor, limit: 500 } });
+
+ const rest: Captured = { notices: [], meta: {} };
+ const page2 = await list(ctx({}, rest), { fields: ['id'], cursor, limit: 500 });
+ expect(page2.map(r => r.id)).toEqual(newestFirst.slice(500));
+ expect(page2.some(r => r.truncated !== undefined || r.next_cursor !== undefined)).toBe(false);
+ expect(rest.meta.pagination).toEqual({ limit: 500, returned: JOBS - 500 });
+ expect(rest.notices).toEqual([]);
+ }, 60_000);
+
+ test('small pages walk created_at ties without repeating or skipping a job', async () => {
+ const seen: number[] = [];
+ let cursor: string | undefined;
+ do {
+ const page = await list(ctx({}), { limit: 7, fields: ['id'], ...(cursor ? { cursor } : {}) });
+ seen.push(...page.map(r => r.id));
+ cursor = page[page.length - 1]?.next_cursor;
+ } while (cursor);
+ expect(seen).toEqual(newestFirst);
+ }, 120_000);
+
+ test('the agent ownership fence holds on every page', async () => {
+ const agent = ctx({ auth: { clientId: 'agent-a', scopes: ['agent'] } as OperationContext['auth'] });
+ const page1 = await list(agent, { limit: 20, fields: ['id'] });
+ const page2 = await list(agent, { limit: 20, fields: ['id'], cursor: page1[19].next_cursor });
+ const owned = await engine.executeRaw<{ id: number | string }>(`SELECT id FROM minion_jobs WHERE data->>'__owner_client_id' = 'agent-a' ORDER BY created_at DESC, id DESC`);
+ expect([...page1, ...page2].map(r => r.id)).toEqual(owned.map(r => Number(r.id)));
+ expect(page2.some(r => r.next_cursor !== undefined)).toBe(false);
+ }, 60_000);
+
+ test('the trusted local caller keeps the limit it named', async () => {
+ const page = await list(ctx({ remote: false }), { limit: 600, fields: ['id'] });
+ expect(page).toHaveLength(600);
+ expect(page[599]).toMatchObject({ id: newestFirst[599], truncated: true });
+ }, 60_000);
+
+ test('a bad cursor or limit is invalid_params and never reaches SQL', async () => {
+ for (const params of [{ cursor: 'not-a-cursor' }, { cursor: "1'; DROP TABLE minion_jobs; --:1" }, { limit: 0 }, { limit: 2.5 }, { limit: '100000' }]) {
+ await expect(list(ctx({}), params)).rejects.toMatchObject({ code: 'invalid_params' });
+ }
+ expect((await engine.executeRaw<{ n: number | string }>('SELECT count(*) AS n FROM minion_jobs'))[0].n.toString()).toBe(String(JOBS));
+ }, 60_000);
+ });
+}
+
+scenarios('PGLite');
+if (process.env.DATABASE_URL) scenarios('Postgres');
diff --git a/test/postgres-unit-arms.txt b/test/postgres-unit-arms.txt
index 9930406b6b..ee458afa72 100644
--- a/test/postgres-unit-arms.txt
+++ b/test/postgres-unit-arms.txt
@@ -202,6 +202,7 @@ test/link-cross-source.test.ts
test/link-preparation-shared-index.test.ts
test/links-attendance-blocked.test.ts
test/links-extraction-yield.test.ts
+test/list-jobs-row-bound.test.ts
test/managed-cycle-pull-upstream.test.ts
test/managed-facts-withdrawal-recovery-6506.test.ts
test/managed-facts-withdrawn-skip-6506.test.ts