fix: remove agent pool timeout data loss

This commit is contained in:
Alex Newman
2026-05-04 19:43:45 -07:00
parent 39f1102600
commit 8bef7c6a34
4 changed files with 511 additions and 445 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ export class ClaudeProvider {
const settings = SettingsDefaultsManager.loadFromFile(USER_SETTINGS_PATH);
const maxConcurrent = parseInt(settings.CLAUDE_MEM_MAX_CONCURRENT_AGENTS, 10) || 2;
await waitForSlot(maxConcurrent, 60_000);
await waitForSlot(maxConcurrent);
const isolatedEnv = sanitizeEnv(await buildIsolatedEnvWithFreshOAuth());
const authMethod = getAuthMethodDescription();
@@ -147,16 +147,16 @@ export class SessionRoutes extends BaseRouteHandler {
const pendingStore = this.sessionManager.getPendingMessageStore();
try {
const cleared = pendingStore.clearPendingForSession(session.sessionDbId);
if (cleared > 0) {
logger.error('SESSION', `Cleared pending messages after generator error`, {
const reset = pendingStore.resetProcessingToPending(session.sessionDbId);
if (reset > 0) {
logger.warn('SESSION', `Reset processing messages after generator error`, {
sessionId: session.sessionDbId,
cleared
reset
});
}
} catch (dbError) {
const normalizedDbError = dbError instanceof Error ? dbError : new Error(String(dbError));
logger.error('HTTP', 'Failed to clear pending messages', {
logger.error('HTTP', 'Failed to reset processing messages after generator error', {
sessionId: session.sessionDbId
}, normalizedDbError);
}