[object Object]

← back to Rentv

pr/jobs: Cody gate — dedup the convergence-halt admin task. Concurrent workers both hitting duplicate_controller, or repeated re-arm→halt cycles, would pile up stale OPEN 'Coverage research halted' tasks (no auto-close path). Now checks for an existing open halt task first (count-query idiom) → at most one at a time. Still best-effort try/catch

eed7cbc858f02e749853a451223df1049cd145fd · 2026-08-05 23:55:51 -0700 · Steve

Files touched

Diff

commit eed7cbc858f02e749853a451223df1049cd145fd
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Aug 5 23:55:51 2026 -0700

    pr/jobs: Cody gate — dedup the convergence-halt admin task. Concurrent workers both hitting duplicate_controller, or repeated re-arm→halt cycles, would pile up stale OPEN 'Coverage research halted' tasks (no auto-close path). Now checks for an existing open halt task first (count-query idiom) → at most one at a time. Still best-effort try/catch
---
 src/pr/jobs/index.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/pr/jobs/index.js b/src/pr/jobs/index.js
index 8ad723bb..968b6337 100644
--- a/src/pr/jobs/index.js
+++ b/src/pr/jobs/index.js
@@ -530,7 +530,11 @@ const handlers = {
       // sweep_dry, round_cap, budget_exhausted) don't create a task — they're not anomalies.
       if (reason === 'pending_stuck' || reason === 'duplicate_controller') {
         try {
-          await require('../services/tasks').create({
+          // Dedup: at most ONE open "research halted" task at a time — otherwise concurrent workers
+          // (both seeing >1 controller) or repeated re-arm→halt cycles would pile up stale open tasks.
+          const openHalts = Number((await db.one(
+            `SELECT count(*)::int AS n FROM pr_tasks WHERE status='open' AND title LIKE 'Coverage research halted:%'`, [])).n);
+          if (openHalts === 0) await require('../services/tasks').create({
             title: `Coverage research halted: ${reason} (round ${round}, ${cov.pct}% coverage)`,
             detail: reason === 'pending_stuck'
               ? 'A research job appears wedged in queued/running — check pr_jobs for a stuck job, then re-arm convergence from /admin/pr-intelligence/settings.'

← 35976af2 pr/jobs: surface anomalous convergence halts as an admin tas  ·  back to Rentv  ·  auto-save: 2026-08-06T00:16:57 (7 files) — data/deals-regist a57db1ed →