PINK: async submit + process_intent hot path; async/race flaw audit (pass 5)

N2/N3/N4 (3x Critical async bugs):
- BingxVenueAdapter.submit_async(): awaits backend.submit_intent() directly
  in caller's event loop — no thread-pool, no asyncio.run(), no _backend_snapshot()
- ExecutionKernel.process_intent_async(): same FSM guard logic as sync version;
  replaces venue.submit() with await venue.submit_async(); sync process_intent()
  untouched so all 122 tests stay green
- pink_direct.step() line 952: process_intent() -> await process_intent_async()

restore_state JSON parse (test fix):
- ExecutionKernel.restore_state() wraps Rust FFI in try/except JSONDecodeError
  returns False; matches documented contract; test_restore_corrupt_json_rejected passes

FLAWS doc: pass 5 table added; 21 total fixed; Z6/N5 marked resolved

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-06-04 21:02:26 +02:00
parent a9ba407ae2
commit f3a5f21460
4 changed files with 165 additions and 9 deletions

View File

@@ -833,7 +833,7 @@ class PinkDirectRuntime:
1. Update market state
2. Decide (policy layer)
3. Plan (intent layer)
4. Translate to KernelIntent -> kernel.process_intent()
4. Translate to KernelIntent -> kernel.process_intent_async()
5. Read final slot + account state from kernel
6. Persist
"""
@@ -949,7 +949,7 @@ class PinkDirectRuntime:
# overshoot an open position.
kernel_intent = self._exit_intent_from_slot(kernel_intent)
outcome = self.kernel.process_intent(kernel_intent)
outcome = await self.kernel.process_intent_async(kernel_intent)
# Locate the source of any non-finite intent the kernel rejected:
# log the full upstream provenance (snapshot price, account capital,