fix(backend): don't null credentials in dry-run prepare_dry_run

validate_data strips None values from input_data before JSON schema
validation. Setting credentials=None caused the field to be absent,
failing the required check. Keep original credentials in input_data
(actual platform creds injected via extra_exec_kwargs in manager.py).

This fixes OrchestratorBlock failing with "credentials is a required
property" when executed as part of a child graph in dry-run mode.
This commit is contained in:
Zamil Majdy
2026-04-02 10:35:08 +02:00
parent 5551da674e
commit 8a4a16ec5c
2 changed files with 8 additions and 4 deletions

View File

@@ -324,13 +324,15 @@ def prepare_dry_run(block: Any, input_data: dict[str, Any]) -> dict[str, Any] |
max_iters = 1 if original != 0 else 0
sim_model = _simulator_model()
# Keep the original credentials dict in input_data so the block's
# JSON schema validation passes (validate_data strips None values,
# making the field absent and failing the "required" check).
# The actual credentials are injected via extra_exec_kwargs in
# manager.py using _dry_run_api_key.
return {
**input_data,
"agent_mode_max_iterations": max_iters,
"model": sim_model,
# Signal to manager.py that credentials should be skipped —
# the platform key is injected via _dry_run_credentials().
"credentials": None,
"_dry_run_api_key": or_key,
}

View File

@@ -158,7 +158,9 @@ class TestPrepareDryRun:
assert result["agent_mode_max_iterations"] == 1
assert result["other"] == "val"
assert result["model"] != "gpt-4o" # overridden to simulation model
assert result["credentials"] is None
# credentials left as-is so block schema validation passes —
# actual creds injected via extra_exec_kwargs in manager.py
assert "credentials" not in result
assert result["_dry_run_api_key"] == "sk-or-test-key"
def test_orchestrator_zero_stays_zero(self) -> None: