Harden closed-loan trainer — run lock + per-loan idempotency

Featurekamo-shared-library
Shipped
July 15, 2026 at 3:25 AM UTC
Author
Kamo
Commit
e4d3e2c

- ClosedLoanTrainingRun.claim(): atomic conditional UPDATE that takes ownership of a run only when it is not already RUNNING or its heartbeat is stale (previous owner died). Stops two workers — a double-clicked control, run-all overlapping a per-org kick, or a second service replica — from walking the same org's loans at once and duplicating corrections / garbling counters. - **************** a closed loan is ground truth, so once labeled there is nothing to re-learn from re-reading its documents. The trainer skips marked loans, which keeps the repeated passes (that exist to catch newly-closed loans) from duplicating labels and skewing the corpus toward frequently-reprocessed loans.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing