Skip to content

Feature/ab#32006 ai retry and output validation#2106

Draft
jacobwillsmith wants to merge 4 commits intodevfrom
feature/AB#32006-AIRetryAndOutputValidation
Draft

Feature/ab#32006 ai retry and output validation#2106
jacobwillsmith wants to merge 4 commits intodevfrom
feature/AB#32006-AIRetryAndOutputValidation

Conversation

@jacobwillsmith
Copy link

Pull request overview

This pull request adds generic retry handling with output-shape validation to AI generation paths in OpenAIService. The goal is to reduce transient malformed/partial model responses from being accepted while keeping existing service behavior unchanged when valid output is produced.

It also includes a targeted fix for scoresheet section validation so expected question IDs are extracted from both supported section payload shapes ([...] and { questions: [...] }), avoiding false retry exhaustion on valid responses.

Changes:

  • Added a reusable GenerateWithRetryAsync helper with bounded attempts and validator callbacks
  • Applied retry+validation flow to attachment summary, application analysis, full scoresheet answers, and section scoresheet answers
  • Added JSON shape validators for each AI output contract before accepting responses
  • Added section question-ID extraction support for both array and object-with-questions schema payloads
  • Added structured warning logs for retry attempts and exhausted retries

# Conflicts:
#	applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/OpenAIService.cs

# Conflicts:
#	applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/OpenAIService.cs
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 465
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 465
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 465
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant