In a pipeline where a test-writing agent passes its output to a code-review agent, the code-review agent receives a handoff artifact with a malformed schema — the required testCoverage field is missing. What is the correct behavior for the receiving agent?
Select an answer to reveal the explanation.
Short Explanation
If a relay runner gets a cracked baton, they don’t keep running and hope it holds — they stop and tell the referee. You should reject malformed handoffs with structured error signals to the orchestrator, not silently compensate for upstream failures.
Full Explanation
The correct behavior for a receiving agent encountering a malformed handoff is to reject the artifact immediately, log a structured error that identifies the specific schema violation and attributes it to the sending agent, and signal the orchestrator. This is critical for two reasons: first, proceeding with incomplete data can cascade errors forward in the pipeline, making the final output incorrect in ways that are hard to trace back; second, surfacing the error to the orchestrator allows it to apply the appropriate recovery pattern, such as re-running the sending agent, escalating to human review, or applying a fallback. Proceeding with the review using available fields and assuming a default value for the missing testCoverage field is dangerous because testCoverage is a required field — it is required precisely because the review logic depends on it. Substituting a default value silently introduces an incorrect assumption into the review and produces a result that appears complete but is not. This is a form of silent failure. Attempting to infer the testCoverage value by re-reading the test files referenced in the artifact makes the receiving agent take on the responsibility of the sending agent. This creates tight coupling — the code-review agent must now understand the test-coverage measurement logic that belongs to the test-writing agent. It also means the error in the sending agent is masked rather than corrected. Completing the review without the testCoverage field and appending a note to the output indicating the field was missing is better than the default-value or inference approaches in terms of transparency, but it still produces a partial output that downstream consumers may incorrectly treat as complete. The orchestrator is not notified in a structured way, making recovery difficult. Structured rejection signaling is the correct mechanism for escalating handoff failures.