Skip to content

Commit ea7a2bd

Browse files
fix(network): default --generate-config to true for meaningful topology
Without LLM-generated network config, the network command produces a flat random graph that almost always fails topology gates. Defaulting to --generate-config ensures networks have attribute-based similarity structure out of the box. Use --no-generate-config to opt out. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 15102a9 commit ea7a2bd

2 files changed

Lines changed: 28 additions & 29 deletions

File tree

extropy/cli/commands/network.py

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def network_command(
3838
help="Save the (generated or loaded) network config to YAML",
3939
),
4040
generate_config: bool = typer.Option(
41-
False,
42-
"--generate-config",
43-
help="Generate network config via LLM from population spec",
41+
True,
42+
"--generate-config/--no-generate-config",
43+
help="Generate network config via LLM from population spec (default: enabled)",
4444
),
4545
avg_degree: float = typer.Option(
4646
20.0, "--avg-degree", help="Target average degree (connections per agent)"
@@ -188,8 +188,8 @@ def network_command(
188188
Network config resolution:
189189
1. --network-config file → load from YAML
190190
2. Auto-detect scenario/name/*.network-config.yaml if it exists
191-
3. --generate-config → generate config via LLM from scenario
192-
4. None of the above → empty config (flat network, no similarity structure)
191+
3. Generate config via LLM from scenario (default)
192+
4. --no-generate-config → empty config (flat network, no similarity structure)
193193
194194
Prerequisites:
195195
- Agents must be sampled (run 'extropy sample' first)
@@ -258,29 +258,28 @@ def network_command(
258258
out.error(f"Failed to load scenario: {e}")
259259
raise typer.Exit(1)
260260

261-
# Load base population spec for config generation (only if needed)
261+
# Load base population spec (needed for config generation)
262262
merged_spec = None
263-
if generate_config:
264-
base_pop_ref = scenario_spec.meta.base_population
265-
if base_pop_ref:
266-
pop_name, pop_version = _parse_base_population_ref(base_pop_ref)
267-
pop_path = study_ctx.get_population_path(pop_name, pop_version)
268-
try:
269-
pop_spec = PopulationSpec.from_yaml(pop_path)
270-
except Exception as e:
271-
out.error(f"Failed to load population spec: {e}")
272-
raise typer.Exit(1)
273-
274-
# Merge attributes for config generation
275-
merged_attributes = list(pop_spec.attributes)
276-
if scenario_spec.extended_attributes:
277-
merged_attributes.extend(scenario_spec.extended_attributes)
278-
merged_spec = PopulationSpec(
279-
meta=pop_spec.meta,
280-
grounding=pop_spec.grounding,
281-
attributes=merged_attributes,
282-
sampling_order=pop_spec.sampling_order,
283-
)
263+
base_pop_ref = scenario_spec.meta.base_population
264+
if base_pop_ref:
265+
pop_name, pop_version = _parse_base_population_ref(base_pop_ref)
266+
pop_path = study_ctx.get_population_path(pop_name, pop_version)
267+
try:
268+
pop_spec = PopulationSpec.from_yaml(pop_path)
269+
except Exception as e:
270+
out.error(f"Failed to load population spec: {e}")
271+
raise typer.Exit(1)
272+
273+
# Merge attributes for config generation
274+
merged_attributes = list(pop_spec.attributes)
275+
if scenario_spec.extended_attributes:
276+
merged_attributes.extend(scenario_spec.extended_attributes)
277+
merged_spec = PopulationSpec(
278+
meta=pop_spec.meta,
279+
grounding=pop_spec.grounding,
280+
attributes=merged_attributes,
281+
sampling_order=pop_spec.sampling_order,
282+
)
284283

285284
# Checkpoint handling
286285
resume_requested = (

tests/test_compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_creates_valid_scenario(
175175
],
176176
)
177177

178-
mock_timeline.return_value = ([], None, _determine_simulation_config(10)) # No timeline events, no background
178+
mock_timeline.return_value = ([], None, _determine_simulation_config()) # No timeline events, no background
179179

180180
spec, validation_result = create_scenario(
181181
description="Test product launch scenario",
@@ -257,7 +257,7 @@ def test_progress_callback_called(
257257
],
258258
)
259259

260-
mock_timeline.return_value = ([], None, _determine_simulation_config(10)) # No timeline events, no background
260+
mock_timeline.return_value = ([], None, _determine_simulation_config()) # No timeline events, no background
261261

262262
progress_calls = []
263263

0 commit comments

Comments
 (0)