Skip to content

fix(cli): let wheels jobs work run each job with its own timeout - #4518

Merged
bpamiri merged 2 commits into
developfrom
peter/jobs-work-timeout
Oct 8, 2026
Merged

bpamiri merged 2 commits into
developfrom
peter/jobs-work-timeout

Conversation

@bpamiri

@bpamiri bpamiri commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

wheels jobs work cut every job off at 300 seconds. The jobsProcessNext bridge command it polls defaulted to timeout=300, and the worker runs a job for Min(its own timeout, the poll's timeout), so a job with this.timeout = 900 was stopped at 300 s. There was no option to change it.

Fix

  • CliBridge.jobsProcessNext sets up the worker the way processQueue() does: perJobTimeout = true, so each job is claimed and run with its own class's timeout, recorded on the row as claimTimeout. A timeout param is now a cap (timeoutCap). A row that recorded no claimTimeout is still never reaped inside 300 seconds (legacyReapTimeout). JobWorker is unchanged.
  • wheels jobs work --job-timeout=<seconds> is the new cap option. It isn't --timeout: that is the LuCLI runtime's own root option, which on runtimes without the module-timeout fix is taken before dispatch and stops the whole worker (the same reason wheels test uses --test-timeout). 0 (the default) sends nothing, so each job uses its own timeout. A negative value is rejected with Wheels.InvalidArguments. The worker banner prints which mode is in effect, and the option shows in wheels jobs --help and in the usage line.
  • Docs: the background-jobs guide (v4.2) and the consumer AI jobs.md (plus its wheels new template copy). Also a changelog.d fragment.

Existing jobs with the default 300-second timeout behave as before.

Tests

  • vendor/wheels/tests/specs/jobs/CliJobsProcessNextTimeoutSpec.cfc calls the bridge command directly and asserts the timeout each claim records (scaled: no 300-second wait):
    • with no cap, a this.timeout = 900 job records 900 (RED on develop: 300);
    • with timeout=120, it records 120;
    • a default-timeout job stays at 300.
  • JobsCommandSpec adds --job-timeout parsing and validation, and checks that the worker sends &timeout=N only when the option is given (RED on develop: 4 of the 5 new specs fail). A guard spec checks that no jobs option is named after a LuCLI root option (--timeout, --env, --envfile, …) and that --help lists --job-timeout.
  • Checked by hand on the real wheels runtime: wheels jobs work --job-timeout=-1 reaches the module and is rejected with the module's own message; --job-timeout=5 gets through parsing to server detection.

Local results:

  • Lucee 7 + SQLite, full core suite: 7234 pass / 0 fail / 0 error (592 bundles, internal included).
  • Adobe 2023 + SQLite, jobs + cli: 242 + 258 pass, 0 fail / 0 error.
  • CLI suite: 2445 pass / 0 fail / 0 error (after the rename; core cli + jobs + internal on Lucee 7 re-run green too).
  • Complexity gates (vendor/wheels and cli/lucli): pass.

Fixes #4517

🤖 Generated with Claude Code

The jobsProcessNext bridge command behind `wheels jobs work` defaulted to
timeout=300, and the worker runs a job for Min(its own timeout, the poll's),
so every job was cut off at 300 seconds whatever its this.timeout.

The bridge now sets up the worker the way processQueue() does: each job is
claimed and run with its own class's timeout (recorded as claimTimeout),
and `wheels jobs work --timeout=<seconds>` passes an explicit cap. Rows that
recorded no claimTimeout are still never reaped inside 300 seconds.

Documents --timeout in the background-jobs guide and the consumer AI docs.

Fixes #4517

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
@bpamiri bpamiri added this to the v4.2.0 milestone Oct 8, 2026
@bpamiri

bpamiri commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Review: head 2baac3c. REQUEST CHANGES: one HIGH, the option name. The server-side fix is right.

HIGH: --timeout collides with LuCLI's global --timeout

  • The collision. LuCLI's picocli root owns a global option (LuCLI.java: @Option(names = {"--timeout"}, … description = "Fail if the command runs longer than this many seconds (0 = no timeout)")). On runtimes without the module-timeout fix (LuCLI REGEX to Match Email Addresses Fails (/wheels/view/text.cfm) #130), it consumes --timeout before the module is dispatched. wheels test already works around exactly this: it documents and accepts --test-timeout because a plain --timeout "only reaches this command on LuCLI builds that include the module-timeout fix" (Module.cfc ~511–521, wheels test --timeout=N on the terminal never reaches the command (LuCLI's global --timeout takes it) #3678).

  • What a user gets. On such a runtime, wheels jobs work --timeout=600, as the new docs, changelog and .ai/jobs.md show, does not cap jobs at 600 s:

    • the module never sees the option, so jobs run with their own timeout;
    • LuCLI applies it as a whole-command limit, so the long-lived worker loop is killed after 600 s.

    That's the opposite of what the option promises, and it's silent.

  • Why the specs don't catch it. JobsCommandSpec calls $parseJobsArgs() / jobs() directly, below LuCLI's dispatcher.

  • Fix: follow the wheels test precedent:

    • name the terminal option something the root parser doesn't own (e.g. --job-timeout=<seconds>, via .accept("job-timeout") or as the primary name);
    • keep timeout only as the MCP / fixed-runtime spelling, if at all;
    • update the usage line, the description, the docs, .ai/jobs.md (both copies) and the changelog to the new spelling;
    • add an argv-level check if the CLI suite has one for --test-timeout.

Verified

  • The original bug is closed. CliBridge.jobsProcessNext() sets perJobTimeout = true, timeoutCap (from the timeout param, > 0 only) and legacyReapTimeout = Max(cap, 300), as processQueue() does.
    • JobWorker claims with the candidate's own class timeout, capped by timeoutCap, and records it as claimTimeout.
    • $runClaimedJob passes that through as the run's timeout, so a this.timeout = 900 job runs 900 s and is reaped on a 900-based window.
    • The spec asserts the recorded claimTimeout (900 with no cap, 120 with a 120 cap, 300 for a default job). That's the right observable: the same value drives the run cap and the reaper.
  • Reaper. pollTimeout (300, or the cap) only matters for rows with no claimTimeout, and legacyReapTimeout keeps those from being reaped inside 300 s.
  • CLI. It sends &timeout= only when > 0, rejects negatives, prints the effective policy, and defaults to 0, meaning each job's own.
  • Conflict. feat(job): token-gated /wheels/jobs/tick route and wheels jobs tick #4516 edits the same usage line, a one-line conflict for whichever lands second.

Evidence: I haven't read narrowed matrix 37854150638 and PR CI yet. I'll read them on the next head, since the rename touches the CLI surface. This verdict rests on the source.

--timeout is the LuCLI runtime's own root option ("fail if the command runs
longer than N seconds"). On runtimes without the module-timeout fix it is
taken before dispatch, so `wheels jobs work --timeout=600` would stop the
whole worker after 600 seconds instead of capping each job. Use
--job-timeout, as `wheels test` uses --test-timeout, and add a spec that
no jobs option is named after a LuCLI root option.

Refs #4517

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
@bpamiri

bpamiri commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Final review: head 7b3d934. APPROVE (ready).

  • HIGH resolved. The terminal option is now --job-timeout, in the argspec, the parser (parsed["job-timeout"] → opts.jobTimeout), the usage line, the startup banner, the specs, the 4.2 jobs guide, both .ai/jobs.md copies and the changelog. Its description says why it isn't --timeout (that's the runtime's own option and stops the whole worker). LuCLI's root parser therefore can't take it before dispatch, on any runtime.
  • Bridge parameter. It stays timeout (&timeout=<n> to jobsProcessNext). That's server-side, not argv, so there's no collision. jobs is hidden from MCP, so no second spelling is needed.
  • Guard spec. jobs --help lists --job-timeout, and no jobs option is named after a LuCLI root option (timeout, env, envfile, verbose, debug, timing, whitespace). That closes the class of bug, not just this instance.
  • Server-side fix unchanged since 2baac3c, and verified then.

Evidence:

  • Narrowed matrix 37854150638 at 2baac3c. The vendor code is identical at 7b3d934; the delta is CLI and docs only.
    • 20/20 legs green, 0 fail / 0 error, 592 bundles;
    • CliJobsProcessNextTimeoutSpec 3/3 on every leg;
    • RustCFML 7210/0/0.
  • PR CI at 7b3d934: 28 pass, 0 fail, 2 skipped.
    • Deploy CLI tests + verb smoke: 2446 pass, 0 fail, 0 error, including the renamed JobsCommandSpec cases and the root-option guard;
    • CLI suite and Lucee 7 + SQLite (LuCLI) both pass.
  • Conflict. feat(job): token-gated /wheels/jobs/tick route and wheels jobs tick #4516 edits the same usage line, a one-line conflict for whichever lands second.

@bpamiri
bpamiri merged commit 7f4dc07 into develop Oct 8, 2026
33 checks passed
@bpamiri
bpamiri deleted the peter/jobs-work-timeout branch October 8, 2026 22:56
bpamiri added a commit that referenced this pull request Oct 8, 2026
Two merged changes:

- #4499: wheels jobs install writes a migration that creates (or tops
  up) the job tables from the running app's own schema, and
  set(jobsAutoCreateTables = false) turns off runtime CREATE/ALTER
  (then a missing table throws Wheels.Job.SchemaMissing). Restructure
  "The shared schema" to lead with install + the setting as the
  recommended multi-server path, keeping the hand-written DDL as the
  fallback; replace the "planned" aside; add an upgrade entry.
- #4518 (fixes #4517): wheels jobs work now runs each job for its own
  timeout, with --job-timeout to cap, instead of stopping every job at
  300 s. Rewrite the long-timeout caution accordingly and add an
  upgrade entry.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
bpamiri added a commit that referenced this pull request Oct 8, 2026
The #4518 line in background-jobs.mdx said --timeout stops the whole worker outright; it only does so on CLI runtimes where LuCLI's root option takes it. Match the wording used in the multi-server guide and upgrade entry.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
bpamiri added a commit that referenced this pull request Oct 9, 2026
* docs(web): add the 4.2 "Running Jobs on Multiple Servers" guide

A companion to Background Jobs for when several app servers process one
wheels_jobs table. It documents the multi-server features already on
develop and marks the parts still to come.

Covered (merged):
- the guarantees: one recorded outcome per attempt (per-claim fencing),
  at-least-once for idempotent jobs, and why perform() must be idempotent
- heartbeat() for long jobs, and Wheels.Job.Fenced
- this.idempotent and the interrupted status (at-most-once)
- set(jobsMaxConcurrentPerHost) and the host name override
- runner options: the CLI worker, a scheduled processQueue(), JobRunner.tick()
- draining a server before a deploy with wheels jobs drain --wait / resume
- the shared schema to apply by hand on a live multi-server database
- clock skew and NTP

Marked as not-yet-built, each with its tracking issue: the token-gated
/wheels/jobs/tick route, a single UTC database clock, recurring
schedules, exclusive jobs and concurrency keys, lifecycle hooks, and
wheels jobs install.

Links both ways with Background Jobs, adds the sidebar and index entries,
and records the heartbeat/idempotency, per-host cap, and jobs drain/resume
changes on the 4.1 to 4.2 upgrade guide.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): correct the multi-server jobs guide per accuracy review

Fixes from rev1-r1's pass on the new guide and the 4.1 to 4.2 upgrade
entry:

- heartbeat() does not extend a job's timeout. The timeout is a hard cap
  per attempt (perform() runs in a bounded thread and is stopped when it
  elapses); heartbeat() only records liveness. Reframed the section and
  the upgrade entry, and noted the lease-renewal (#4496) and
  dead-worker-detection (#4502) work that builds on it.
- The heartbeatAt column is TIMESTAMP on PostgreSQL, CockroachDB, Oracle
  and H2 (they have no DATETIME); the manual DDL now gives per-database
  types.
- Documented purge(status="interrupted") for pruning interrupted rows,
  instead of "use your own SQL".
- Job timestamps are written with each server's application clock
  (Now()), not the database clock; corrected the clocks section.
- Dropped "unless you turn it off" from the upgrade note: turning the
  auto-schema off needs jobsAutoCreateTables, which isn't built yet.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): fold the merged processQueue-through-worker change into the guide

processQueue() now runs through the job worker (#4495), so it reaps
stale jobs, honours the per-host cap, and stops starting new jobs on a
draining host. Document that as fact instead of a forward reference,
note that it still doesn't refresh the host registry's lastSeenAt the
way tick() does (its running count and drain state are read live), and
drop #4495 from the "Coming in 4.2" list now that it has landed.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): phrase the heartbeat lease-renewal note as forward-looking

#4496 as approved sets a job's lease expiry at acquire and does not
renew it from heartbeat() yet; the renewal is wired in #4496's develop
merge. Word the liveness aside as "once #4496 lands, heartbeat() also
renews an exclusive job's lease" so it's accurate until #4496 merges,
then it becomes plain fact.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): document recurring job schedules (#4493)

Fold the merged recurring-schedules feature into the multi-server jobs
guide as a full section, replacing the placeholder:

- The config/schedules.cfm DSL: schedule().job().cron() / .every(),
  .timezone(), .catchUp() / .catchUpWindow(), .queue()/.priority()/
  .data()/.enabled(). wheels new doesn't create the file.
- Running schedules with new wheels.JobScheduler().enqueueDue(): each
  slot carries a uniqueKey, so calling it on every server yields one job
  per slot.
- Catch-up ("latest" default within catchUpWindow, "none"), the
  wheels_job_schedules table, code-vs-db schedule sources, and the
  java.time/DST notes for non-UTC time zones.

Also correct the Background Jobs page, which said Wheels has no
recurring schedule, to point here, and add a 4.1 to 4.2 upgrade entry.
Remove recurring schedules from the "Coming in 4.2" list.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): mark the planned automatic schedule runner

enqueueDue() is called manually today. Note the planned schedule-runner
wiring: JobRunner.tick() and the CLI worker's poll will call it every
jobsScheduleCheckSeconds (default 30), so a running worker fires
schedules without a separate call. Clearly marked as not built yet.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): note the uniqueKey index on old SQL Server levels (#4494)

Fold in the improved SQL Server guidance: the filtered unique index
needs compatibility level 100 or higher. Below that, either raise the
level or use a plain unique index, but only once every server runs 4.2
(a plain index allows one NULL, so a 4.1 server writing NULL keys would
collide). The framework's warning and Wheels.Job.UniqueKeyUnavailable
now name the failed step and the per-database fix. Added to the guide's
schema section and the 4.1 to 4.2 upgrade entry; removed from
"Coming in 4.2".

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): correct processQueue's skipped claim and add the fenced count

Since #4495 routed processQueue() through the worker, a row another
poller claims first is no longer counted as skipped — the atomic claim
just fails and the loser moves on. Fix the stale "shows up in the
skipped count" parenthetical, and add the fenced count (a current
field) to the result-shape comment, with a pointer to the fencing
guarantee. (leasesLost and the redefined skipped come with #4496.)

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): document exclusive jobs and concurrency keys (#4496)

Fold in the merged lease-lock feature:

- New "Exclusive jobs and concurrency keys" section: this.exclusive,
  this.concurrencyKey, and concurrencyKeyFor(data) (the method wins),
  the wheels_job_locks lease, a busy lease putting the job back to
  pending (counted as skipped), leasesLost, and the never-making-
  progress caution.
- heartbeat() now renews an exclusive job's lease: flipped the
  forward-looking aside to plain fact.
- Background Jobs: processQueue()'s result gains leasesLost, and its
  skipped/fenced/leasesLost counts are explained with links.
- Added a 4.1 to 4.2 upgrade entry; noted wheels_job_locks and
  wheels_job_schedules as cheap auto-create tables; removed exclusive
  jobs from "Coming in 4.2".

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): correct the lease window source and soften the renewal wording

Per rev1-r1: the exclusive-job lease window is sized from the timeout
the job was CLAIMED with (the claimTimeout passed to $acquireJobLease),
not this.timeout — they coincide only under processQueue. Reword to
"the timeout it was claimed with plus the reap grace", matching the
reaper language. And because that window outlasts the hard per-attempt
timeout cap, the lease can't actually expire mid-run today, so drop the
"expire out from under it" framing: heartbeat lease renewal is
groundwork, like its effect on the reaper.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): document job lifecycle hooks and the failure hook (#4498)

Fold in the merged lifecycle-hooks feature:

- New "Lifecycle hooks and failure handling" section: beforePerform/
  afterPerform (run under the timeout; a throw fails the attempt),
  onSuccess(result) / onFailure(error, attempt, isFinal) (best-effort,
  after the outcome is recorded), isFinal covering reaped and
  interrupted jobs, the app-wide set(jobsOnFailure=...) hook with its
  data-free struct, and the stored wheels_jobs.result column.
- Added the result column to the schema table and DDL.
- Added a 4.1 to 4.2 upgrade entry.
- Removed the now-empty "Coming in 4.2" section (remaining placeholders
  live in their own inline asides).

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): fix jobsOnFailure signature, var scoping, and the result cap

Per rev1-r1 on the #4498 fold:
- jobsOnFailure is invoked with a named `event` argument, so the hook
  method must declare `function report(required struct event)`. Show
  the signature in the guide and note it in the upgrade entry.
- Use `var order` in the ChargeCardJob example.
- The stored result cap is 4000 characters on SQL Server but 4000 UTF-8
  bytes on VARCHAR / Oracle VARCHAR2; reword to say so.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): clarify the result cap is a byte bound, not VARCHAR byte semantics

Per rev1-r1: only Oracle VARCHAR2 counts bytes; PG/MySQL/SQLite VARCHAR count characters, and the code caps at 4000 UTF-8 bytes there as a safe bound.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): heartbeats shorten dead-worker detection (#4507)

The groundwork the heartbeat section pointed at has landed: a job that
heartbeats is now reclaimed once its beats stop for a heartbeat grace,
even inside its timeout, instead of waiting out twice the timeout.

- Reframe the heartbeat section from "groundwork" to the real
  behaviour: the grace is jobsHeartbeatGraceSeconds (default 300, floor
  30, 0 = off) or this.heartbeatGrace; a job that never heartbeats
  keeps the full claim window; timeout stays the hard cap. Give the
  example a long timeout so the grace matters.
- The exclusive-job lease is renewed by the grace on each beat, so the
  lease and the reclaim run on one clock; retitle and update the aside.
- Drop the #4502 forward reference (it's this change) and add a 4.1 to
  4.2 upgrade entry.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): qualify the long timeout and the lease-vs-reclaim windows

Per rev1-r1 on the #4507 fold:
- MEDIUM: this.timeout is only the requested cap; the wheels jobs work
  worker caps every job at 300 s (Min(job, workerCap) with workerCap
  defaulting to 300 and this.perJobTimeout false), so a 3600 s job is
  still stopped at 300 s under the stock worker. Added a caution: run a
  long job through processQueue(timeout=) or JobRunner.tick(timeout=).
- LOW: the exclusive lease is renewed to grace + max(60, grace) (600 s
  at the default), which outlasts the reclaim grace (300 s), so the
  claim and the lease don't "lapse together" — the reclaim happens
  first and the old lease frees shortly after. Reworded the aside and
  the exclusive-jobs line.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): sharpen the runner cap and lease-window details

Per rev1-r1:
- processQueue() already honours a job's own timeout (perJobTimeout
  mode), so the timeout= arg is optional and only lowers the cap; only
  wheels jobs work caps at 300. Reword and link #4517, which tracks the
  CLI cap.
- The exclusive lease renews to grace + max(60s, grace) — ~2x the grace
  (600s at the default), not "a little longer". After a reclaim the old
  lease frees about one grace later, and the retry waits deferred
  without spending an attempt. Reword the aside and the exclusive-jobs
  line.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): correct the schedule-runner placeholder default to 15

Per rev1-r1 reading the #4509 branch: jobsScheduleCheckSeconds defaults to 15, not 30; processQueue() also runs schedules (through the worker); and a draining host still enqueues due slots to run elsewhere. Still marked not-built-yet until #4509 merges.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): document wheels jobs install, and the fixed worker timeout

Two merged changes:

- #4499: wheels jobs install writes a migration that creates (or tops
  up) the job tables from the running app's own schema, and
  set(jobsAutoCreateTables = false) turns off runtime CREATE/ALTER
  (then a missing table throws Wheels.Job.SchemaMissing). Restructure
  "The shared schema" to lead with install + the setting as the
  recommended multi-server path, keeping the hand-written DDL as the
  fallback; replace the "planned" aside; add an upgrade entry.
- #4518 (fixes #4517): wheels jobs work now runs each job for its own
  timeout, with --job-timeout to cap, instead of stopping every job at
  300 s. Rewrite the long-timeout caution accordingly and add an
  upgrade entry.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): tighten the jobs-install schema notes

Per rev1-r1:
- Wheels.Job.SchemaMissing is thrown only for a missing wheels_jobs
  (and wheels_job_locks for exclusive jobs); a missing host-registry or
  schedules table just turns that feature off with a logged note.
- Warn that the install migration's down() is destructive: it drops all
  four job tables, including adopted ones, and every job in them.
- The --job-timeout note: --timeout stops the whole worker only on some
  CLI runtimes (where LuCLI's root option takes it), not universally.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): soften the --timeout worker note to runtime-dependent

The #4518 line in background-jobs.mdx said --timeout stops the whole worker outright; it only does so on CLI runtimes where LuCLI's root option takes it. Match the wording used in the multi-server guide and upgrade entry.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): document the /wheels/jobs/tick route (#4516)

Fold in the merged token-gated tick route, replacing the placeholder
with a real "Drive it over HTTP: the tick route" subsection:

- POST /wheels/jobs/tick runs one JobRunner.tick() and returns JSON.
- The token is the boundary: 404 until set(jobsRunnerToken = "..."),
  403 without the right X-Wheels-Jobs-Token (constant-time), ?token=
  only with jobsRunnerTokenInQuery; any forwarding header is refused, so
  it's called on the server itself, not through a proxy. Answered before
  routing; overlapping ticks skipped.
- wheels jobs tick runs one tick from the CLI.
- Add a 4.1 to 4.2 upgrade entry.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): schedules run from the worker (#4509); tick-route job limits

- #4509: a running worker checks schedules itself — wheels jobs work,
  processQueue() and JobRunner.tick() each enqueue due slots as they
  poll, at most once every jobsScheduleCheckSeconds (default 15, 0 =
  off) per application. Rewrite "Running the schedules" so enqueueDue()
  is only for when nothing polls the queue; note the draining-server
  behaviour and tick()'s scheduled count; update the upgrade entry.
- #4516 review (rev1-r1): the tick route calls tick() with no args, so
  each call reaps, enqueues due schedules and runs at most ONE job
  (capped at 300 s), with no request parameter for either — say so and
  point volume at wheels jobs work or a CFML tick(maxJobs=n). Note GET
  and POST are both accepted.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): link #4520 from the tick-route one-job-per-call note

The route runs one job per call today; #4520 will make its batch size and timeout configurable. Both orch1 and rev1-r1 asked for the forward link.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): job timestamps on the database's UTC clock (#4486)

The last multi-server piece. Rewrite "Clocks and skew" from "each
server's own clock, keep NTP tight" to the real behaviour: wheels.JobClock
keeps job timestamps on the database's UTC clock (read ~once a minute,
skew-corrected, compared in SQL), so skewed or differently-zoned servers
no longer disagree about stale/due. Document that H2 and SQLite use the
server's own UTC (H2 needs a UTC JVM); the CFML API stays local
(enqueueAt converts, status/stats convert back); and the install
migration converts pre-4.2 rows once via this.convertLocalOffsetMinutes
in one transaction with a marker (idempotent; SQLite skipped). Add the
upgrade entry.

With every placeholder now folded, this closes the guide.

Closes #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

* docs(web): spell out the UTC conversion upgrade path

Per rev1-r1, enrich the pre-4.2 timestamp conversion guidance (the
aside and the upgrade entry), from the generated migration comment and
#4521's changelog:

- The drain alternative: upgrade with the queue empty (no pending/
  processing jobs) and leave convertLocalOffsetMinutes at 0.
- The cost of doing neither on a non-UTC server: a delayed job runs
  early/late by the offset, and on a server behind UTC an in-flight job
  looks stale and is reclaimed and run again.
- Servers already on UTC (and SQLite) need neither.
- The offset sign: -300 for UTC-5, 60 for UTC+1.

Refs #4485

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>

---------

Signed-off-by: Peter Amiri <peter@alurium.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): wheels jobs work caps every job at 300 seconds instead of its own timeout

1 participant