123123213weqw opened a new pull request, #5810:
URL: https://github.com/apache/rocketmq-dashboard/pull/5810

   ## Why
   
   The on-request `AiConversationService.delete` stops a conversation's active 
run before it removes anything: the run's subprocess is still writing into the 
workspace and its worker is still writing event rows, so the delete path kills 
the run first.
   
   The scheduled retention pass had no such check. `purgeExpired() -> 
deleteCascade()` deleted the events, the runs, the conversation row and the 
workspace of any conversation past the retention age — including one with a run 
still in flight. The worker then keeps streaming into a workspace directory 
that no longer exists, its terminal `runRepository.update` hits a deleted row, 
and its sink inserts event rows for a conversation nobody can read any more. 
The two delete paths are twins, and only one of them was guarded.
   
   ## What changed
   
   `deleteExpiredConversations` now drops the ids that still have a QUEUED or 
RUNNING run (`runRepository.findActiveByConversationId`) before cascading. 
Retention has no mandate to kill an answer the user is watching, so a busy 
conversation is simply left for a later pass instead of being stopped the way 
an explicit delete stops it. A partially-skipped batch is smaller than the 
batch size, so the existing `deleted < batchSize` stop condition already keeps 
the pass from re-querying the same backlog.
   
   ## Validation
   
   Red test first: 
`retentionShouldSkipAConversationWhoseRunIsStillInFlightTest` fails on 
`upstream-studio` — the cascade deletes conversations 1 and 2 even though 2 has 
a RUNNING run — and passes with the fix. Full `AiConversationServiceTest` (22 
tests) green.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to