feat: add gameplay stats and restore Zenith rollout depth
Build and Push Docker Container / build-and-push (push) Successful in 3m6s

- Add read-only gameplay statistics with filters and opponent comparisons.
- Report move-trace latency percentiles and external timeout counts.
- Pair engine latency with the preceding turn to separate timing stages.
- Adjust Zenith rollout deepening for its larger timeout reserve.
- Bump Zenith to 1.2.0 and document the fix and snake-stats command.
- Cover statistics, trace aggregation, rollout depth, and verdict budgets.
This commit is contained in:
2026-11-05 08:07:15 +01:00
parent a2414f0b3d
commit 5e121c20cf
10 changed files with 498 additions and 7 deletions
+21
View File
@@ -117,11 +117,32 @@ from the strategy budget and returns a legal-direction fallback instead of null
when its request budget expires. This is best-effort deadline handling, not a
hard real-time guarantee under CPU saturation.
Version 1.2.0 fixes a search-depth regression from that larger reserve. Prism
looks one turn deeper in 3-snake rollouts when more than 250 ms remain; with
Zenith's 50 ms shorter budget that gate was never reached in production, so
Zenith always stopped at depth 2. Zenith now lowers the gate by its extra
reserve and deepens after the same elapsed time as Prism.
Run it with:
```sh
SNAKE=ZenithBattleSnake_ClaudeOpus5_5 python main.py
```
Show read-only win statistics per own snake version and per opponent from the
PostgreSQL gameplay database (`GAMEPLAY_DB_PG_DSN`):
```sh
just snake-stats --since-hours 24
just snake-stats --snake-type ZenithBattleSnake --game-type duel --min-games 5
just snake-stats --since-hours 48 --compare # opponents side by side per own version
just snake-stats --traces --since-hours 24 # move-trace latency per version and mode
```
`--traces` unpacks the newest `--trace-games` (default 300) finished replays and
reports p50/p90/p99 for strategy time, server overhead (handler minus
strategy), handler time, network/outside-handler time (engine latency minus
handler) and engine latency. `ext.timeouts` counts engine timeouts where our
handler had answered at least 100 ms before the deadline.
Benchmark Apex and Prism against sampled positions from a gameplay database:
```sh
python scripts/benchmark_snakes_from_db.py \