@happyvertical/smrt-jobs 0.62.0 → 0.62.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as assertJobHandlerName, A as registerJobRetentionTasks, B as isWorkerAlive, C as SmrtWorkerCollection, D as DEFAULT_RETENTION_SWEEP_INTERVAL_MS, E as DEFAULT_JOB_RETENTION, F as countScheduleJobs, G as JOB_HANDLER_TARGET_PREFIX, H as unregisterLiveWorker, I as SmrtJobEvent, J as JobHandlerNameError, K as JobHandlerAlreadyRegisteredError, L as SmrtJobEventCollection, M as unregisterJobRetentionTasks, N as SmrtJob, O as JOBS_RETENTION_TASK, P as SmrtJobCollection, Q as MAX_JOB_HANDLERS, R as createWorkerKey, S as SmrtWorker, T as redactErrorMessage, U as SmrtJobDedupeSlot, V as registerLiveWorker, W as JOB_HANDLER_METHOD, X as JobHandlerTargetError, Y as JobHandlerRegistrationClosedError, Z as JobHandlerUnregisteredError, _ as getMcpTaskMarker, a as TaskRunner, at as registerJobHandler, b as taskFromJob, c as getJobClaim, ct as MAX_JOB_RETRIES, d as MCP_TASKS_EXTENSION, dt as backgroundEligible, et as isJobHandlerName, f as McpTaskCancelledError, ft as clampRetries, g as createMcpTaskResult, h as McpTaskSuspendedError, ht as markBackgroundEligible, i as JobTimeoutError, it as listJobHandlers, j as startRetentionSweeper, k as JOB_EVENTS_RETENTION_TASK, l as isRunnerExecutionContext, lt as TenantJobCapExceededError, m as McpTaskStore, mt as isBackgroundEligibleMethod, n as HANDLER_UNCLAIMED_SWEEP_LIMIT, nt as jobHandlerName, o as createTaskRunner, ot as unregisterJobHandler, p as McpTaskNotFoundError, pt as getBackgroundEligibleMethods, q as JobHandlerLimitError, r as JobCancelledError, rt as jobHandlerTarget, s as getActiveJobExecutionContext, st as DEFAULT_TENANT_JOB_CAP, t as DEFAULT_HANDLER_UNCLAIMED_DEADLINE_MS, tt as isJobHandlerTarget, u as DEFAULT_TASK_HEARTBEAT_INTERVAL_MS, ut as assertWithinTenantCreationCap, v as requestMcpTaskContinuation, w as redactErrorForPersistence, x as JobContextLogger, y as requestMcpTaskInput, z as enablePgliteJobs } from "./chunks/runner-ComDONr7.js";
1
+ import { $ as assertJobHandlerName, A as registerJobRetentionTasks, B as isWorkerAlive, C as SmrtWorkerCollection, D as DEFAULT_RETENTION_SWEEP_INTERVAL_MS, E as DEFAULT_JOB_RETENTION, F as countScheduleJobs, G as JOB_HANDLER_TARGET_PREFIX, H as unregisterLiveWorker, I as SmrtJobEvent, J as JobHandlerNameError, K as JobHandlerAlreadyRegisteredError, L as SmrtJobEventCollection, M as unregisterJobRetentionTasks, N as SmrtJob, O as JOBS_RETENTION_TASK, P as SmrtJobCollection, Q as MAX_JOB_HANDLERS, R as createWorkerKey, S as SmrtWorker, T as redactErrorMessage, U as SmrtJobDedupeSlot, V as registerLiveWorker, W as JOB_HANDLER_METHOD, X as JobHandlerTargetError, Y as JobHandlerRegistrationClosedError, Z as JobHandlerUnregisteredError, _ as getMcpTaskMarker, a as TaskRunner, at as registerJobHandler, b as taskFromJob, c as getJobClaim, ct as MAX_JOB_RETRIES, d as MCP_TASKS_EXTENSION, dt as backgroundEligible, et as isJobHandlerName, f as McpTaskCancelledError, ft as clampRetries, g as createMcpTaskResult, h as McpTaskSuspendedError, ht as markBackgroundEligible, i as JobTimeoutError, it as listJobHandlers, j as startRetentionSweeper, k as JOB_EVENTS_RETENTION_TASK, l as isRunnerExecutionContext, lt as TenantJobCapExceededError, m as McpTaskStore, mt as isBackgroundEligibleMethod, n as HANDLER_UNCLAIMED_SWEEP_LIMIT, nt as jobHandlerName, o as createTaskRunner, ot as unregisterJobHandler, p as McpTaskNotFoundError, pt as getBackgroundEligibleMethods, q as JobHandlerLimitError, r as JobCancelledError, rt as jobHandlerTarget, s as getActiveJobExecutionContext, st as DEFAULT_TENANT_JOB_CAP, t as DEFAULT_HANDLER_UNCLAIMED_DEADLINE_MS, tt as isJobHandlerTarget, u as DEFAULT_TASK_HEARTBEAT_INTERVAL_MS, ut as assertWithinTenantCreationCap, v as requestMcpTaskContinuation, w as redactErrorForPersistence, x as JobContextLogger, y as requestMcpTaskInput, z as enablePgliteJobs } from "./chunks/runner-B4VNBNnq.js";
2
2
  import { ObjectRegistry, SmrtCollection, SmrtObject, assertDatabaseMigratedForBuild, detectEngine, field, smrt } from "@happyvertical/smrt-core";
3
3
  import { createLogger } from "@happyvertical/logger";
4
4
  import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-jobs",
5
- "packageVersion": "0.62.0",
5
+ "packageVersion": "0.62.2",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-jobs:SmrtJobEvent": {
8
8
  "name": "smrtjobevent",
package/dist/runner.d.ts CHANGED
@@ -192,6 +192,12 @@ export declare class TaskRunner extends EventEmitter {
192
192
  /** Resolves when {@link livenessWorker} has exited (set together with it). */
193
193
  private livenessWorkerExited;
194
194
  private shutdownPromise;
195
+ /** The in-flight {@link start}, shared by overlapping callers (#4944). */
196
+ private startPromise;
197
+ /** The in-flight {@link stop}, shared by overlapping callers (#4944). */
198
+ private stopPromise;
199
+ /** Set by a {@link stop} that lands while {@link start} is in flight. */
200
+ private startCancelled;
195
201
  private db;
196
202
  /**
197
203
  * Handlers this runner dispatches to, snapshotted when it starts (#5005).
@@ -210,10 +216,18 @@ export declare class TaskRunner extends EventEmitter {
210
216
  * Start processing jobs
211
217
  */
212
218
  start(): Promise<void>;
219
+ /**
220
+ * The body of {@link start}. A {@link stop} that lands while it runs sets
221
+ * {@link startCancelled}; the checks below then skip whatever has not
222
+ * started yet, and that stop tears down what has, once this settles (#4944).
223
+ */
224
+ private startRunning;
213
225
  /**
214
226
  * Stop processing jobs (graceful shutdown)
215
227
  */
216
228
  stop(): Promise<void>;
229
+ /** The body of {@link stop}: drain, then release lease renewal and liveness. */
230
+ private shutdown;
217
231
  /**
218
232
  * Check if runner is running
219
233
  */
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAEA,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAa3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAI5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAW/C,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,gBAAgB,EAItB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,KAAK,uBAAuB,EAE7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,OAAO,EAEb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,YAAY,EAA0B,MAAM,qBAAqB,CAAC;AA+BhF,gFAAgF;AAChF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,mBAAmB,CAM9B;AAED,yEAAyE;AACzE,wBAAgB,4BAA4B,IACxC,mBAAmB,GACnB,SAAS,CAEZ;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAShE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wFAAwF;IACxF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,CACjB,SAAS,EAAE,QAAQ,CAAC,gBAAgB,CAAC,KAClC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C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IAY1B;;;OAGG;YACW,iBAAiB;IAO/B;;;;;;;;;;;;;OAaG;YACW,gBAAgB;IA+G9B;;;;;;;;;;;;;;;;;;OAkBG;YACW,yBAAyB;IAkFvC;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;OAKG;YACW,mBAAmB;IA+GjC,OAAO,CAAC,wBAAwB;IAShC;;;;OAIG;YACW,kBAAkB;IAiBhC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;YACW,iBAAiB;CAuBhC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAEtE;AAED,eAAe,UAAU,CAAC"}
package/dist/runner.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as TaskRunner, c as getJobClaim, i as JobTimeoutError, l as isRunnerExecutionContext, n as HANDLER_UNCLAIMED_SWEEP_LIMIT, o as createTaskRunner, r as JobCancelledError, s as getActiveJobExecutionContext, t as DEFAULT_HANDLER_UNCLAIMED_DEADLINE_MS } from "./chunks/runner-ComDONr7.js";
1
+ import { a as TaskRunner, c as getJobClaim, i as JobTimeoutError, l as isRunnerExecutionContext, n as HANDLER_UNCLAIMED_SWEEP_LIMIT, o as createTaskRunner, r as JobCancelledError, s as getActiveJobExecutionContext, t as DEFAULT_HANDLER_UNCLAIMED_DEADLINE_MS } from "./chunks/runner-B4VNBNnq.js";
2
2
  export { DEFAULT_HANDLER_UNCLAIMED_DEADLINE_MS, HANDLER_UNCLAIMED_SWEEP_LIMIT, JobCancelledError, JobTimeoutError, TaskRunner, TaskRunner as default, createTaskRunner, getActiveJobExecutionContext, getJobClaim, isRunnerExecutionContext };
@@ -3,13 +3,13 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-jobs",
6
- "packageVersion": "0.62.0",
6
+ "packageVersion": "0.62.2",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "0a7db420331f6adcf73d00c9ce3c742dd16c5ee7e0fd0b4642d47873c174dc89",
11
- "packageJson": "1f41a76a9aba7ebc3bf27cacab028bccdf4f5438e550bca686365391047561c6",
12
- "agents": "00af938903e92b287879cc3980a1c42a8a961dcc0db7b834891f4ffd4ab2d15d",
10
+ "manifest": "10c84f24da1e261314954591190a870ebe7b6083052110337982bb331163694c",
11
+ "packageJson": "4f2706fdbc9615abc1cb71510cd483e1556ee40dfaa371fc90b14253cdb2fe61",
12
+ "agents": "b60771f0619d2488db74ded1bd49d6beb43a3d14c2eeef55504c7fbd8f83357d",
13
13
  "moduleDoc:agents/provider-loading.md": "fe0732df73c6de898e8cae189b04839f567b04a2b98a5211efba217e7d04e03e",
14
14
  "moduleDoc:agents/job-handlers.md": "3545f5494a8faedd5d6c3eba003d88269fff33f98061cb48b53192d8fc29024e",
15
15
  "moduleDoc:agents/worker-liveness.md": "75f592055d136982818a7ced82da78954493551954c4c953ee6373e891b9e035",
@@ -1379,7 +1379,7 @@
1379
1379
  "polymorphicAssociations": 0,
1380
1380
  "uuidColumns": 20
1381
1381
  },
1382
- "agentDoc": "# @happyvertical/smrt-jobs\n\nBackground job execution with persistent queue, scheduling, and fluent builder API.\nRetry SDK import boundary: [provider loading](agents/provider-loading.md).\nA job targets a model method or a registered named handler; runners claim only handlers they registered: [job handlers](agents/job-handlers.md).\n\n## Architecture\n\n```\nSmrtObject.bg('method') → SmrtJob (in _smrt_jobs) → TaskRunner picks up → executes via ObjectRegistry\nAgentSchedule (cron) → ScheduleRunner creates SmrtJob → TaskRunner executes → ScheduleRunner updates\nTaskRunner.start() → SmrtWorker lease (in _smrt_workers) → recovery keys on worker liveness, not heartbeat\n```\n\n## SmrtJob\n\nPersistent in `_smrt_jobs`. Fields: `queue` (default), `objectType`, `objectId`, `method`, `args`, `runAt`, `priority` (higher=sooner), `status`, `attempts`/`maxAttempts`, `timeout` (default 5min), `retryStrategy`, `workerId` (the owning runner's incarnation key), `workerHeartbeat` (telemetry only — no longer gates recovery).\n\nStatus: `pending → running → completed/failed/cancelled`.\n\n## TaskRunner\n\nPolling-based execution engine. Config: `concurrency` (5), `pollInterval` (1s), `idlePollInterval` (defaults to 20× `pollInterval`), `heartbeatInterval` (30s, telemetry only), `leaseTtlMs` (30s), `leaseTickMs` (10s), `shutdownTimeout` (30s). Empty claims back off exponentially to `idlePollInterval`; any claimed work, capacity pressure, or poll error resets to `pollInterval`. Every delay is capped at the effective worker lease TTL, including an oversized base interval; recovery sweep spacing stays TTL-bounded (plus query/event-loop time). Polling intervals must be finite positive milliseconds within the Node timer range. `stop()` waits (within `shutdownTimeout`) for an in-flight poll as well as active jobs; a poll that resumes after `stop()` began returns before claiming, and over-claimed rows are released both before and after the drain (#3148).\n\nOptional `tenantIds` scopes both atomic ready claims and orphan recovery before\nownership or terminal-state writes (`undefined` means all; `[]` means none;\n`null` includes global jobs). Recovery also respects configured queues. Scoped\nrunners default `retention` to `false`, since the system-wide maintenance sweep\nhas no tenant filter; opt into that sweep only in an authorized maintenance host.\n`ClaimReadyOptions` and `ListReadyOptions` accept the same tenant scope. Queue\nlease advertising remains queue-level; it does not prove per-tenant availability.\n\n1. `start()` checks the build migrate fingerprint, then calls `assertReady()` (fail fast if `_smrt_workers` unmigrated), registers a seeded `SmrtWorker` lease, and adds its worker key to the process-global live set — all **before** polling\n2. Polls `claimReady()` to atomically claim at most the free slots (`concurrency - active`) of pending jobs (`runAt <= NOW`, ordered by `priority DESC, runAt ASC, created_at ASC, id ASC`). On PostgreSQL the candidates come from a `MATERIALIZED` CTE joined to the UPDATE; never claim with `WHERE id IN (SELECT … LIMIT n FOR UPDATE SKIP LOCKED)` — a nested-loop semi join rescans it per outer row and takes the whole backlog (#3145). The runner also never starts more than the free slots and returns any surplus claim to `pending` with its attempt restored\n3. Claim sets `status='running'`, `workerId=<incarnation key>`, heartbeat/start timestamps, and increments `attempts`\n4. Resolves class via `ObjectRegistry.getClass(objectType)` (a `handler:` target uses the handler snapshot instead). Object-bound jobs\n pass `objectId` to the constructor and let `initialize()` perform the single\n canonical hydration. Runner-owned `db`, `id`, and hydration options cannot be\n overridden by agent config; missing persisted targets fail before method\n dispatch. Jobs without `objectId` construct a static-like instance\n5. **Internal args**: `_agentConfig` and `_scheduleId` stripped from args before calling method. `_agentConfig` goes through `resolveLazyConfig()` with this job's identity as resolver context (`agentId` = `objectId`, qualified `agentClass`, `tenantId`, `scheduleId`, `jobId`; #2806). That identity comes from the job row only, never from scanning other agents. `scheduleId` is echoed from args unverified and is informational only\n6. Calls the requested method on the initialized instance\n7. Terminal/retry writes are **conditional** (`WHERE worker_id=? AND status='running'`) so a recovered row is never stomped\n8. Retry: uses strategy from `@happyvertical/jobs`, schedules future `runAt` on failure. A handler error's own hints win (#3308): `error.retryable === false` fails the job terminally; a positive `error.retryAfterMs` (capped at 24 h) is a floor on the strategy's delay\n9. Events: `job:started`, `job:completed`, `job:failed`, `job:retrying`, `runner:started/stopped`\n\n`start()` prepares the terminal-outcome storage before it registers or claims anything (#4735). Preparing it builds the registry's merged schemas, so a registry inconsistency (two unrelated classes claiming one table) rejects `start()` with that error, logged at error level, instead of stranding every claimed job as `running`. Readiness is cached per database: a model family that registers after start cannot block a later terminal write. A completion, failure or retry write that still cannot be persisted is logged at error level with the job id as well as emitted as `runner:error` (a listener that throws after the write committed is only a `runner:error`). The row is still `running` and owned by this live worker, so liveness-based recovery would skip it until the process stops; the runner records it in `unsettledJobs` and its own recovery sweep settles it as `failed` with its `stale-recovery` event and a `last_error` saying what happened, firing `job:failed` once. A handler that returned is never retried. State and event still commit together (see Terminal outcomes): if the settle cannot be persisted either, it is retried each sweep and logged once per job, and the sweep continues with the other orphans.\n\nA rejection from `processJob` can never escape the poll loop: the caller attaches `.catch(e => emit('runner:error', e))` and the error path (`handleJobError`) is itself try/caught, so a failure-path write that rejects is surfaced as a `runner:error` event instead of crashing the worker with an unhandled rejection.\n\n## Timeouts & at-least-once\n\n**Execution is at-least-once, never exactly-once. Make job handlers idempotent.**\n\nA job `timeout` only races the handler's promise — JavaScript cannot preempt an already-running function. When a handler exceeds its timeout:\n\n- The job is **failed terminally and NOT auto-retried** (a timed-out handler is still running; re-queueing it would let a second worker run a concurrent duplicate). This narrows, but does not eliminate, the overlap window — the orphaned handler keeps running until it returns on its own.\n- The orphaned handler's eventual terminal write is dropped by the ownership guard (`WHERE worker_id=? AND status='running'`), so it cannot resurrect the failed row — but any **side effects** it performs (external API calls, writes to other tables) still happen.\n- Key any non-idempotent work by `context.job.jobId` or a caller-supplied idempotency key.\n\n`timeoutBehavior` (persisted + shown in the UI) is now honored:\n\n- **`'fail'`** (default): on timeout the job fails (and, per above, is not retried).\n- **`'warn'`**: the handler is **not** raced against the timeout — it runs to completion, and at the deadline the runner logs a warning and emits a `timeout-warning` job event. A slow-but-successful handler still completes successfully.\n- **`'kill'`**: treated identically to `'fail'`. In-process JavaScript has no thread interruption, so a true \"kill\" of a running handler is impossible without worker isolation; this value is honest that it only fails the job row, it does not stop the handler. Prefer `'fail'` unless you specifically want the label.\n\n## Cooperative cancellation (`context.signal`)\n\nHandlers receive `context.signal`, a plain `AbortSignal` (pass it to `fetch` or an LLM SDK). It aborts when:\n\n- the job row is observed as `cancelled` while the handler runs (reason: exported `JobCancelledError`). The runner polls the owned row every `cancelPollInterval` (default 1s) with one read-only `SELECT status`; unref'd and cleared in `finally`. Poll errors are ignored.\n- the job times out under `timeoutBehavior` `'fail'`/`'kill'` (reason: `JobTimeoutError`), so the orphaned handler can stop. `'warn'` never aborts.\n\nCooperative only: aborting changes no lifecycle state, retry policy, terminal-write guard or event. A handler that ignores the signal behaves exactly as before; one that rejects with the abort reason cannot overwrite `cancelled`/`failed` (the `WHERE worker_id=? AND status='running'` guard drops its terminal write). Not aborted on runner shutdown. `isRunnerExecutionContext` and MCP-task invocations are unchanged; they receive the same `signal`.\n\n**Domain request identity / usage:** `smrt-education` still owns generation request replay and per-attempt usage. The generic store dedupe key below only reserves one nonterminal job; it never replaces domain idempotency or usage records.\n\n## Worker liveness & recovery (#1474)\n\nRecovery keys on **worker-process liveness**, never per-job heartbeat freshness (a CPU-bound synchronous handler used to starve the heartbeat and false-recover its own running jobs).\n\n- **`SmrtWorker` / `_smrt_workers`**: one lease row per runner *incarnation* (`workerId` is per-incarnation unique via `createWorkerKey`, so a restart never looks like it still owns the previous crash's jobs). `leaseExpiresAt` is a `datetime` (an integer epoch-ms column overflows `int4`/`INT32` on Postgres/DuckDB). Stage 1 writes/compares it against the host clock — the same approach the old heartbeat recovery used, so it's no more skew-sensitive than the code it replaced.\n- **`SmrtWorker.queues`** (nullable JSON `string[]`, #3902): the runner's configured `queues`, written at `registerWorker` and re-written on every lease renewal (main-loop and off-loop ticker). `SmrtWorkerCollection.liveWorkerKeysForQueue(queue)` returns fresh-lease workers that poll a queue; rows with `queues = null` (older runners, schedule runners) never match. Existing databases need `smrt db:migrate` (additive column) before an upgraded runner starts.\n- **Process-global live set** (`worker-liveness.ts`, `globalThis.__smrtLiveWorkers`): checked synchronously, so it can't be starved by a blocked loop. Covers all same-process topologies.\n- **Off-loop ticker** (`worker-liveness-ticker.ts` + `worker-liveness-thread.ts`): renews the lease off the main loop, only on a same-engine connection (SQLite through `db.reopenOptions()`, engine checked, #4978); otherwise main-loop renewal with one log. Details: [agents/worker-liveness.md](agents/worker-liveness.md).\n- **Recovery rule** (both runners): a `running` job is orphaned iff its worker is *not alive* = not in the live set **and** no fresh `_smrt_workers` lease. The live set takes precedence over a stale lease. TaskRunner also never recovers a job in its own `activeJobs`. If `_smrt_workers` is absent, recovery skips lease checks (never mass-recovers). Recovery is swept at most once per lease tick, and terminal/recovery writes use `RETURNING id` (not `rowCount`, which DuckDB/JSON adapters always report as ≥1).\n- **Lease clock**: the lease is compared against the host clock (same as the old heartbeat; fine with NTP + a 30s TTL). A dead process stops renewing and the lease expires within its TTL — that is how recovery detects death. (Instant cross-process detection via Postgres session advisory locks was prototyped on `@happyvertical/sql`'s `acquireSession()` but deferred — treating a free lock as proof-of-death false-recovers any worker legitimately in main-loop fallback mode.)\n\n## ScheduleRunner\n\nTransactional schedule admission, tenant/type scopes, dedicated queues,\noccurrence metadata, retry/slot semantics, graceful drain, and tenant-partitioned\nnonterminal job keys are documented in [safe scheduling](agents/scheduling.md).\nRun `smrt db:migrate` before using the new job provenance and dedupe-slot schema.\n\nCustom cron parser (`getNextCronDate(cron, timezone?)`): 5-field (minute hour dom month dow); `*`, ranges, lists, steps supported, each list term matched on its own. Fields match the wall clock of the schedule's IANA `timezone` (`Intl.DateTimeFormat`, DST-correct, no dependency); the re-arm passes the row's `timezone`, and a NULL/blank zone falls back to the column default `UTC`. Unknown zones throw `Invalid cron timezone`; the runner moves a row whose cron or zone is invalid to `status='error'` with `last_error`, since retrying it every poll cannot succeed. Only an omitted argument uses the host process zone (legacy; `smrt-reports` still relies on it). DST follows Vixie cron: fixed-time crons (no `*` in minute or hour) run once per day, a gap-skipped wall time runs shifted forward by the gap, a repeated one only at its first occurrence; wildcard crons follow elapsed time (gap minutes skipped, the repeated hour runs again) (#3859).\n\n## JobBuilder — Fluent API\n\n```typescript\nconst handle = await doc.background('analyze', { detailed: true })\n .delay('5m').priority('high').retries(5).queue('analysis').timeout(600000).enqueue();\n\nawait handle.wait({ timeout: 60000, pollInterval: 100 }); // polling-based\n```\n\n## Durable forge projections\n\nProvider delivery inbox, leases and checkpoints: [forge projections](agents/forge-projections.md).\n\n`bg()` is shorthand: `await doc.bg('analyze', args)` → enqueues immediately, returns JobHandle.\n\n## withBackgroundJobs(Class)\n\nMixin that adds `bg()` and `background()` to any SmrtObject. Uses WeakMap for collection caching per DB instance.\n\n## Background policy (`background-policy.ts`, S5 audit #1402)\n\nThree opt-in guards, all owned **and enforced here**. Other packages apply the\neligibility marker (`reports`, `support`, `fields`, the MCP conformance\nfixture), but nothing outside this package acts on it — `TaskRunner` is the only\nreader. In particular `@happyvertical/smrt-agents` has no reference to any of\nthese guards and does not depend on this package, so marking a method does not\nchange what the agents runtime will dispatch.\n\n- `clampRetries()` / `MAX_JOB_RETRIES` (25): a requested retry count above the\n ceiling is clamped, not rejected.\n- `assertWithinTenantCreationCap(tenantId, current, cap)` /\n `DEFAULT_TENANT_JOB_CAP` (10 000): throws `TenantJobCapExceededError` when the\n tenant's count of non-terminal jobs is already at or above the cap. Applied in\n `SmrtJobCollection.enqueueJob()` (`smrt-job.ts`), which is the single choke\n point for the builder and `ScheduleRunner`; a `null` tenant and a `cap <= 0`\n both skip the check. Deliberately not serialized — concurrent enqueues can\n overshoot by the number of in-flight creators (see the method's own comment).\n- `@backgroundEligible()` / `markBackgroundEligible()` /\n `isBackgroundEligibleMethod()`: an allowlist of methods `TaskRunner` may\n dispatch, enforced at exactly one call site (`runner.ts`, after the method\n lookup). **Restrictive, not enabling** — a class with no marked methods allows\n any of its methods, and the first mark makes the set exhaustive, excluding\n every sibling method. Adding the decorator to one method of an existing class\n is therefore a behaviour change for the rest of it.\n\n## Terminal outcomes (#3696)\n\nTerminal state is authoritative together with its versioned event. Completion,\npermanent failure, timeout, stale-worker recovery, and cancellation update the\nowned `_smrt_jobs` row and append the safe `_smrt_job_events` projection in one\ndatabase transaction. If either write fails, neither commits. Conditional\nownership/status predicates prevent a lost race from appending an event.\nBuild the event from the conditional update's returned row, not a caller\nsnapshot, and bind that update to the row's tenant. Public cancellation must\nretain ambient-tenant isolation; only explicit bypass contexts may cross it.\nRetries are deliberately excluded until a later terminal transition. Ordinary\nprogress, logs, start, and retry telemetry remain best-effort.\n\n`SmrtJobEventCollection.listTerminalOutcomes()` requires an explicit tenant\n(`null` means global), reads newest-first, scans at most 1,000 candidates, and\nreturns only the safe versioned terminal shape. Never add job arguments,\nobject IDs, results, raw errors, or stacks to that shape. Applications must\nintersect job IDs with their own authorized ownership records; queue/object\ntype/method filters narrow the projection but do not authorize it.\n\n## Retention (#2375)\n\n`_smrt_jobs` and `_smrt_job_events` are append-only in practice — `cleanup()`\nexisted but nothing ever called it, and job events (one row per log line and\nprogress tick) had no prune path at all. `src/retention.ts` contributes both to\nthe framework retention sweep in `@happyvertical/smrt-core`.\n\n- `TaskRunner` starts a sweeper by default. `retention: false` opts out;\n `retention: { intervalMs, policy, jobs }` tunes it. The **first sweep is one\n interval after `start()`, never at start** — a crash-looping worker must not\n become a delete loop, and a short-lived runner must exit having deleted\n nothing. `stop()` only clears the timer — it does **not** unregister the job\n tasks. The package entry point (`index.ts`) registers them unconditionally\n on import, so \"this process loaded `@happyvertical/smrt-jobs`\" is the\n contract that contributes them, not \"a sweeper happens to be running\";\n `unregisterJobRetentionTasks()` is the explicit opt-out for callers that\n want a clean registry (tests, teardown).\n- Windows (`DEFAULT_JOB_RETENTION`): completed/cancelled 7 days, failed 30\n days, events 30 days, 10 000 job rows per sweep. Events deliberately outlive\n the jobs they describe, so a job row removed at 7 days still has a readable\n log for another three weeks. `SmrtJobEvent.jobId` is therefore the explicit\n same-package archival exception: `@foreignKey('SmrtJob', { constraint:\n false })` retains runtime relationship metadata and its index without a\n physical database constraint that would block parent pruning.\n- `cleanup()` counts before deleting (`rowCount` is unreliable across engines)\n and honours `dryRun`, which is what makes `smrt db:prune --dry-run` an exact\n preview. Its `(status, completed_at)` predicate is indexed by\n `ensureJobsSystemTableCompatibility()`, which this collection runs on every\n `initialize()` — bootstrap cannot do it, because `_smrt_jobs` does not exist\n yet when bootstrap runs.\n- `cleanup({})` with no cutoff returns 0. It must never be read as \"delete\n everything\".\n\n## Gotchas\n\n- The shared claim/recovery projection casts both job and tenant UUIDs to strings; DuckDB otherwise returns native UUID objects. Preserve NULL for global jobs.\n\n- **Cron zone comes from the row**: `_smrt_agent_schedules.timezone` (default `UTC`), not the host `TZ`; no missed-run catch-up (fire-once-forward)\n- **At-least-once execution**: a timeout cannot preempt a running handler; timed-out jobs fail without retry but the handler keeps running — make handlers idempotent (see \"Timeouts & at-least-once\")\n- **No dead letter queue**: failed jobs stay in DB with `status='failed'` — manual intervention\n- **Forge deliveries are not SmrtJobs**: they use their own replayable\n dead-letter inbox and projection checkpoint contract. Do not enqueue provider\n deliveries as generic background jobs.\n- **Result storage**: `resultPointer` is just a string — app must implement result backend\n- **Lazy builder**: `background()` returns builder — nothing happens until `enqueue()`\n- **wait() is polling**: JobHandle.wait() polls DB every 100ms (configurable)\n- **Migrate before start()**: Both runners call core's `assertDatabaseMigratedForBuild` before polling (policy: [schema paths](../core/agents/schema-paths.md)). A missing or different record refuses production start; development warns, test databases are exempt, and the emergency override is logged. `TaskRunner.start()` throws if `_smrt_workers` is missing — run `smrt db:migrate` after upgrading. Tables are never created at runtime.\n- **Recovery is liveness-based**: don't reintroduce heartbeat-threshold recovery; a blocked event loop must not look dead (see Worker liveness section, #1474)\n\n## Transaction-bound claims\n\nUse `getJobClaim`, `assertJobClaim`, `assertJobClaimForRelease`,\n`assertFailedJobDispatch` and `assertAbandonedJobClaim` for dispatch fencing,\nrecovery and application lease release. Read [claim and recovery contracts](agents/job-claims.md)\nfor opt-in fencing, transaction affinity, liveness, exact outcome lookup and\nPGlite validation. Never infer settlement from cancellation alone.\n",
1382
+ "agentDoc": "# @happyvertical/smrt-jobs\n\nBackground job execution with persistent queue, scheduling, and fluent builder API.\nRetry SDK import boundary: [provider loading](agents/provider-loading.md).\nA job targets a model method or a registered named handler; runners claim only handlers they registered: [job handlers](agents/job-handlers.md).\n\n## Architecture\n\n```\nSmrtObject.bg('method') → SmrtJob (in _smrt_jobs) → TaskRunner picks up → executes via ObjectRegistry\nAgentSchedule (cron) → ScheduleRunner creates SmrtJob → TaskRunner executes → ScheduleRunner updates\nTaskRunner.start() → SmrtWorker lease (in _smrt_workers) → recovery keys on worker liveness, not heartbeat\n```\n\n## SmrtJob\n\nPersistent in `_smrt_jobs`. Fields: `queue` (default), `objectType`, `objectId`, `method`, `args`, `runAt`, `priority` (higher=sooner), `status`, `attempts`/`maxAttempts`, `timeout` (default 5min), `retryStrategy`, `workerId` (the owning runner's incarnation key), `workerHeartbeat` (telemetry only — no longer gates recovery).\n\nStatus: `pending → running → completed/failed/cancelled`.\n\n## TaskRunner\n\nPolling-based execution engine. Config: `concurrency` (5), `pollInterval` (1s), `idlePollInterval` (defaults to 20× `pollInterval`), `heartbeatInterval` (30s, telemetry only), `leaseTtlMs` (30s), `leaseTickMs` (10s), `shutdownTimeout` (30s). Empty claims back off exponentially to `idlePollInterval`; any claimed work, capacity pressure, or poll error resets to `pollInterval`. Every delay is capped at the effective worker lease TTL, including an oversized base interval; recovery sweep spacing stays TTL-bounded (plus query/event-loop time). Polling intervals must be finite positive milliseconds within the Node timer range. `stop()` waits (within `shutdownTimeout`) for an in-flight poll as well as active jobs; a poll that resumes after `stop()` began returns before claiming, and over-claimed rows are released both before and after the drain (#3148). Overlapping `start()` calls share one start and overlapping `stop()` calls one stop; a `stop()` during `start()` (a SIGTERM at startup) cancels the steps `start()` has not reached, waits for it to settle, then tears down the lease, liveness thread and timers it did start, so nothing outlives `stop()`; `start()` then resolves without `runner:started`, and a `start()` during any in-flight `stop()` throws (#4944).\n\nOptional `tenantIds` scopes both atomic ready claims and orphan recovery before\nownership or terminal-state writes (`undefined` means all; `[]` means none;\n`null` includes global jobs). Recovery also respects configured queues. Scoped\nrunners default `retention` to `false`, since the system-wide maintenance sweep\nhas no tenant filter; opt into that sweep only in an authorized maintenance host.\n`ClaimReadyOptions` and `ListReadyOptions` accept the same tenant scope. Queue\nlease advertising remains queue-level; it does not prove per-tenant availability.\n\n1. `start()` checks the build migrate fingerprint, then calls `assertReady()` (fail fast if `_smrt_workers` unmigrated), registers a seeded `SmrtWorker` lease, and adds its worker key to the process-global live set — all **before** polling\n2. Polls `claimReady()` to atomically claim at most the free slots (`concurrency - active`) of pending jobs (`runAt <= NOW`, ordered by `priority DESC, runAt ASC, created_at ASC, id ASC`). On PostgreSQL the candidates come from a `MATERIALIZED` CTE joined to the UPDATE; never claim with `WHERE id IN (SELECT … LIMIT n FOR UPDATE SKIP LOCKED)` — a nested-loop semi join rescans it per outer row and takes the whole backlog (#3145). The runner also never starts more than the free slots and returns any surplus claim to `pending` with its attempt restored\n3. Claim sets `status='running'`, `workerId=<incarnation key>`, heartbeat/start timestamps, and increments `attempts`\n4. Resolves class via `ObjectRegistry.getClass(objectType)` (a `handler:` target uses the handler snapshot instead). Object-bound jobs\n pass `objectId` to the constructor and let `initialize()` perform the single\n canonical hydration. Runner-owned `db`, `id`, and hydration options cannot be\n overridden by agent config; missing persisted targets fail before method\n dispatch. Jobs without `objectId` construct a static-like instance\n5. **Internal args**: `_agentConfig` and `_scheduleId` stripped from args before calling method. `_agentConfig` goes through `resolveLazyConfig()` with this job's identity as resolver context (`agentId` = `objectId`, qualified `agentClass`, `tenantId`, `scheduleId`, `jobId`; #2806). That identity comes from the job row only, never from scanning other agents. `scheduleId` is echoed from args unverified and is informational only\n6. Calls the requested method on the initialized instance\n7. Terminal/retry writes are **conditional** (`WHERE worker_id=? AND status='running'`) so a recovered row is never stomped\n8. Retry: uses strategy from `@happyvertical/jobs`, schedules future `runAt` on failure. A handler error's own hints win (#3308): `error.retryable === false` fails the job terminally; a positive `error.retryAfterMs` (capped at 24 h) is a floor on the strategy's delay\n9. Events: `job:started`, `job:completed`, `job:failed`, `job:retrying`, `runner:started/stopped`\n\n`start()` prepares the terminal-outcome storage before it registers or claims anything (#4735). Preparing it builds the registry's merged schemas, so a registry inconsistency (two unrelated classes claiming one table) rejects `start()` with that error, logged at error level, instead of stranding every claimed job as `running`. Readiness is cached per database: a model family that registers after start cannot block a later terminal write. A completion, failure or retry write that still cannot be persisted is logged at error level with the job id as well as emitted as `runner:error` (a listener that throws after the write committed is only a `runner:error`). The row is still `running` and owned by this live worker, so liveness-based recovery would skip it until the process stops; the runner records it in `unsettledJobs` and its own recovery sweep settles it as `failed` with its `stale-recovery` event and a `last_error` saying what happened, firing `job:failed` once. A handler that returned is never retried. State and event still commit together (see Terminal outcomes): if the settle cannot be persisted either, it is retried each sweep and logged once per job, and the sweep continues with the other orphans.\n\nA rejection from `processJob` can never escape the poll loop: the caller attaches `.catch(e => emit('runner:error', e))` and the error path (`handleJobError`) is itself try/caught, so a failure-path write that rejects is surfaced as a `runner:error` event instead of crashing the worker with an unhandled rejection.\n\n## Timeouts & at-least-once\n\n**Execution is at-least-once, never exactly-once. Make job handlers idempotent.**\n\nA job `timeout` only races the handler's promise — JavaScript cannot preempt an already-running function. When a handler exceeds its timeout:\n\n- The job is **failed terminally and NOT auto-retried** (a timed-out handler is still running; re-queueing it would let a second worker run a concurrent duplicate). This narrows, but does not eliminate, the overlap window — the orphaned handler keeps running until it returns on its own.\n- The orphaned handler's eventual terminal write is dropped by the ownership guard (`WHERE worker_id=? AND status='running'`), so it cannot resurrect the failed row — but any **side effects** it performs (external API calls, writes to other tables) still happen.\n- Key any non-idempotent work by `context.job.jobId` or a caller-supplied idempotency key.\n\n`timeoutBehavior` (persisted + shown in the UI) is now honored:\n\n- **`'fail'`** (default): on timeout the job fails (and, per above, is not retried).\n- **`'warn'`**: the handler is **not** raced against the timeout — it runs to completion, and at the deadline the runner logs a warning and emits a `timeout-warning` job event. A slow-but-successful handler still completes successfully.\n- **`'kill'`**: treated identically to `'fail'`. In-process JavaScript has no thread interruption, so a true \"kill\" of a running handler is impossible without worker isolation; this value is honest that it only fails the job row, it does not stop the handler. Prefer `'fail'` unless you specifically want the label.\n\n## Cooperative cancellation (`context.signal`)\n\nHandlers receive `context.signal`, a plain `AbortSignal` (pass it to `fetch` or an LLM SDK). It aborts when:\n\n- the job row is observed as `cancelled` while the handler runs (reason: exported `JobCancelledError`). The runner polls the owned row every `cancelPollInterval` (default 1s) with one read-only `SELECT status`; unref'd and cleared in `finally`. Poll errors are ignored.\n- the job times out under `timeoutBehavior` `'fail'`/`'kill'` (reason: `JobTimeoutError`), so the orphaned handler can stop. `'warn'` never aborts.\n\nCooperative only: aborting changes no lifecycle state, retry policy, terminal-write guard or event. A handler that ignores the signal behaves exactly as before; one that rejects with the abort reason cannot overwrite `cancelled`/`failed` (the `WHERE worker_id=? AND status='running'` guard drops its terminal write). Not aborted on runner shutdown. `isRunnerExecutionContext` and MCP-task invocations are unchanged; they receive the same `signal`.\n\n**Domain request identity / usage:** `smrt-education` still owns generation request replay and per-attempt usage. The generic store dedupe key below only reserves one nonterminal job; it never replaces domain idempotency or usage records.\n\n## Worker liveness & recovery (#1474)\n\nRecovery keys on **worker-process liveness**, never per-job heartbeat freshness (a CPU-bound synchronous handler used to starve the heartbeat and false-recover its own running jobs).\n\n- **`SmrtWorker` / `_smrt_workers`**: one lease row per runner *incarnation* (`workerId` is per-incarnation unique via `createWorkerKey`, so a restart never looks like it still owns the previous crash's jobs). `leaseExpiresAt` is a `datetime` (an integer epoch-ms column overflows `int4`/`INT32` on Postgres/DuckDB). Stage 1 writes/compares it against the host clock — the same approach the old heartbeat recovery used, so it's no more skew-sensitive than the code it replaced.\n- **`SmrtWorker.queues`** (nullable JSON `string[]`, #3902): the runner's configured `queues`, written at `registerWorker` and re-written on every lease renewal (main-loop and off-loop ticker). `SmrtWorkerCollection.liveWorkerKeysForQueue(queue)` returns fresh-lease workers that poll a queue; rows with `queues = null` (older runners, schedule runners) never match. Existing databases need `smrt db:migrate` (additive column) before an upgraded runner starts.\n- **Process-global live set** (`worker-liveness.ts`, `globalThis.__smrtLiveWorkers`): checked synchronously, so it can't be starved by a blocked loop. Covers all same-process topologies.\n- **Off-loop ticker** (`worker-liveness-ticker.ts` + `worker-liveness-thread.ts`): renews the lease off the main loop, only on a same-engine connection (SQLite through `db.reopenOptions()`, engine checked, #4978); otherwise main-loop renewal with one log. Details: [agents/worker-liveness.md](agents/worker-liveness.md).\n- **Recovery rule** (both runners): a `running` job is orphaned iff its worker is *not alive* = not in the live set **and** no fresh `_smrt_workers` lease. The live set takes precedence over a stale lease. TaskRunner also never recovers a job in its own `activeJobs`. If `_smrt_workers` is absent, recovery skips lease checks (never mass-recovers). Recovery is swept at most once per lease tick, and terminal/recovery writes use `RETURNING id` (not `rowCount`, which DuckDB/JSON adapters always report as ≥1).\n- **Lease clock**: the lease is compared against the host clock (same as the old heartbeat; fine with NTP + a 30s TTL). A dead process stops renewing and the lease expires within its TTL — that is how recovery detects death. (Instant cross-process detection via Postgres session advisory locks was prototyped on `@happyvertical/sql`'s `acquireSession()` but deferred — treating a free lock as proof-of-death false-recovers any worker legitimately in main-loop fallback mode.)\n\n## ScheduleRunner\n\nTransactional schedule admission, tenant/type scopes, dedicated queues,\noccurrence metadata, retry/slot semantics, graceful drain, and tenant-partitioned\nnonterminal job keys are documented in [safe scheduling](agents/scheduling.md).\nRun `smrt db:migrate` before using the new job provenance and dedupe-slot schema.\n\nCustom cron parser (`getNextCronDate(cron, timezone?)`): 5-field (minute hour dom month dow); `*`, ranges, lists, steps supported, each list term matched on its own. Fields match the wall clock of the schedule's IANA `timezone` (`Intl.DateTimeFormat`, DST-correct, no dependency); the re-arm passes the row's `timezone`, and a NULL/blank zone falls back to the column default `UTC`. Unknown zones throw `Invalid cron timezone`; the runner moves a row whose cron or zone is invalid to `status='error'` with `last_error`, since retrying it every poll cannot succeed. Only an omitted argument uses the host process zone (legacy; `smrt-reports` still relies on it). DST follows Vixie cron: fixed-time crons (no `*` in minute or hour) run once per day, a gap-skipped wall time runs shifted forward by the gap, a repeated one only at its first occurrence; wildcard crons follow elapsed time (gap minutes skipped, the repeated hour runs again) (#3859).\n\n## JobBuilder — Fluent API\n\n```typescript\nconst handle = await doc.background('analyze', { detailed: true })\n .delay('5m').priority('high').retries(5).queue('analysis').timeout(600000).enqueue();\n\nawait handle.wait({ timeout: 60000, pollInterval: 100 }); // polling-based\n```\n\n## Durable forge projections\n\nProvider delivery inbox, leases and checkpoints: [forge projections](agents/forge-projections.md).\n\n`bg()` is shorthand: `await doc.bg('analyze', args)` → enqueues immediately, returns JobHandle.\n\n## withBackgroundJobs(Class)\n\nMixin that adds `bg()` and `background()` to any SmrtObject. Uses WeakMap for collection caching per DB instance.\n\n## Background policy (`background-policy.ts`, S5 audit #1402)\n\nThree opt-in guards, all owned **and enforced here**. Other packages apply the\neligibility marker (`reports`, `support`, `fields`, the MCP conformance\nfixture), but nothing outside this package acts on it — `TaskRunner` is the only\nreader. In particular `@happyvertical/smrt-agents` has no reference to any of\nthese guards and does not depend on this package, so marking a method does not\nchange what the agents runtime will dispatch.\n\n- `clampRetries()` / `MAX_JOB_RETRIES` (25): a requested retry count above the\n ceiling is clamped, not rejected.\n- `assertWithinTenantCreationCap(tenantId, current, cap)` /\n `DEFAULT_TENANT_JOB_CAP` (10 000): throws `TenantJobCapExceededError` when the\n tenant's count of non-terminal jobs is already at or above the cap. Applied in\n `SmrtJobCollection.enqueueJob()` (`smrt-job.ts`), which is the single choke\n point for the builder and `ScheduleRunner`; a `null` tenant and a `cap <= 0`\n both skip the check. Deliberately not serialized — concurrent enqueues can\n overshoot by the number of in-flight creators (see the method's own comment).\n- `@backgroundEligible()` / `markBackgroundEligible()` /\n `isBackgroundEligibleMethod()`: an allowlist of methods `TaskRunner` may\n dispatch, enforced at exactly one call site (`runner.ts`, after the method\n lookup). **Restrictive, not enabling** — a class with no marked methods allows\n any of its methods, and the first mark makes the set exhaustive, excluding\n every sibling method. Adding the decorator to one method of an existing class\n is therefore a behaviour change for the rest of it.\n\n## Terminal outcomes (#3696)\n\nTerminal state is authoritative together with its versioned event. Completion,\npermanent failure, timeout, stale-worker recovery, and cancellation update the\nowned `_smrt_jobs` row and append the safe `_smrt_job_events` projection in one\ndatabase transaction. If either write fails, neither commits. Conditional\nownership/status predicates prevent a lost race from appending an event.\nBuild the event from the conditional update's returned row, not a caller\nsnapshot, and bind that update to the row's tenant. Public cancellation must\nretain ambient-tenant isolation; only explicit bypass contexts may cross it.\nRetries are deliberately excluded until a later terminal transition. Ordinary\nprogress, logs, start, and retry telemetry remain best-effort.\n\n`SmrtJobEventCollection.listTerminalOutcomes()` requires an explicit tenant\n(`null` means global), reads newest-first, scans at most 1,000 candidates, and\nreturns only the safe versioned terminal shape. Never add job arguments,\nobject IDs, results, raw errors, or stacks to that shape. Applications must\nintersect job IDs with their own authorized ownership records; queue/object\ntype/method filters narrow the projection but do not authorize it.\n\n## Retention (#2375)\n\n`_smrt_jobs` and `_smrt_job_events` are append-only in practice — `cleanup()`\nexisted but nothing ever called it, and job events (one row per log line and\nprogress tick) had no prune path at all. `src/retention.ts` contributes both to\nthe framework retention sweep in `@happyvertical/smrt-core`.\n\n- `TaskRunner` starts a sweeper by default. `retention: false` opts out;\n `retention: { intervalMs, policy, jobs }` tunes it. The **first sweep is one\n interval after `start()`, never at start** — a crash-looping worker must not\n become a delete loop, and a short-lived runner must exit having deleted\n nothing. `stop()` only clears the timer — it does **not** unregister the job\n tasks. The package entry point (`index.ts`) registers them unconditionally\n on import, so \"this process loaded `@happyvertical/smrt-jobs`\" is the\n contract that contributes them, not \"a sweeper happens to be running\";\n `unregisterJobRetentionTasks()` is the explicit opt-out for callers that\n want a clean registry (tests, teardown).\n- Windows (`DEFAULT_JOB_RETENTION`): completed/cancelled 7 days, failed 30\n days, events 30 days, 10 000 job rows per sweep. Events deliberately outlive\n the jobs they describe, so a job row removed at 7 days still has a readable\n log for another three weeks. `SmrtJobEvent.jobId` is therefore the explicit\n same-package archival exception: `@foreignKey('SmrtJob', { constraint:\n false })` retains runtime relationship metadata and its index without a\n physical database constraint that would block parent pruning.\n- `cleanup()` counts before deleting (`rowCount` is unreliable across engines)\n and honours `dryRun`, which is what makes `smrt db:prune --dry-run` an exact\n preview. Its `(status, completed_at)` predicate is indexed by\n `ensureJobsSystemTableCompatibility()`, which this collection runs on every\n `initialize()` — bootstrap cannot do it, because `_smrt_jobs` does not exist\n yet when bootstrap runs.\n- `cleanup({})` with no cutoff returns 0. It must never be read as \"delete\n everything\".\n\n## Gotchas\n\n- The shared claim/recovery projection casts both job and tenant UUIDs to strings; DuckDB otherwise returns native UUID objects. Preserve NULL for global jobs.\n\n- **Cron zone comes from the row**: `_smrt_agent_schedules.timezone` (default `UTC`), not the host `TZ`; no missed-run catch-up (fire-once-forward)\n- **At-least-once execution**: a timeout cannot preempt a running handler; timed-out jobs fail without retry but the handler keeps running — make handlers idempotent (see \"Timeouts & at-least-once\")\n- **No dead letter queue**: failed jobs stay in DB with `status='failed'` — manual intervention\n- **Forge deliveries are not SmrtJobs**: they use their own replayable\n dead-letter inbox and projection checkpoint contract. Do not enqueue provider\n deliveries as generic background jobs.\n- **Result storage**: `resultPointer` is just a string — app must implement result backend\n- **Lazy builder**: `background()` returns builder — nothing happens until `enqueue()`\n- **wait() is polling**: JobHandle.wait() polls DB every 100ms (configurable)\n- **Migrate before start()**: Both runners call core's `assertDatabaseMigratedForBuild` before polling (policy: [schema paths](../core/agents/schema-paths.md)). A missing or different record refuses production start; development warns, test databases are exempt, and the emergency override is logged. `TaskRunner.start()` throws if `_smrt_workers` is missing — run `smrt db:migrate` after upgrading. Tables are never created at runtime.\n- **Recovery is liveness-based**: don't reintroduce heartbeat-threshold recovery; a blocked event loop must not look dead (see Worker liveness section, #1474)\n\n## Transaction-bound claims\n\nUse `getJobClaim`, `assertJobClaim`, `assertJobClaimForRelease`,\n`assertFailedJobDispatch` and `assertAbandonedJobClaim` for dispatch fencing,\nrecovery and application lease release. Read [claim and recovery contracts](agents/job-claims.md)\nfor opt-in fencing, transaction affinity, liveness, exact outcome lookup and\nPGlite validation. Never infer settlement from cancellation alone.\n",
1383
1383
  "moduleDocs": [
1384
1384
  {
1385
1385
  "path": "agents/provider-loading.md",
@@ -5,10 +5,10 @@ description: "Background job processing for SMRT objects with persistence and sc
5
5
  status: "stable"
6
6
  generated:
7
7
  by: "smrt/scripts/generate-knowledge-okf.ts"
8
- at: "2026-11-16T10:32:55Z"
8
+ at: "2026-11-17T01:12:08Z"
9
9
  audience: "internal"
10
10
  evidence_level: "source-inspected"
11
- source_revision: "sha256:8e8aa23d2086bd52508dbc818c5941b3a60fe0eea3e5221f4895884545d2453d"
11
+ source_revision: "sha256:c9e849979901d47b0d101d8afe252087530328cc1da4cba5b2723dd509d51984"
12
12
  sources:
13
13
  - id: "manifest"
14
14
  resource: "https://github.com/happyvertical/smrt/blob/main/packages/jobs/package.json"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-jobs",
3
- "version": "0.62.0",
3
+ "version": "0.62.2",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Background job processing for SMRT objects with persistence and scheduling",
6
6
  "author": "HappyVertical",
@@ -54,16 +54,16 @@
54
54
  "dependencies": {
55
55
  "@happyvertical/jobs": "^0.113.0",
56
56
  "@happyvertical/logger": "^0.113.0",
57
- "@happyvertical/smrt-config": "0.62.0",
58
- "@happyvertical/smrt-core": "0.62.0",
59
- "@happyvertical/smrt-tenancy": "0.62.0",
60
- "@happyvertical/smrt-types": "0.62.0",
61
- "@happyvertical/smrt-ui": "0.62.0",
57
+ "@happyvertical/smrt-config": "0.62.2",
58
+ "@happyvertical/smrt-core": "0.62.2",
59
+ "@happyvertical/smrt-tenancy": "0.62.2",
60
+ "@happyvertical/smrt-types": "0.62.2",
61
+ "@happyvertical/smrt-ui": "0.62.2",
62
62
  "@happyvertical/sql": "^0.113.0",
63
63
  "@happyvertical/utils": "^0.113.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@happyvertical/smrt-vitest": "0.62.0",
66
+ "@happyvertical/smrt-vitest": "0.62.2",
67
67
  "@sveltejs/package": "^2.5.8",
68
68
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
69
69
  "@types/node": "24.13.6",
@@ -87,8 +87,8 @@
87
87
  "build:watch": "vite build --mode library --watch",
88
88
  "clean": "rm -rf dist",
89
89
  "dev": "vite dev",
90
- "check": "pnpm exec svelte-check --tsconfig ./tsconfig.svelte.json",
91
- "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json && node ../../scripts/svelte-check-a11y.mjs --tsconfig ./tsconfig.svelte.json && node ../../scripts/svelte-check-a11y.mjs --tsconfig ./tsconfig.svelte-test.json",
90
+ "check": "node ../../scripts/svelte-check-workspace.mjs --config ../../scripts/svelte.config.typecheck.mjs --tsconfig ./tsconfig.svelte-typecheck.json",
91
+ "typecheck": "tsc -p tsconfig.typecheck.json && tsc -p tsconfig.test.json && node ../../scripts/svelte-check-a11y.mjs --config ../../scripts/svelte.config.typecheck.mjs --tsconfig ./tsconfig.svelte-typecheck.json && node ../../scripts/svelte-check-a11y.mjs --config ../../scripts/svelte.config.typecheck.mjs --tsconfig ./tsconfig.svelte-test.json",
92
92
  "test": "vitest run",
93
93
  "test:watch": "vitest",
94
94
  "test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run optional.test.ts",