7c9aff393a
DS-Mac-mini-26B-Priority-Gate-1 — Mac mini 26B single-inference gate 를 FIFO Semaphore → 우선순위 기반 heap dispatch 로 교체. concurrency 1 유지, queue ordering 만 foreground 우선. API: - Priority(IntEnum): FOREGROUND=0, BACKGROUND=100 - acquire_mlx_gate(priority=DEFAULT_PRIORITY) async context manager - DEFAULT_PRIORITY = BACKGROUND (안전 default, foreground 짓밟지 않음) - get_mlx_gate() legacy wrapper — context-manager only 호환 구현: - _inflight: bool + _waiters heap [(priority, seq, future, enqueue_ts)] - fast-path: not inflight and not waiters → 즉시 inflight, Future 생성 X - _dispatch_next_locked: cancelled/done Future skip (heap 잔재 risk 회피) - release: lock 안에서 pop, set_result 는 loop.call_soon (lock 밖) reentry deadlock 회피 - dispatch / enqueue / release / WARN log (observability) - BACKGROUND wait_ms > 300_000 (5분) 시 starvation WARN — aging 은 Phase 2 deferred Tests (tests/test_priority_gate.py, 6 scenario): 1. FIFO within same priority 2. Foreground jumps queue (bg5 대기 중 fg 들어오면 즉시 다음 슬롯) 3. Long-running background blocks foreground (preemption X, intended) 4. Mixed concurrent enqueue (FG fifo 먼저, BG fifo 후) 5. Backward compat (legacy get_mlx_gate() = BACKGROUND 매핑) 6. Cancelled waiter skip (heap 의 죽은 Future 건너뜀, gate stuck X) Site 교체는 별 commit (refactor(search): swap 10 call sites). plan: ~/.claude/plans/hermes-polymorphic-rossum.md