santifer/career-ops · warning

Removed stale reservation sentinel

Error message

Removed stale reservation sentinel: ${name}

What it means

A warning from verify-pipeline.mjs (Check 8, sentinel GC) that a `{NNN}-...-RESERVED.md` file in reports/ — created by reserve-report-num.mjs to claim report slots during parallel fan-outs — is older than SENTINEL_MAX_AGE_MS (~4h) and has been deleted. This implements the documented rule that stale sentinels are garbage-collected after 4h; the reservation it represented is dead and the slot is free again.

Solutions

  1. Nothing to fix — the removal is the intended GC; verify the corresponding run's reports were or weren't produced.
  2. If a fan-out is still in flight, re-reserve before continuing: `node reserve-report-num.mjs --count N` (do this right before spawning).
  3. If the worker died, inspect batch/ outputs, fix the failure, and re-run the affected evaluations with fresh reservations.
  4. Use `node reserve-report-num.mjs --release <range>` on abandonment instead of letting sentinels age out.

Example fix

// before: abandoned reservation
node reserve-report-num.mjs --count 8   # worker crashed here
// after: release when the fan-out is cancelled
node reserve-report-num.mjs --release 042-049
Defensive patterns

Strategy: retry

Validate before calling

const ageMs = Date.now() - statSync(sentinelPath).mtimeMs;
if (ageMs > 4 * 3600e3) { unlinkSync(sentinelPath); reReserveBeforeFanout(); }

Prevention

When it happens

Trigger: Running `node verify-pipeline.mjs` when reports/ contains a -RESERVED.md whose mtime exceeds the max age — a reservation from a batch run that crashed after reserving (e.g. #749-race protection) and never wrote the real report or called `reserve-report-num.mjs --release`.

Common situations: A parallel fan-out worker died before writing its report; an operator reserved a range then abandoned the run; long-running evaluation exceeded 4h so its live reservation got collected; machine reboot orphaned sentinels from a previous session.

Related errors


AI-assisted analysis of santifer/career-ops@e7abd431fc (2026-09-16). Data as JSON: /api/errors/2e3174b28c44e622. Report an issue: GitHub.

Appendix: source

Thrown at verify-pipeline.mjs:251

if (boldScores === 0) ok('No bold in scores');

// --- Check 8: Stale report-number sentinels (GC) ---
// reserve-report-num.mjs drops NNN-RESERVED.md files in reports/ when a
// number is claimed.  If the process crashed before writing the real report
// and deleting the sentinel it will linger.  Sentinels older than 4 h are
// stale; remove them here so they don't skew the next slot allocation.
const SENTINEL_MAX_AGE_MS = 4 * 60 * 60 * 1000;
let staleSentinels = 0;
if (existsSync(REPORTS_DIR)) {
  const now = Date.now();
  for (const name of readdirSync(REPORTS_DIR)) {
    if (!name.endsWith('-RESERVED.md')) continue;
    const full = join(REPORTS_DIR, name);
    try {
      const { mtimeMs } = statSync(full);
      if (now - mtimeMs > SENTINEL_MAX_AGE_MS) {
        unlinkSync(full);
        warn(`Removed stale reservation sentinel: ${name}`);
        staleSentinels++;
      }
    } catch {
      // Already gone between readdir and stat — fine.
    }
  }
}
if (staleSentinels === 0) ok('No stale reservation sentinels');

// --- Check 9: Duplicate reports for the same company+role (#1425) ---
// Two concurrent evaluators can each write a report for the same role.
// merge-tracker dedups the TRACKER, but nothing watched reports/ itself.
// Warning-level, not error: duplicates can be legitimate (re-evaluation
// after a JD change).
const REPORT_FILE_RE = /^(\d+)-(.+)-\d{4}-\d{2}-\d{2}\.md$/;
// Shares normalizeTextKey with Check 2 so the two checks fold text the same
// way (#2393). That is where the guarantee ends: this check keys off the
// FILENAME slug, already ASCII by the time a report is written, while Check 2

View on GitHub (pinned to e7abd431fc)