Skip to content

Fix game-mode config: load env recommender settings, not stale defaults#178

Merged
marota merged 1 commit into
mainfrom
fix/game-mode-config-propagation
Jun 24, 2026
Merged

Fix game-mode config: load env recommender settings, not stale defaults#178
marota merged 1 commit into
mainfrom
fix/game-mode-config-propagation

Conversation

@marota

@marota marota commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

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:

  • 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.

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>
@marota marota merged commit 57df34a into main Jun 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants