PINK: docs v7 + reset_and_seed startup fix — 451/451 tests green

- SYSTEM_BIBLE.md → v7.0: documents fee-sign fix (Defect A), opening-fee
  fix (Defect B), WARN-unfreeze, orphan prevention, reset_and_seed startup,
  and vel_div env-override.
- CAPITAL_BOOKKEEPING_DESIGN.md: status updated to PHASE-1 BUGFIXES APPLIED;
  sections 8.1-8.4 (applied fixes + 34-test coverage) were already present.
- rust_backend.py: expose dita_kernel_reset_and_seed() via _RustKernelLib +
  ExecutionKernel.reset_and_seed(); zeros stale K-accumulators at startup so
  K=E=live_capital → delta=0 → capital_frozen=False on every clean restart.
- pink_direct.py: call kernel.reset_and_seed(live_capital) after
  _restore_kernel_snapshot() so BingX is always the ledger of record.
- launch_dolphin_pink.py: DOLPHIN_PINK_VEL_DIV_THRESHOLD env-var override
  for on-exchange debugging; BLUE unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-06-08 12:33:50 +02:00
parent e38ec77221
commit 0eac51d2e9
5 changed files with 2470 additions and 7 deletions

View File

@@ -321,10 +321,14 @@ class PinkDirectRuntime:
self.kernel.set_seed_capital(live_capital)
await self._seed_account_from_exchange()
# Restore fee calibration + account state from the previous session if the
# kernel was flat at save time. Must be AFTER set_seed_capital and reconcile
# so the snapshot can override our fresh seed with the last-known calibration.
# Restore fee calibration from the previous session if the kernel was flat
# at save time. Must be AFTER set_seed_capital so the snapshot can carry
# forward fee model parameters. Re-apply live_capital immediately after to
# ensure BingX is the ledger of record for capital — the snapshot's capital
# is stale (it reflects the exchange balance at the PREVIOUS session's last
# fill), whereas live_capital was just fetched from BingX right now.
_restore_kernel_snapshot(self.kernel, self.logger)
self.kernel.reset_and_seed(live_capital) # zeros stale accumulators; K=E=live_capital
# Start WS account stream (primary); poll failover handled inside stream.
self._account_stream_task = asyncio.create_task(