fix(pr): pin analysis engine config per calculateGamePR run - #150
Merged
Merged
Conversation
The gnubg engine config is a mutable process-global shared with robot turn execution. Once robots configure per-skill settings, PR analysis inherited whatever the last robot turn left behind — including the case where the robot's own move-selection settings graded the robot's moves, yielding equity loss 0 and PR 0.0 for every robot. calculateGamePR now re-asserts a complete ANALYSIS_HINTS_CONFIG (2-ply, Huge filter, noise 0, pruning) at the start of every run via an optional configure hook on AiModuleInterface. Claude-Session: https://claude.ai/code/session_01JUcWgZDmavXuK6Xkeejd5W
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The gnubg engine config is a mutable process-global shared with robot turn execution. Once robots configure per-skill settings (nodots/backgammon-ai#65), PR analysis inherits whatever the last robot turn left behind — including grading a robot's moves with the robot's own move-selection settings, which yields equity loss 0 and PR 0.0 for every robot game.
Fix
calculateGamePRre-asserts a completeANALYSIS_HINTS_CONFIG(2-ply, Huge filter, noise 0, pruning) at the start of every run, via a new optionalconfigurehook onAiModuleInterface. The config is complete on purpose: partial configs merge into whatever the previous caller left behind.Known limitation: a robot turn in another game can still interleave mid-analysis (the config is process-global); this pins the common sequential case.
Tests
Two new cases in
PerformanceRatingCalculator.test.ts(configure called per run with the full config; module without configure tolerated). Suite: 22 passed. The 3gnuPositionIdsuite failures are pre-existing on this machine (native addon missinggnubg.weights), untouched by this change.Related: nodots/backgammon-ai#65, nodots/backgammon-api fix/robot-pr-pending-and-analysis-config.
https://claude.ai/code/session_01JUcWgZDmavXuK6Xkeejd5W