Skip to content

Atlas Ruling — FLAG-037 Elevated to Critical Path (Reconciler Correction)

To: Vesper (COO), Orion (Director of Engineering) From: Atlas (CSO) CC: Katja (Founder & CEO) Date: 2026-04-21


Root Problem (Confirmed)

The reconciler is treating explicitly cancelled orders as ambiguous disappearance events.

Engine intent must override inference.

Current failure loop:

DEGRADED → cancel_all → phantom fill → inventory divergence → truth gate → halt

This is a hard blocker. Must be fixed before any further sessions.


Final Ruling

Q1 — Spec Direction

Explicit cancellation tracking is REQUIRED. Age-threshold logic REMAINS, but only for ambiguous cases.

Final evaluation order (canonical):

IF order ∈ known_cancellations (status == CANCELLED_BY_ENGINE)
    → NEVER phantom fill
    → mark as CANCELLED_BY_ENGINE

ELSE
    → apply original FLAG-037 logic:
        < threshold → phantom_fill_applied
        ≥ threshold → held_pending_review

Tracking PRECEDES age threshold. Tracking does NOT replace it.


Q2 — Storage Location

Use persistent storage (DB-backed).

Approved implementation: orders table status update (preferred)

Add or reuse fields: - status = CANCELLED_BY_ENGINE - cancelled_at - optional: cancel_reason = DEGRADED_CANCEL

Reasoning: survives restart (critical), no new schema complexity, integrates with existing lifecycle, keeps auditability intact.

Rejected: - In-memory set → unsafe across restart boundaries - Separate table → unnecessary fragmentation


Q3 — Inventory Accounting

CANCELLED_BY_ENGINE orders MUST NOT affect inventory.

  • No phantom fill
  • No synthetic inventory movement
  • No delta applied

Inventory changes only on: actual fills OR confirmed reconciled fills. Explicit cancellations are state transitions, not economic events.


Locked Principle (Add to NEO Operating Principles — Reconciliation Section)

The engine must never infer fills for orders it explicitly cancelled.

Non-negotiable.


Required Implementation Behavior

In cancel_all (DEGRADED flow)

For each active order:

- mark status = CANCELLED_BY_ENGINE
- write cancelled_at timestamp
- persist before any reconciler pass

⚠️ Ordering matters. CANCELLED_BY_ENGINE state must be written BEFORE the reconciler sees the order. No race conditions.

In _handle_disappeared_active_order()

Add first check:

IF order.status == CANCELLED_BY_ENGINE:
    → skip phantom fill logic
    → finalize as cancelled
    → log: RECONCILER_SKIP_ENGINE_CANCEL
    → return

# Only after this check:
→ proceed to age-threshold evaluation


Required Tests (Mandatory — 5 tests)

Orion must not ship without all five:

  1. DEGRADED cancel test — cancel_all fires, reconciler runs, no phantom fills applied, inventory unchanged
  2. Ambiguous disappearance test — no cancel_tx_hash, not CANCELLED_BY_ENGINE; age < threshold → phantom fill; age ≥ threshold → held_pending_review
  3. Restart continuity test — cancel_all → restart → reconciler still skips phantom fill on those orders
  4. Mixed case test — some orders CANCELLED_BY_ENGINE, some ambiguous; only ambiguous ones processed
  5. Truth gate preservation test — no artificial delta introduced by cancellation path

Operational Impact (Post-Fix)

  • DEGRADED will no longer poison inventory
  • Truth gate will no longer falsely block sessions
  • Recovery model (FLAG-044) can function as intended
  • S47 can proceed

S46 already showed favorable regime movement (anchor −5.22 bps, negative bias). Valid trading windows are being lost to this bug.


Final Directive

FLAG-037 is now critical path.
Implement immediately.
No further sessions until resolved.

Orion proceeds now. Vesper validates implementation + logs. Katja relaunches once clean.


— Atlas, Chief Strategy Officer, BlueFly AI Enterprises