Fix game-mode config: load env recommender settings, not stale defaults#178
Merged
Conversation
In Game Mode, GameShell mounts <App/> and immediately drives
loadGameStudy(), which built the POST /api/config payload from
buildConfigRequest() — the live useSettings state. But useSettings only
loads the active environment config (e.g. min_redispatch=2) via an async
mount effect that hasn't resolved yet, so the request fell back to the
hardcoded defaults (min_redispatch=0, n_prioritized_actions=10,
allowed_action_types=[]) for everything except the network/action/layout
paths the study overrides.
Two symptoms:
- The recommender ran on default settings instead of the loaded
environment's config ("config not set on the proper environment").
- min_redispatch=0 reached the backend, so the expert recommender never
forced redispatch into the prioritized feed (redispatch is only
guaranteed via the MIN_REDISPATCH minimum-enforcement phase; the fill
phase is crowded out by disco/coupling candidates). Redispatch actions
were scored in the Manual Selection table but absent from Suggested
Actions.
Fix: source loadGameStudy's config from the freshly-loaded active user
config via configRequestFromUserConfig(), mirroring the stale-closure
guard already in handleLoadConfig. The study still overrides only the
network/action/layout paths + contingency.
Add App.gameMode.test.tsx: a deterministic regression test that holds the
config fetch open to reproduce the race, then asserts the /api/config
payload carries min_redispatch=2 (not the default 0) while the study path
override still wins.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
In Game Mode, GameShell mounts and immediately drives loadGameStudy(), which built the POST /api/config payload from buildConfigRequest() — the live useSettings state. But useSettings only loads the active environment config (e.g. min_redispatch=2) via an async mount effect that hasn't resolved yet, so the request fell back to the hardcoded defaults (min_redispatch=0, n_prioritized_actions=10, allowed_action_types=[]) for everything except the network/action/layout paths the study overrides.
Two symptoms:
Fix: source loadGameStudy's config from the freshly-loaded active user config via configRequestFromUserConfig(), mirroring the stale-closure guard already in handleLoadConfig. The study still overrides only the network/action/layout paths + contingency.
Add App.gameMode.test.tsx: a deterministic regression test that holds the config fetch open to reproduce the race, then asserts the /api/config payload carries min_redispatch=2 (not the default 0) while the study path override still wins.