Report missing_data safe output calls in agent failure issues#13709
Report missing_data safe output calls in agent failure issues#13709
Conversation
- Add buildMissingDataContext() function to load and format missing_data messages
- Import formatMissingData from missing_info_formatter
- Update handle_agent_failure.cjs to include missing_data_context in both issue and comment templates
- Update agent_failure_issue.md and agent_failure_comment.md templates to include {missing_data_context} placeholder
- Add comprehensive test for missing_data reporting functionality
- Update test mocks to include missing_data_context placeholder
This ensures that when an agent calls the missing_data safe output, the information is reported in the failure issue/comment created by the conclusion job, making it easier to diagnose and debug workflow failures.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Wrap cleanup code in try-catch to prevent cleanup errors from failing the test - Address code review feedback about proper cleanup in test cases Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for reporting missing_data safe output calls in agent workflow failure issues and comments, improving diagnostic information for debugging failed workflows.
Changes:
- Added
loadMissingDataMessages()andbuildMissingDataContext()functions to extract and format missing_data from agent output - Updated
agent_failure_issue.mdandagent_failure_comment.mdtemplates to include{missing_data_context}placeholder - Added comprehensive test coverage validating missing_data appears in failure issues with all expected fields
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| actions/setup/js/handle_agent_failure.cjs | Added functions to load and format missing_data messages from agent output, integrated into both issue and comment creation flows |
| actions/setup/md/agent_failure_issue.md | Added {missing_data_context} placeholder to template |
| actions/setup/md/agent_failure_comment.md | Added {missing_data_context} placeholder to template |
| actions/setup/js/handle_agent_failure.test.cjs | Added comprehensive test validating missing_data appears in failure issues with all fields (data_type, reason, context, alternatives) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Clean up temp file (use try-catch to ensure cleanup doesn't fail test) | ||
| try { | ||
| fs.unlinkSync(agentOutputPath); | ||
| fs.rmdirSync(tempDir); |
There was a problem hiding this comment.
The cleanup logic uses fs.rmdirSync() which only removes empty directories. Since the directory should only contain agent_output.json which is deleted on line 1278, this should work. However, consider using fs.rmSync(tempDir, { recursive: true }) (available in Node.js 14.14.0+) for more robust cleanup that doesn't rely on the directory being empty.
| fs.rmdirSync(tempDir); | |
| fs.rmSync(tempDir, { recursive: true, force: true }); |
Agent workflows calling
missing_datasafe output had this diagnostic information silently dropped in conclusion job failure reports, making debugging failures unnecessarily difficult.Changes
Core logic (
handle_agent_failure.cjs):loadMissingDataMessages()- extracts missing_data from agent output filebuildMissingDataContext()- formats using existingformatMissingData()helpermissing_data_contextto both issue and comment template contextsTemplates:
agent_failure_issue.mdandagent_failure_comment.mdnow include{missing_data_context}placeholderTest coverage:
Output
Failure issues now include:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.