fix(#22): enforce structured output in code agent#24
Conversation
|
🤖 Review · |
PR Summary by QodoEnforce structured output validation for the code agent
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
55 rules 1.
|
| ## Structured output | ||
|
|
||
| You MUST produce a JSON file at `$FULLSEND_OUTPUT_DIR/$FULLSEND_OUTPUT_FILE` | ||
| (typically `code-result.json`) that documents the target branch for PR | ||
| creation. The `code-implementation` skill describes the schema and the exact | ||
| step where you write it. The post-script reads this file to determine which | ||
| branch to target the PR against. Without this file, the validation loop | ||
| rejects the run and retries. |
There was a problem hiding this comment.
1. Protected paths modified 📜 Skill insight § Compliance
This PR modifies protected governance/infrastructure paths (agents/ and skills/), which require human review and must not be auto-approved. Even with justification, this needs an explicit protected-path compliance flag in review.
Agent Prompt
## Issue description
Protected paths were modified (`agents/`, `skills/`), so the PR must not be auto-approved and needs explicit human review acknowledgment.
## Issue Context
The compliance rule requires a finding whenever protected paths are touched; justification lowers severity but does not remove the requirement.
## Fix Focus Areas
- agents/code.md[95-102]
- skills/code-implementation/SKILL.md[741-776]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| ## Structured output | ||
|
|
||
| You MUST produce a JSON file at `$FULLSEND_OUTPUT_DIR/$FULLSEND_OUTPUT_FILE` | ||
| (typically `code-result.json`) that documents the target branch for PR | ||
| creation. The `code-implementation` skill describes the schema and the exact | ||
| step where you write it. The post-script reads this file to determine which | ||
| branch to target the PR against. Without this file, the validation loop | ||
| rejects the run and retries. | ||
|
|
||
| After writing the file, validate it before exiting: | ||
|
|
||
| ```bash | ||
| fullsend-check-output "${FULLSEND_OUTPUT_DIR}/${FULLSEND_OUTPUT_FILE}" | ||
| ``` | ||
|
|
||
| If validation fails, read the error output, fix the JSON file, and | ||
| re-run the check. If it still fails after 3 attempts, write the best | ||
| JSON you have and exit. | ||
|
|
There was a problem hiding this comment.
2. Structured output section incomplete 📎 Requirement gap ☼ Reliability
agents/code.md adds a "Structured output" section but it does not include the required schema fields/example or explicit instruction to write the output early, and it is not placed between `## Failure handling and ## Detailed implementation procedure` as required. This can leave the code agent without the mandated, self-contained contract guidance and risks repeated harness validation failures.
Agent Prompt
## Issue description
The new `## Structured output` section in `agents/code.md` does not meet the documented compliance requirements: placement is wrong (it appears before `## Failure handling`), and the section lacks schema fields + an example and explicit early-write guidance.
## Issue Context
Rule 1540707 requires a dedicated section positioned between `Failure handling` and `Detailed implementation procedure`, with MUST/MANDATORY language, early-write instruction, schema fields, an example, and `fullsend-check-output` instructions.
## Fix Focus Areas
- agents/code.md[95-130]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
The code agent was missing structured output enforcement, causing validation_loop failures. The review and fix agents both have explicit structured output sections and mandatory final validation steps, but the code agent had neither. Changes to agents/code.md: - Add "Structured output" section documenting the requirement to produce code-result.json and validate with fullsend-check-output - Use hardcoded filename (not FULLSEND_OUTPUT_FILE env var, which is only in runner_env and unavailable inside the sandbox) - Update failure handling to reference structured output in the handoff contract Changes to skills/code-implementation/SKILL.md: - Add step 11 as a mandatory final step to validate structured output against schemas/code-result.schema.json - Hardcode "code-result.json" in step 3 output write (replacing FULLSEND_OUTPUT_FILE env var reference) - Add fullsend-check-output at every post-step-3 exit point: step 4 (open PR), step 6 (label-gated), step 7 (already fixed), step 9c (retry limit exhausted) - Add early-exit guidance in step 3 for steps 4/6/7 - Update progress markers list to include step 11 - Require structured output even for partial work exits Closes #22 Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
b46b157 to
c509828
Compare
|
🤖 Finished Review · ✅ Success · Started 10:54 PM UTC · Completed 11:07 PM UTC |
ReviewFindingsMedium
Low
Labels: PR fixes a bug where the code agent failed validation due to missing structured output instructions. |
Summary
agents/code.mddocumenting the requirement to producecode-result.jsonand validate withfullsend-check-outputskills/code-implementation/SKILL.mdfor final schema validationAligns the code agent with the fix and review agents, which both have explicit structured output enforcement. Without this, the
validation_loopinharness/code.yamlrejects runs because the agent never produces the expected output file.Closes #22