fix(backend): guard against None name in _default_for_input_result

When name key exists with explicit None value, _default_for_input_result
would return None for string-typed pins instead of a string. Add
fallback to "sample input" and fix the type hint to reflect nullable.
This commit is contained in:
Zamil Majdy
2026-04-02 14:48:06 +02:00
parent 2578f61abb
commit f1aedfeedd

View File

@@ -370,7 +370,7 @@ def get_dry_run_credentials(
return None
def _default_for_input_result(result_schema: dict[str, Any], name: str) -> Any:
def _default_for_input_result(result_schema: dict[str, Any], name: str | None) -> Any:
"""Return a type-appropriate sample value for an AgentInputBlock's result pin.
Typed subclasses (AgentNumberInputBlock, AgentDateInputBlock, etc.)
@@ -398,7 +398,7 @@ def _default_for_input_result(result_schema: dict[str, Any], name: str) -> Any:
if fmt == "time":
return "00:00:00"
# Default: use the block's name as a sample string.
return name
return name or "sample input"
async def simulate_block(