Commit 76ecad0
committed
fix(state): plugin calls + spend rate + active task persistence + sane latency
Five user-visible bugs from the latest cockpit screenshot, all in
state.rs and overview.rs:
1. emu / lich / naga / gorgon plugin calls stuck at 0 despite events
arriving and display_value updating. Typed-variant handlers
(Event::EmuContextUpdate, Event::LichReview, Event::NagaSpecCheck,
etc.) set display_value but never bumped calls — they relied on
the generic post-apply block which only set last_event. Generic
block now bumps calls too. Skipped for Event::Unknown to avoid
double-counting (apply_unknown's per-plugin branches already bump).
2. Spend rate $0.00/hr despite Spent $0.02. Computed inline in
synthesize_health: spent_session_usd / max(uptime_hours, 0.001).
3. Active task / File / Risk / Phase / Age went blank between task
lifecycle iterations because TaskCompleted cleared
session.active_task_id. Stop clearing — keep the most-recent task
visible, otherwise the box bounces "T-104..." → "(idle)" every
~2 seconds.
4. RUNTIME "Tasks active" and SYSTEM HEALTH "Active tasks"
disagreed (2 vs 0). RUNTIME used the wire's runtime.metrics
heartbeat; SYSTEM HEALTH derived from app.tasks. Now both derive
from app.tasks via synthesize_health. SYSTEM HEALTH filter also
includes Queued (was Running/Waiting* only).
5. P95 1486ms / P99 2271ms / Avg latency 100ms (capped) / Event
Loop 100ms (capped) — interarrival times include the loop's
sleeps between scenarios. Filter to bursts only (delta <= 100ms)
so the metric reflects burst-mode throughput, not producer pacing.
When no burst-deltas in the window, keep prior value (stable
display).
Tests: 80/0 lib green; release build clean. Two existing tests
adjusted: unknown_runtime_metrics_populates_runtime_state now
expects ongoing_tasks=0 (synthesize_health overrides wire value
from app.tasks).1 parent 22bce81 commit 76ecad0
2 files changed
Lines changed: 69 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1040 | 1040 | | |
1041 | 1041 | | |
1042 | 1042 | | |
1043 | | - | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1044 | 1049 | | |
1045 | 1050 | | |
1046 | 1051 | | |
| |||
1051 | 1056 | | |
1052 | 1057 | | |
1053 | 1058 | | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1059 | 1064 | | |
1060 | | - | |
| 1065 | + | |
1061 | 1066 | | |
1062 | | - | |
1063 | | - | |
| 1067 | + | |
1064 | 1068 | | |
1065 | | - | |
| 1069 | + | |
1066 | 1070 | | |
1067 | 1071 | | |
1068 | 1072 | | |
| |||
1074 | 1078 | | |
1075 | 1079 | | |
1076 | 1080 | | |
1077 | | - | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
1078 | 1085 | | |
1079 | 1086 | | |
1080 | 1087 | | |
| |||
1100 | 1107 | | |
1101 | 1108 | | |
1102 | 1109 | | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
1103 | 1136 | | |
1104 | 1137 | | |
1105 | 1138 | | |
| |||
1474 | 1507 | | |
1475 | 1508 | | |
1476 | 1509 | | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
1480 | 1513 | | |
1481 | 1514 | | |
1482 | 1515 | | |
| |||
1569 | 1602 | | |
1570 | 1603 | | |
1571 | 1604 | | |
1572 | | - | |
1573 | | - | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
1574 | 1615 | | |
1575 | 1616 | | |
1576 | 1617 | | |
| |||
1580 | 1621 | | |
1581 | 1622 | | |
1582 | 1623 | | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
1583 | 1627 | | |
1584 | 1628 | | |
1585 | 1629 | | |
| |||
2654 | 2698 | | |
2655 | 2699 | | |
2656 | 2700 | | |
2657 | | - | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
2658 | 2706 | | |
2659 | 2707 | | |
2660 | 2708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
489 | | - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
490 | 493 | | |
491 | 494 | | |
492 | 495 | | |
| |||
0 commit comments