feat(chat-api): persist review results and skip re-review for reviewed reports#304
Closed
willvelida wants to merge 0 commit intomainfrom
Closed
feat(chat-api): persist review results and skip re-review for reviewed reports#304willvelida wants to merge 0 commit intomainfrom
willvelida wants to merge 0 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Biotrackr.Chat.Api’s A2AReportTool to persist Claude review results back to Reporting.Api and to skip re-review when a report is already in the "reviewed" state, presenting persisted review metadata instead.
Changes:
- Split
"generated"vs"reviewed"status handling to either (a) review+persist+present or (b) present persisted review directly. - Added best-effort
PUT /api/reports/{jobId}/reviewpersistence after a completed review. - Extended
ReportMetadataDtoand added unit tests for persistence + skip behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Biotrackr.Chat.Api/Biotrackr.Chat.Api/Tools/A2AReportTool.cs |
Adds review persistence PUT and introduces a fast-path to present persisted review data for "reviewed" reports. |
src/Biotrackr.Chat.Api/Biotrackr.Chat.Api.UnitTests/Tools/A2AReportToolShould.cs |
Adds unit tests covering PUT persistence, skip persistence, skip reviewer on reviewed status, and graceful handling of PUT failures/409. |
16ceb3d to
8a6267e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates Chat.Api's
A2AReportToolto persist review results back to Reporting.Api and skip Claude re-review for already-reviewed reports. This is PR 2 of Issue #269 (Phase 2 of the ReportReviewerService fail-closed fix).After this change, the full review persistence flow works end-to-end:
GET /api/reports/{jobId}returns"generated"PUT /api/reports/{jobId}/reviewGETreturns"reviewed"→ Chat.Api presents persisted review data without calling ClaudeChanges
A2AReportTool.cs
"generated"→ReviewPersistAndPresentAsync(review + PUT + present),"reviewed"→PresentPersistedReview(skip Claude, present persisted data)PUT /api/reports/{jobId}/review. Failure is non-blocking (logs warning, still presents review to user) per ASI08.PresentPersistedReviewmethod: ReadsReviewApproved,ReviewConcerns,ReviewValidatedSummaryfrom GET metadata. Approved reports show validated summary; flagged reports show concerns list.ReportMetadataDto: Added 4 review fields (ReviewApproved,ReviewConcerns,ReviewValidatedSummary,ReviewedAt) to deserialize persisted review data.Tests (6 new)
PersistReviewResult_WhenStatusIsGenerated_AndReviewCompleted— verifies PUT calledSkipPersistence_WhenStatusIsGenerated_AndReviewNotCompleted— verifies PUT NOT calledPresentPersistedReview_WhenStatusIsReviewed_AndApproved— verifies reviewer NOT calledPresentPersistedConcerns_WhenStatusIsReviewed_AndNotApproved— verifies concerns in outputHandlePutFailureGracefully_WhenPersistenceFails— PUT throws, result still returnedHandlePut409Gracefully_WhenAlreadyReviewed— PUT returns 409, result still returnedValidation
GetReportStatusTool(obsolete) was NOT modified — onlyA2AReportToolwas updatedContext
IMemoryCachefrom Phase 1 acts as defense-in-depth.