fix: worker startup crash and missing observation columns
Two bugs fixed: 1. SessionCompletionHandler called dbManager.getSessionStore() during WorkerService construction, before DB initialization. Changed to accept DatabaseManager and defer the call to runtime. 2. migration009 (generated_by_model, relevance_count columns) only ran via the deprecated MigrationRunner path, never through SessionStore's migration chain. Added addObservationModelColumns() to SessionStore constructor. Checks column existence directly since schema_versions may have been marked applied without the ALTER TABLE succeeding. Also removed duplicate transcriptWatcher declaration and shutdown block (merge artifact). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,14 +11,14 @@
|
||||
|
||||
import { SessionManager } from '../SessionManager.js';
|
||||
import { SessionEventBroadcaster } from '../events/SessionEventBroadcaster.js';
|
||||
import { SessionStore } from '../../sqlite/SessionStore.js';
|
||||
import { DatabaseManager } from '../DatabaseManager.js';
|
||||
import { logger } from '../../../utils/logger.js';
|
||||
|
||||
export class SessionCompletionHandler {
|
||||
constructor(
|
||||
private sessionManager: SessionManager,
|
||||
private eventBroadcaster: SessionEventBroadcaster,
|
||||
private sessionStore: SessionStore
|
||||
private dbManager: DatabaseManager
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ export class SessionCompletionHandler {
|
||||
*/
|
||||
async completeByDbId(sessionDbId: number): Promise<void> {
|
||||
// Persist completion to database before in-memory cleanup (fix for #1532)
|
||||
this.sessionStore.markSessionCompleted(sessionDbId);
|
||||
this.dbManager.getSessionStore().markSessionCompleted(sessionDbId);
|
||||
|
||||
// Delete from session manager (aborts SDK agent via SIGTERM)
|
||||
await this.sessionManager.deleteSession(sessionDbId);
|
||||
|
||||
Reference in New Issue
Block a user