Skip to content

fix: forward all top-level config fields to worker processes (#516) - #517

Open
SUPR1M3 wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
SUPR1M3:fix/516-worker-config-serialization
Open

SUPR1M3 wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
SUPR1M3:fix/516-worker-config-serialization

Conversation

@SUPR1M3

@SUPR1M3 SUPR1M3 commented Oct 15, 2026 •

Copy link
Copy Markdown

Fixes #516

Problem:

ProcessParallelController._serialize_config built the dict sent to worker processes from a hand-written list of top-level Config fields. _worker_init rebuilds the worker's config with Config(**dict), so any field missing from that list silently fell back to its default inside workers.

Two of the missing fields are read only in workers, so setting them in the config had no effect during a run:

  • enforce_evolve_blocks: true: edits outside EVOLVE-BLOCK-START/END were kept and evaluated
  • custom diff_pattern: replies were parsed with the default regex, so every iteration failed with "No valid diffs found in response"

The existing worker tests patch _worker_config directly, so the serialize → _worker_init round trip was never exercised.

What:

  • Build the top-level part of the worker dict from dataclasses.fields(Config) instead of a hand-written list, so new fields reach workers automatically. The fields come from the Config class rather than the instance, so a user-defined Config subclass with extra fields still initialises workers.
  • Send evolution_trace as a dict and rebuild it in _worker_init, like prompt, database and evaluator.
  • Add tests/test_worker_config_serialization.py: round-trips a config with a non-default value for every top-level field through _serialize_config → _worker_init and asserts each one matches. It also fails if a future field is added without a non-default value in the test.

The other six previously dropped fields (logger_prefix, evolution_trace, early_stopping_*, max_tasks_per_child) are only read in the main process, so forwarding them changes nothing in workers.

Red -> green evidence:

On main, the new test fails on exactly the eight dropped fields:

FAIL: test_all_top_level_fields_round_trip (field='enforce_evolve_blocks')  False != True
FAIL: test_all_top_level_fields_round_trip (field='diff_pattern')  '<<<<<<< SEARCH...' != '<<<< SEARCH...'
FAIL: ... (field='logger_prefix', 'evolution_trace', 'early_stopping_patience',
           'convergence_threshold', 'early_stopping_metric', 'max_tasks_per_child')
FAIL: test_diff_pattern_reaches_worker
FAIL: test_enforce_evolve_blocks_reaches_worker
FAILED (failures=10)

With this PR: Ran 3 tests ... OK.

Testing:

  • Unit tests: 667 pass on Python 3.10 and 3.13 (664 on main plus the 3 new tests); per-test results are otherwise identical to main
  • End to end with a real process pool, both fork and spawn, 3 workers:
    • enforce_evolve_blocks: true: outside edits kept in 6/6 children on main, 0/6 with this PR
    • custom diff_pattern: 6/6 iterations fail on main, 0/6 with this PR
    • both settings at their defaults: identical to main
  • CLI with a YAML config, including checkpoint and resume: settings take effect and persist after resume
  • Integration suite against a local OpenAI-compatible stub: same results as main
  • black 25.12.0 / isort 7.0.0 (pre-commit versions) clean; Frame scan reports no findings

Notes:

Open PR #480 adds these two keys to _serialize_config as part of a much larger feature; this PR is a standalone fix with a regression test.

…hmicsuperintelligence#516)

_serialize_config built the worker config dict from a hand-written list of top-level Config fields. Fields missing from that list silently fell back to their defaults inside worker processes, so enforce_evolve_blocks and diff_pattern set in the config had no effect during a run.

- Build the top-level part of the worker dict from dataclasses.fields(Config) so new fields reach workers automatically
- Send evolution_trace as a dict and rebuild it in _worker_init, like the other nested config sections
- Add a regression test that round-trips a config with non-default values through _serialize_config -> _worker_init and checks every field

Fixes algorithmicsuperintelligence#516
@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

Config fields - enforce_evolve_blocks and diff_pattern are ignored in worker processes

2 participants