fix: persist session completion to database in completeByDbId (#1532)
completeByDbId only cleaned up in-memory state, leaving sdk_sessions rows with status='active' and completed_at=NULL indefinitely. Ghost sessions accumulated and exhausted the agent pool, causing 60s timeout errors. - Add SessionStore.markSessionCompleted() to set status/completed_at/completed_at_epoch - Call it at the start of completeByDbId before in-memory cleanup - Inject SessionStore into SessionCompletionHandler via constructor - Add 4 tests covering status, timestamps, isolation, and non-existent IDs Closes #1532 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,8 @@ export class SessionRoutes extends BaseRouteHandler {
|
||||
super();
|
||||
this.completionHandler = new SessionCompletionHandler(
|
||||
sessionManager,
|
||||
eventBroadcaster
|
||||
eventBroadcaster,
|
||||
dbManager.getSessionStore()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user