← back to AbramsOS
abramsos: fix claims-autopilot scheduler — separate alert error from fill error
6f0e9fc84f057878e6e7c37ed46a78e5b3c2c75d · 2026-08-19 04:06:16 -0700 · Steve Abrams
- George 401 (missing GEORGE_BASIC_AUTH) no longer masks fill as 'FAILED'
- Alert failures log as WARN so fill success is visible
- Add CNCP parking-lot fallback: urgent claims (deadline ≤7d) posted to
http://localhost:3333 automatically, no George cred needed
Files touched
Diff
commit 6f0e9fc84f057878e6e7c37ed46a78e5b3c2c75d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Aug 19 04:06:16 2026 -0700
abramsos: fix claims-autopilot scheduler — separate alert error from fill error
- George 401 (missing GEORGE_BASIC_AUTH) no longer masks fill as 'FAILED'
- Alert failures log as WARN so fill success is visible
- Add CNCP parking-lot fallback: urgent claims (deadline ≤7d) posted to
http://localhost:3333 automatically, no George cred needed
---
lib/scheduler.js | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/lib/scheduler.js b/lib/scheduler.js
index 3d1d73a..b1519ac 100644
--- a/lib/scheduler.js
+++ b/lib/scheduler.js
@@ -89,16 +89,47 @@ async function sendDailyDigest() {
}
async function runClaimsAutopilot() {
+ // Stage/fill pass — failure here is a real problem, log as FAILED.
+ let r;
try {
- const r = await autopilot.autoProcess();
+ r = await autopilot.autoProcess();
logLine(`claims-autopilot: staged=${r.staged.length} automatic=${r.automatic.length} already=${r.already.length}` +
(r.profile_missing.length ? ` PROFILE-MISSING=${r.profile_missing.join(',')}` : ''));
- // Alert is self-throttled and no-ops if George isn't configured — safe to always call.
+ } catch (err) {
+ logLine(`claims-autopilot FAILED: ${err.message}`);
+ return;
+ }
+
+ // Alert pass — George 401/config issues are expected until cred is set; log as WARN, not FAILED.
+ // Also push urgent items to CNCP parking lot as a local fallback so deadlines are never silent.
+ try {
const a = await claimsAlert.sendClaimsAlert();
logLine(`claims-alert: ${a.sent ? `SENT total=${a.total} urgent=${a.urgent}` : 'skipped — ' + a.skipped}`);
} catch (err) {
- logLine(`claims-autopilot FAILED: ${err.message}`);
+ logLine(`claims-alert WARN (George unavailable): ${err.message} — pushing urgent items to CNCP`);
}
+
+ // CNCP parking-lot fallback: always post claims due ≤7 days for visibility on the command center.
+ try {
+ const db2 = require('./db');
+ const urgent = await db2.query(
+ `SELECT name, deadline, (deadline::date - current_date) days_left, fill_state
+ FROM settlement_claim WHERE user_id=$1 AND deadline IS NOT NULL
+ AND deadline >= current_date AND deadline <= current_date + 7
+ AND eligibility_state='eligible'
+ ORDER BY deadline ASC`, [autopilot.USER]);
+ if (urgent.rows.length) {
+ const lines = urgent.rows.map(c =>
+ `${c.days_left === 0 ? '🔴 TODAY' : c.days_left === 1 ? '🟡 TOMORROW' : `🟠 ${c.days_left}d`} · ${c.name} (${c.fill_state})`
+ ).join('\n');
+ await fetch('http://127.0.0.1:3333/api/parking-lot', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ title: `⚖️ ${urgent.rows.length} claim(s) due ≤7 days`, body: lines, source: 'claims-autopilot' })
+ }).catch(() => {});
+ logLine(`claims-alert CNCP: posted ${urgent.rows.length} urgent claims to parking lot`);
+ }
+ } catch (e) { /* CNCP fallback is best-effort */ }
}
async function runAmazonOrders() {
← 00f2109 auto-data-snapshot: 2026-08-18T16:40:41 (2 data files) — pub
·
back to AbramsOS
·
abramsos: CNCP parking-lot fallback fires only when George u fca604e →