fix(@projects/@magic-civilization): 🐛 update stress-test verdict with three root causes

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-24 17:52:52 -07:00
parent 0cdae055e2
commit d902d97cca

View file

@ -77,21 +77,35 @@ a foregone conclusion; the grid is the precondition.
Fresh full run started 2026-04-24 on apricot (PID 2016984, log: `/tmp/p0-22-matchup-grid-fresh.log`),
with `LAUNCH_COOLDOWN=15 COUNT=5 TURN_LIMIT=300 PARALLEL=4 AI_USE_MCTS=true`.
Verdict pending full 10/10 completion.
- 🔴 **`tools/huge-map-5clan.sh``ultimate_stress: PASS`** — BLOCKED: two separate root causes found.
- 🔴 **`tools/huge-map-5clan.sh``ultimate_stress: PASS`** — BLOCKED: three root causes, two fully diagnosed.
**Root cause 1 (fixed in runs ≥035301, 2026-04-24):** Batch `000049` used a stale `.so` lacking
`GdAiController` registration. The class exists in the symbol table but `ClassDB.class_exists("GdAiController")`
returned false — 872 "not loaded" errors per game. Result: all AI players skipped tactical pass entirely,
no settler placed, no capital founded. Newer runs (035301, 040822) show 0 errors — `GdAiController` loads correctly.
**Root cause 1 (fixed, confirmed):** Batch `000049` used a stale `.so` lacking `GdAiController` registration —
872 "not loaded" errors/game, tactical pass skipped, no capitals founded. Current `.so` (runs ≥035301) has 0 errors.
**Root cause 2 (open, root cause of gate failure):** Even with `GdAiController` loading correctly, all 10
games in both `035301` and `040822` end with `outcome: in_progress` or `outcome: max_turns`, never `outcome: victory`.
The `ultimate_stress` gate requires `decisive_games ≥ 50%` counting only `outcome == "victory"`. In the 5-clan
all-AI mode, no victory condition fires across 500 turns of play. This is either a victory-condition engine
bug (last-city-standing check not triggered when all-human=false) or a game-balance issue (5 AIs never
eliminate each other). Needs investigation in the engine's victory-declaration path for all-AI multi-player games.
**Root cause 2 (fixed in current `.so`, confirmed by verification batch 2026-04-24):** `035301`/`040822` runs used
an older `.so` where `player_index_to_slot` returned an error for player index 4 (max was 3).
The current `.so` caps index 4 to slot 3 with a warning and proceeds. Verified: 3-seed T50 batch
(`victory-verify-170232`) shows 0 range errors and ALL 5 PLAYERS FOUND CITIES (cities ranging 1-4 per player).
The tactical AI is fully functional for 5-player games with the current build.
**Next action:** Once matchup-grid completes, diagnose why victory condition never fires in 5-clan all-AI mode.
**Root cause 3 (open — the remaining gate blocker):** Victory condition does not fire in 5-player all-AI games
within the turn limit. `victory_manager.gd`'s `check_all` correctly runs after each full round without any
`is_human` guard, but `outcome: victory` never appears. Three sub-causes are possible:
- **Safety timeout too short**: T50 verification games are killed at 400s (36-48 turns), just before
reaching T50 where score victory would fire. The `AI_USE_MCTS=true` env is not propagating through
`nohup bash -c` when set as prefix, so timeout stays at 2×T+300 not 3×T+300. For T500 with `huge-map-5clan.sh`
(which explicitly sets `AI_USE_MCTS=true`), timeout is 1800s — needs to be verified sufficient for 5-player pace.
- **Score victory path**: `_check_score_winner` fires at `turn_number >= turn_limit`. In `035301`,
seeds 1-4 reached T500 with `outcome: max_turns` (not `victory`) — meaning score victory's `EventBus.victory_achieved`
DID NOT fire, or `_on_victory` didn't propagate before `_finalize_run` wrote `max_turns`. The `done` state
in `auto_play.gd` (line 543) sets `_outcome = "victory" if _victory else "max_turns"` — if the victory
signal fires on the same frame `_state == "done"` is processed, there's a race.
- **No eliminations**: With 5 players all building and expanding, nobody gets eliminated before T500 on a
standard 80×52 map. Score victory fires but the race condition above may prevent it being recorded.
**Next action:** Verify the score victory race in `auto_play.gd`. Check if `_on_victory` fires between
`_state = "done"` and `_finalize_run`. If so, add a guard so that `_finalize_run` in the "done" branch
checks `_victory` after any pending signals have been processed (await or deferred check).
## Remaining to reach done
@ -100,12 +114,15 @@ a foregone conclusion; the grid is the precondition.
`autoplay-batch.sh` SAFETY_TIMEOUT now auto-scales to 3× TURN_LIMIT when MCTS enabled.
3. **Complete matchup-grid** — Fresh full run in progress on apricot (PID 2016984).
Run `checklist-report.py matchup_balance` across full grid dir once 10/10 done.
4. **Diagnose 5-clan victory condition**`outcome: victory` never fires in all-AI 5-player games.
Check engine's victory-declaration path (last-city-standing, score victory, domination) for
all-AI games. Specifically: does the human-turn-end path that triggers victory checks also
run for AI turn endings? Look in `turn_manager.gd` and `game_state.gd` victory check callsites.
5. **Run huge-map-5clan** (5 clans on Civ5 `standard` 80×52 map) once victory condition fixed.
Cite verdict. Blocked on matchup-grid PASS + victory condition fix.
4. **Fix score victory race in `auto_play.gd`**`_on_victory` signal from `victory_manager.gd` may fire on
the same frame that `_state = "done"` / `_finalize_run` writes `max_turns` to turn_stats. Check the `done`
branch at line 539-545: it writes `_outcome = "victory" if _victory else "max_turns"` which is correct,
BUT `_finalize_run()` is called from the `done` branch AND from `_on_victory` — the `_final_line_written`
guard should prevent double-write, but if `_on_victory` fires AFTER the `done` branch runs, the final line
already says `max_turns`. Fix: ensure `_on_victory` fires and updates `_outcome` before `_finalize_run`
writes the final line.
5. **Run huge-map-5clan** (5 clans on Civ5 `standard` 80×52 map) once score victory is written correctly.
Cite verdict. Blocked on matchup-grid PASS + score victory fix.
5. **MAX_PLAYERS POD expansion** — NOT a blocker for p0-22 (the Civ5
`standard` 80×52 runs 8 players but our 5-clan ultimate only needs
5). If we later want to run the actual canonical `huge` (128×80,