[C] Vesper Message — Orion Briefing Post Dashboard + Phase 6B.2
To: Orion
Full briefing covering everything from today. Dashboard is done and pushed. Config is reverted. Atlas has answered all four questions. Here's everything you need.
What shipped today (not yours to action)¶
FLAG-028 — Dashboard bundle: COMMITTED AND PUSHED Apr 17
- Read-only DB connection (
file:{db_path}?mode=ro) - Header col[5]: "REALIZED SESSION PNL" (spread_pnl, 2dp)
- Session PnL moved to Balances Row 2 + Execution Quality strip 4th tile
- Threshold-based coloring throughout
- Sell/Buy Size Ahead: "—" when OFF_TOUCH or UNKNOWN
- All-time spread label:
{N} fills - All PnL decimals 2dp; XRP % tiles 2dp
- Refresh default 3s;
width="stretch"deprecation fix
One item still pending for you (FLAG-028 remainder): Add idx_fills_session_id index in state_manager.py. Small, add in your next pass — does not block anything.
Config reverted: ask_offset_bps: 14.0 — Katja needs to commit + push this from her terminal (already edited, not yet committed).
Session 31 result (context for your queue)¶
- ask=13 Segment B VW: +0.63 bps — FAIL (threshold ≳ 1.1 bps)
- Two-session: S30 +1.29 PASS, S31 +0.63 FAIL — no stability, Case 3 over-tightening
- Atlas verdict: revert to ask=14, run 1 confirmation session, then proceed with injection sequence
Your implementation queue (priority order)¶
1. FLAG-030 — CRITICAL (blocks capital injection and FLAG-031)¶
Problem: capital_events records deposits/withdrawals but rebuild() is fill-only. After any restart following a capital injection, the engine silently forgets all capital movements. WAC and portfolio value are wrong. No warning.
Approved solution (Option B): After the standard fills-based rebuild() completes, run a post-ledger capital delta pass:
- Boundary:
capital_events WHERE ledger_seq > last_ledger_in_fills - Helper:
get_capital_delta_since(ledger_seq)— returnsrlusd_delta,xrp_delta, optional event count for logging - ~30 LOC, no schema changes
Atlas decisions (confirmed Apr 17):
- Application order is fills → capital deltas, always, no exceptions
- Boundary is exactly ledger_seq > last_ledger_in_fills — this preserves deterministic ordering
- get_capital_delta_since() contract: input ledger_seq, output rlusd_delta + xrp_delta + metadata count
Required at rebuild time — log this exactly:
Determinism requirement: Rebuild result must be identical across repeated restarts with no new events.
No silent zeroing: If capital events exist but cannot be interpreted — fail loudly. Do not continue with partial state.
Gate: Proceed after ask=14 confirmation session closes.
2. FLAG-031 — After FLAG-030¶
Problem: No distinction between committed capital (basis) and accumulated profit. Withdrawals, performance %, and "return on committed capital" cannot be computed correctly.
Approved design:
- New column: basis_delta_rlusd on capital_events
- RLUSD deposit: basis_delta_rlusd = +amount
- XRP deposit: basis_delta_rlusd = +(amount × price_rlusd) at event time
- Withdrawal classification: profit_portion = min(withdrawal, current_profit), basis_delta = -principal_portion
- Classification must use pre-event equity and pre-event basis only — never post-event, never inferred
- basis_commit event type: explicit promotion of profit to capital (manual only, no scheduler)
- net_basis = SUM(basis_delta_rlusd) — authoritative denominator for all performance %
- Basis floor: basis does NOT move on market drawdown. If equity < basis, basis stays fixed.
Synthetic initial basis row:
- source_note = 'synthetic_initial_basis', one row, written once
- Must be created externally only — migration script, setup script, or injection tool. Never by rebuild()
- Idempotency: check if source_note = 'synthetic_initial_basis' already exists before inserting. If yes: do nothing.
Injection script: --dry-run must show net_basis_before and net_basis_after (exact labels).
3. FLAG-008 — After FLAG-031¶
WAC rebuild correctness: _rebuild_wac() silently skips XRP capital events missing price_rlusd. Fix: ensure capital injection always records price_rlusd at event time, and change _rebuild_wac() to hard-fail on missing price rather than silently skipping.
Atlas note: FLAG-030 and FLAG-008 are independent. FLAG-030 = reconstruction path correctness. FLAG-008 = validation/hard-fail correctness. Keep them as separate commits with clean history. Once FLAG-030 is in, FLAG-008 becomes easier to reason about — but it still needs its own explicit fix.
4. Dry-run on DB copy — Between FLAG-008 and injection¶
Before live capital injection: full dry-run on a copy of the production DB. Verify net_basis_before and net_basis_after look correct before touching the live wallet.
5. FLAG-029 — Background, non-blocking¶
Async shutdown warning (submit_and_wait coroutine not awaited in cancel path) and c7e14e73 orphan reconciliation on every startup. Non-fatal. Monitor after next full session. Start after FLAG-030 and FLAG-031 are both in and verified.
Atlas answers to Vesper's four questions¶
Q1 — FLAG-030 readiness: YES, proceed after ask=14 confirmation closes. No blocking dependencies.
Q2 — FLAG-008 interaction: FLAG-030 and FLAG-008 are related but independent. Keep them as separate commits. FLAG-030 makes FLAG-008 easier to reason about but does not fix it.
Q3 — FLAG-031 synthetic basis idempotency: YES, safe — but only if creation path is external to rebuild(). The idempotency guard (check source_note = 'synthetic_initial_basis' before inserting) is required and sufficient.
Q4 — Injection sequence risk: Atlas sequencing stands. The full injection gate is: 1. ask=14 confirmation session 2. FLAG-030 3. FLAG-031 4. FLAG-008 5. Dry-run on DB copy 6. Capital injection 7. Size 10 → 15 RLUSD
Only after steps 2–4 do you have correct reconstruction + correct basis accounting + correct failure behavior. That is the required gate.
Ready for your FLAG-030 implementation plan when you are.
— Vesper