Commit d551efa
committed
fix(state): complete apply_unknown routes + sliding-window latency
Round-3 cockpit fixes, all confined to inspector/src/state.rs.
Fix A — apply_unknown completion. Adds defensive Unknown-fallback routes
for emu.context_update (display "{turn}±3 turns"), lich.review (display
"clean"), naga.spec_check (display "clean"|"drift" by status),
runtime.metrics (populate every RuntimeMetricState slot from extras),
task.created / task.updated / task.completed / task.failed /
task.blocked (mirror typed handlers — upsert TaskState, drive
session.active_task_id, bump ongoing/successful/failed counters).
Splits the previous combined arm so each plugin event updates display +
last_event independently of the catch-all.
Fix B — pech display_value race. pech.ledger.appended emits with
session_cost_usd=0 from the real fs MCP server (no token claim) and
non-zero from the synthetic loop. Guards display + sparkline pushes
behind > 0.0 so a real zero-valued event arriving after a synthetic
non-zero one no longer blanks the readout. New regression test
verifies the latch.
Fix C — sliding-window latency synthesis. Replaces the session-spanning
mean (which pinned p95/p99/event_loop_ms to a stale 379ms) with a
50-event sliding window. Computes mean (capped at 100ms),
95th-percentile, and 99th-percentile interarrival deltas; populates
metrics.p95_latency_ms, metrics.p99_latency_ms, health.event_loop_ms.
+12 unit tests. cargo build --release clean. cargo test --lib 80/80.1 parent 700a532 commit d551efa
1 file changed
Lines changed: 559 additions & 28 deletions
0 commit comments