[C] Orion Dispatch — FLAG 053 Implementation
What happened since your investigation report¶
Your investigation report was delivered and routed to Atlas. Here is the full chain:
Your findings (confirmed by Atlas):
- Q1 — EMA deadlock hypothesis: REFUTED. observe() runs unconditionally, no ANCHOR_IDLE gating.
- Q2 — Real bug: exit evaluator at main_loop.py:2887-2997 uses _select_anchor_guard_window() (main_loop.py:2729-2766). Legacy capped window (fallback before tick 70) holds ±10 bps in saturated regimes — both exit predicates fail mathematically. Minimum 100 ticks to exit ANCHOR_IDLE.
- Q3 — Dashboard sign mismatch: not a bug. Three sign conventions, same regime, different perspectives. Legibility gap only.
Atlas ruling on FLAG-053 fix direction: Option (iii) — both: - (A) Reduce pre-residual lockout — earlier residual-window eligibility or benign-regime early-exit path on uncapped structural signal during pre-residual phase - (B) Standardize sign conventions across all three operator-facing metrics - Option (iv) — accept 100-tick minimum — explicitly rejected
S40 diagnostic results (ran today): We ran a side-by-side comparison — S40 baseline clone (your investigation-era codebase, no guards) vs. current main branch. Results:
| S56 (main branch) | S40-Diag (clone, no guards) | |
|---|---|---|
| Regime | +2.70 bps (favorable) | −8.98 bps (hostile) |
| Fills | 1 sell | 0 |
| Halt | degraded_episode_limit_halt | duration_elapsed ✓ |
| Engine active throughout? | No — guards stopped quoting post-fill | Yes — quoted every tick |
Atlas final ruling: FLAG-053 is confirmed participation-blocking, not cosmetic. The current branch is prematurely surrendering market presence after fills. Proceed with fix. Market is alive. Do not re-litigate that question.
What you are building¶
Two changes in one branch:
Change 1 — ANCHOR_IDLE exit evaluator lockout fix¶
Problem: _select_anchor_guard_window() falls back to legacy capped window for first 70 ticks. In a cap-saturated regime, both exit predicates (|mean| < 4.0 bps and pct > 5 bps < 30%) are mathematically impossible to satisfy. Exit impossible until tick 70, then 30 more stability ticks required = 100-tick minimum.
Fix direction (both of the following):
A — Reduce pre-residual lockout. Shorten the period before the residual window becomes eligible for exit evaluation. Likely a separate exit-eligible residual threshold (e.g., 30 ticks) vs. the full 70-tick production confidence requirement. You propose the exact number and whether it needs a new config parameter.
B — Benign-regime early-exit path. If structural_basis_bps (uncapped, available from tick 1) shows clear improvement during the pre-residual phase, allow the stability counter to accumulate against it. Proposed trigger: abs(structural_basis_bps) < 4.0 bps. You propose the mechanism (raw or rolling mean) and stability tick count.
Do not touch: - Entry into ANCHOR_IDLE - 30-tick stability counter for exit - Residual window logic at full maturity (>70 ticks) - Drift/corridor/truth escalation from ANCHOR_IDLE → DEGRADED
Change 2 — Sign convention standardization¶
Problem: Three operator-facing metrics use three different sign conventions. Same regime reads −11 bps in tick log and +9.56 bps on dashboard.
Canonical convention: (clob_mid − amm_mid) / amm_mid × 10000. Negative = AMM above CLOB.
clob_vs_amm_divergence_bps— already canonical, no changestructural_basis_bps— already canonical sign, no changelast_anchor_divergence_bps(dashboard) — needs to flip sign or be recomputed from canonical formula
You propose: full recompute from canonical formula, or operator-facing display flip only?
Before you touch code — answer these three questions¶
- Option A threshold: What exact tick count for exit-eligible residual window? New config param or reuse existing?
- Option B mechanism:
structural_basis_bpsraw or short rolling mean? What stability tick count? - Sign standardization approach: Full recompute of
last_anchor_divergence_bpsfrom canonical formula, or display flip only?
Propose → Vesper confirms → implement. You do not need another Atlas round-trip if the proposal is within the approved direction.
Validation criteria (required before delivery)¶
Four tests minimum:
- Early exit in improving regime (pre-residual phase): regime hostile for first 20 ticks, then drops below 4 bps → engine exits ANCHOR_IDLE before tick 70
- Residual handover still works (>70 ticks): long session, regime improves after tick 70 → exit via residual window, no regression
- No false exit in persistently hostile regime: 100 ticks at −12 bps throughout → engine stays in ANCHOR_IDLE, stability counter never triggers spuriously
- Sign convention round-trip: known CLOB-AMM divergence → all three surfaced signals show same direction
Standing apply rules (enforced every delivery)¶
- No pre-creating the feature branch until you are ready to commit code
- No
*.patchglob in PowerShell — useGet-ChildItem ... -Filter "*.patch" | Sort-Object Name | ForEach-Object { git am $_.FullName } - Always include
git branch -D <branch>beforegit checkout -b <branch>in apply instructions
Full prework package with detailed design notes, option tradeoffs, and side-by-side comparison framework is in:
02 Projects/NEO Trading Engine/07 Agent Coordination/[C] Vesper Prework — FLAG-053 Fix Package.md
Ready when you are.
— Vesper