toga-ai 1.0.763 → 1.0.764

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ project: Worker
6
6
  client: shared
7
7
  type: feature
8
8
  status: active
9
- updated: 2026-08-31
9
+ updated: 2026-09-03
10
10
  owners: ["jcardinal", "mhammontree", "bala"]
11
11
  files:
12
12
  - worker2/Worker/Monitor/Compass.php
@@ -69,9 +69,17 @@ Each measures one Compass/Office Depot integration metric and pushes a decided a
69
69
  `pendingCount > 10` **OR** `oldestPendingAgeMinutes > 180` (3h), so a single order stuck too
70
70
  long pages even under the count threshold — this catches the 1.0 cron's
71
71
  [poison-order starvation](../../../clients/compass-usa/features/mits-sales-order-transmission-alerting.md).
72
- **Age is measured from the FINAL (stage-2) approval decision** (`ApprovalDecisions` stage 2
73
- `dtDecision` where `isApproved = 1` — not stage 1, not order date; that is the "eligible to
74
- transmit" clock). The query **excludes canceled orders** (`salesOrderStageId IS NULL OR
72
+ **Age is measured from the LATER of the two approval decisions —
73
+ `GREATEST(stage-1, stage-2) dtDecision`** — because an order is eligible to transmit only once
74
+ **both** stages are approved. Measuring from **stage-2 alone is wrong** (it was the source of a
75
+ false HIGH — see the 2026-09-03 change-history): Compass **VIP auto-approve stamps the stage-2
76
+ (manager) decision at order creation** (`postPost`), so stage 1 (admin) can land days later; a
77
+ stage-2-only clock reads a huge age the instant stage-1 approves on a perfectly healthy order.
78
+ **NULL-guarded:** an `isApproved = 1` decision can still carry a **NULL `dtDecision`**, and a bare
79
+ `GREATEST` returns NULL — so `MAX()` would silently drop that order and hide a genuinely stuck one.
80
+ Each stage is therefore `COALESCE`d to the other stage's decision, then to `SalesOrders.dtCreated`,
81
+ so the age clock is never NULL and a stuck order always surfaces (fail loud). The query
82
+ **excludes canceled orders** (`salesOrderStageId IS NULL OR
75
83
  <> 8`), mirroring the transmit cron's WHERE, so an order canceled after approval (e.g.
76
84
  SA136567, now stage 8) neither counts nor false-alarms forever — this also fixed a
77
85
  pre-existing count mismatch vs. the cron. Config: `$ALARM_AGE_MINUTES = 180`; body echoes
@@ -430,6 +438,26 @@ check for another client.
430
438
  monitors must pass the region (see [Cloud S3 helpers](../../_underscore/features/cloud-s3-helpers.md)).
431
439
 
432
440
  ## Change history
441
+ - 2026-09-03 — **Fixed a false HIGH age alarm** in `CompassSalesOrderTransmission()`.
442
+ `oldestPendingAgeMinutes` was measured from **stage-2 approval only**
443
+ (`TIMESTAMPDIFF(MINUTE, ApprovalDecisionsStage2.dtDecision, NOW())`), but stage 2 is **not**
444
+ always the final approval: Compass **VIP auto-approve stamps the stage-2 (manager) decision at
445
+ order creation** (`postPost`), so stage-1 (admin) can land days later. An order transmits only
446
+ once **both** stages approve, so the correct clock is the **later of the two** decisions.
447
+ **Incident 2026-09-03:** OneUptime HIGH, `pendingCount=1`, `oldestPendingAgeMinutes=2360`
448
+ (threshold 180) — order SA136844 (`Client_Compass` id 120481): stage-2 VIP auto-approved at
449
+ creation 09-01 19:55, stage-1 admin approved 09-03 11:15, transmitted 09-03 11:18 (3 min after
450
+ becoming eligible). The alarm fired the exact minute stage-1 approved — a **monitor** bug, the
451
+ `dtDecision` values were correct. Scale (prod, last 30 days both-approved = 1927): 439 had
452
+ stage-2 before stage-1, **133 with that gap > 180 min** (each a false HIGH if pending at run
453
+ time). **Fix:** age now `GREATEST(stage-1, stage-2) dtDecision`, and because an `isApproved=1`
454
+ row can carry a **NULL `dtDecision`** (1,415 such rows in prod) where a bare `GREATEST` returns
455
+ NULL and `MAX()` would silently drop a stuck order, each stage is `COALESCE`d to the other
456
+ stage's decision then to `SalesOrders.dtCreated` — the clock is never NULL, a stuck order always
457
+ surfaces (fail loud). Summary string changed from "since stage-2 approval" to "since eligible
458
+ (later of both approvals)". Timezone confirmed **not** an issue (DB `NOW()` and `dtDecision` both
459
+ Central). No OneUptime/SQL/config change — the age alarm still rides the existing `"alarm":"HIGH"`
460
+ token. sql-reviewer SAFE TO MERGE, php -l clean; worker2-only, not deployed. (jcardinal)
433
461
  - 2026-08-31 — Added **age-based detection** to `CompassSalesOrderTransmission()`: it now alarms
434
462
  on `pendingCount > 10` **OR** `oldestPendingAgeMinutes > 180` (new `$ALARM_AGE_MINUTES = 180`),
435
463
  so one order stuck too long pages even under the count threshold — catching the 1.0 transmit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.763",
3
+ "version": "1.0.764",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",