mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(blocks): skip input validation in dry-run mode for blocks with sentinel credentials
Two fixes for dry-run execution of nested agents:
1. _base.py: Skip validate_data() when execution_context.dry_run is True.
prepare_dry_run() sets credentials=None for OrchestratorBlock (platform
key injected separately), but the block's own JSON schema validation
rejected None as "required property". This caused any dry-run execution
of graphs containing OrchestratorBlock to fail with BlockInputError.
2. agent.py: Check required inner-agent inputs against data["inputs"]
instead of top-level data keys (previous commit 6f03ceeb88).
This commit is contained in:
@@ -698,13 +698,20 @@ class Block(ABC, Generic[BlockSchemaInputType, BlockSchemaOutputType]):
|
||||
if should_pause:
|
||||
return
|
||||
|
||||
# Validate the input data (original or reviewer-modified) once
|
||||
if error := self.input_schema.validate_data(input_data):
|
||||
raise BlockInputError(
|
||||
message=f"Unable to execute block with invalid input data: {error}",
|
||||
block_name=self.name,
|
||||
block_id=self.id,
|
||||
)
|
||||
# Validate the input data (original or reviewer-modified) once.
|
||||
# Skip validation in dry-run mode — sentinel credential values (None)
|
||||
# would fail JSON schema required checks, and simulate_block /
|
||||
# prepare_dry_run have already ensured the input is usable.
|
||||
is_dry_run = getattr(
|
||||
kwargs.get("execution_context"), "dry_run", False
|
||||
)
|
||||
if not is_dry_run:
|
||||
if error := self.input_schema.validate_data(input_data):
|
||||
raise BlockInputError(
|
||||
message=f"Unable to execute block with invalid input data: {error}",
|
||||
block_name=self.name,
|
||||
block_id=self.id,
|
||||
)
|
||||
|
||||
# Use the validated input data
|
||||
async for output_name, output_data in self.run(
|
||||
|
||||
Reference in New Issue
Block a user