Skip to content

Fix inverted use_stale_model gating in DDWEStreamThinker - #49

Merged
braceal merged 1 commit into
mainfrom
fix/stale-model-gating
Aug 11, 2026
Merged

Fix inverted use_stale_model gating in DDWEStreamThinker#49
braceal merged 1 commit into
mainfrom
fix/stale-model-gating

Conversation

@braceal

@braceal braceal commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

The two branches guarding inference submission in DDWEStreamThinker.process_simulation_result were swapped relative to what use_stale_model means:

if not self.use_stale_model:
    while self.train_output is None:      # only waits for *a* model
        time.sleep(10)
elif self.use_stale_model:
    while self.train_iteration < self.ensemble.iteration:   # waits for a *fresh* model
        time.sleep(10)

So use_stale_model=False — the strict setting — merely waited for train_output to become non-None and would then submit inference against an arbitrarily old model. use_stale_model=True — the permissive setting — took the strict path and blocked until train_iteration caught up with the current ensemble iteration, serializing inference behind training on every iteration.

The branches are now swapped so the flag means what it says:

  • use_stale_model=True blocks only until the first model exists, then reuses whatever is current.
  • use_stale_model=False blocks until the current iteration's model is ready.

Log messages are updated to distinguish the two waits ("first" vs "next" streaming train task), which previously printed identical text from both branches.

Extracted from #40 so it can land on its own.

🤖 Generated with Claude Code

The two branches guarding inference submission were swapped relative to
what the flag means. With use_stale_model=False the thinker only waited
for train_output to become non-None, so it would happily submit
inference against an arbitrarily stale model. With use_stale_model=True
it blocked until train_iteration caught up to the current ensemble
iteration, which is the strict freshness wait that the False case was
supposed to perform.

Swap them: when a stale model is acceptable, block only until the first
model arrives; otherwise block until the current iteration's model is
ready.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@braceal
braceal merged commit 60fa090 into main Aug 11, 2026
@braceal
braceal deleted the fix/stale-model-gating branch August 11, 2026 22:00
@braceal braceal mentioned this pull request Aug 11, 2026
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.

1 participant