Skip to content

feat(job): opt-in per-attempt history (wheels_job_attempts) #4497

Open

Description

@bpamiri

Split out of #4483 so that change stays small.

Problem (today on develop). A job keeps one row with only its last error (lastError). When a job is retried, earlier attempts leave no trace: which server ran each attempt, when it started and ended, and how it ended.

Proposed change. An opt-in per-attempt history table:

wheels_job_attempts (jobId, attempt, claimedBy, startedAt, finishedAt, outcome, error)
  • Setting. Enabled by a setting (off by default).
  • Rows. One row is written when an attempt is claimed and finished when it ends. The outcome is completed, retried, failed, fenced, deferred (busy lease) or reaped.
  • Paths. It covers the worker path and processQueue().
  • Retention. Purged with the job's own rows.
  • Install. wheels jobs install --attempts (feat(cli): wheels jobs install migration generator + jobsAutoCreateTables #4484) includes the table.

Compatibility. Opt-in; nothing changes when it is off. The table is created on first use, like the other job tables.

Acceptance criteria.

  • With the setting on, each attempt records exactly one row with its outcome, on both processing paths.
  • With it off, no table is created and no extra queries run.

Part of a series of small, separately releasable changes for running Wheels background jobs safely on more than one server.

Activity

  1. added this to the v4.3.0 milestone on Oct 8, 2026
  2. added
    deferred
    on Oct 11, 2026
  3. bpamiri commented on Oct 11, 2026

    @bpamiri
    CollaboratorAuthor

    Feature request; planned for a later release.

  4. removed this from the v4.3.0 milestone on Oct 21, 2026
  5. bpamiri commented on Oct 28, 2026

    @bpamiri
    CollaboratorAuthor

    Maintainer-sweep disposition: deferred (not abandoned), recheck 2026-11-11.

    Reason: this is a new opt-in feature (new wheels_job_attempts table + setting + both worker paths + cross-engine coverage), explicitly parked for a later release; it is not a regression and has no community demand attached right now. No implementation exists on develop — verified: no wheels_job_attempts, no attempts setting, no --attempts flag.

    At the 2026-11-11 recheck we'll confirm whether the 4.3 line wants it; if yes, a design brief (table shape, retention, worker paths, settings) comes first. Until then the issue stays open as the record.

  6. bpamiri commented on Nov 15, 2026

    @bpamiri
    CollaboratorAuthor

    Rechecking after the 2026-11-11 date.

    Still no implementation on develop 8570dee75: no wheels_job_attempts table, no attempts setting or flag, no migration, and no CLI read path. vendor/wheels/JobSchema.cfc defines four job tables (wheels_jobs, wheels_job_hosts, wheels_job_schedules, wheels_job_locks). wheels_jobs has an attempts counter, lastError, claimedBy, claimToken, heartbeatAt, failedAt and completedAt, but only current/last state.

    Overlapping behavior today:

    • attempts increments on claim and drives maxRetries/backoff; retryFailed() resets attempts to 0; lastError is only the latest; a retry overwrites the previous error.
    • jobsOnFailure/onFailure receive {jobId, jobClass, queue, attempt, maxRetries, isFinal, error} once, but do not persist history.
    • Claim fencing uses claimToken/claimedBy; fenced attempts only write a wheels_jobs log entry; reaped/deferred outcomes update the job row.
    • wheels jobs status reports counts; wheels jobs install generates the schema from JobSchema; retry, purge and monitor CLI verbs are still docs/cli: wheels jobs ... worker CLI is advertised (observability guide + root CLAUDE.md) but does not exist #3090; purgeCompleted() deletes completed job rows. None of these stores per-attempt history.

    Smallest shippable slice: add the JobSchema table (jobId, attempt, claimedBy, startedAt, finishedAt, outcome, error; jobId+attempt key/index), an opt-in setting defaulting off, writes at claim and at every terminal/reap/fence/defer outcome, purge retention, and a read helper/CLI. That is roughly 2–3 engineer-weeks including cross-engine/tenant tests, schema/install changes and docs; ongoing maintenance is real, and it introduces a new public schema surface and migration/installation story.

    Recommendation: defer, not close. No implementation or demand has appeared in the issue history; the attempt counter and failure hooks cover the basic operational signal, while per-attempt history is a public schema feature with real retention/testing cost and no agreed read API. Leave it open as the record; a short design brief (keys, retention, worker paths, read shape) should precede implementation when a concrete operator need appears.

    I could not verify any demand or support signal beyond the issue history; there is no implementation to exercise.

  7. bpamiri commented on Dec 1, 2026

    @bpamiri
    CollaboratorAuthor

    Decision: deferring again — not closing. New recheck: 2026-03-01.

    Re-verified against current develop (7a3ff4c33), not assumed from the last review

    • Still no implementation. No wheels_job_attempts table, no jobAttempts-style setting, and no flag anywhere in the tree — git grep -i "wheels_job_attempts\|jobAttempts\|attemptHistory\|job_attempts" returns nothing.
    • The adjacent machinery is real and already covers the reporting shape, which is exactly why this keeps looking nearly-done: retry/attempt semantics and jobsOnFailure in vendor/wheels/Job.cfc, schema in JobSchema.cfc, worker/heartbeat/fencing in JobWorker.cfc, and five wheels jobs commands (retry, status, monitor, purge, work).
    • None of that records per-attempt history. A job that fails three times and succeeds on the fourth leaves no trace of the two failures once state moves on. That is a genuine gap, not a misunderstanding of what exists.
    • The smallest shippable slice is still a new public schema surface — a per-attempt table plus its retention/pruning story — with ongoing maintenance cost for every supported database. That cost is what keeps losing to the value, and nothing has changed that.

    Reopen condition — this is the decision, not the date

    Build this if per-attempt history becomes necessary for diagnosing a real failure that retry/attempt semantics cannot explain.

    If a report arrives where someone cannot answer "what actually happened on attempts 1 and 2" from logs, job state, or the wheels jobs commands, that report is the trigger — link it here and this becomes a scoped bug fix with a concrete observer rather than a schema proposal. Absent such a report, the next recheck should ask the same question and expect the same answer; re-deferring without a new trigger is the correct outcome, not a failure to act.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferred

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions