fix: address PR #1641 review comments (round 2)
- Remove duplicate TranscriptWatcher/config imports in worker-service.ts - Use normalizePlatformSource in handleSessionInitByClaudeId for consistency - Don't skip DB completion when session not in memory (completeByClaudeId) - Add try-catch around fetch in useContextPreview refresh callback - Deduplicate store.getAllProjects() call in DataRoutes - Fix malformed comment separators in migration runner - Fix missing closing brace and JSDoc opener (merge artifact) in migration runner Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -657,7 +657,8 @@ export class MigrationRunner {
|
||||
this.db.run('BEGIN TRANSACTION');
|
||||
|
||||
try {
|
||||
// =================================== // 1. Recreate observations table
|
||||
// ===================================
|
||||
// 1. Recreate observations table
|
||||
// ===================================
|
||||
// Drop FTS triggers first (they reference the observations table)
|
||||
this.db.run('DROP TRIGGER IF EXISTS observations_ai');
|
||||
@@ -731,7 +732,8 @@ export class MigrationRunner {
|
||||
`);
|
||||
}
|
||||
|
||||
// =================================== // 2. Recreate session_summaries table
|
||||
// ===================================
|
||||
// 2. Recreate session_summaries table
|
||||
// ===================================
|
||||
// Clean up leftover temp table from a previously-crashed run
|
||||
this.db.run('DROP TABLE IF EXISTS session_summaries_new');
|
||||
@@ -889,6 +891,9 @@ export class MigrationRunner {
|
||||
|
||||
this.db.prepare('INSERT OR IGNORE INTO schema_versions (version, applied_at) VALUES (?, ?)').run(24, new Date().toISOString());
|
||||
logger.debug('DB', 'Created observation_feedback table for usage tracking');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add platform_source column to sdk_sessions for Claude/Codex isolation (migration 24)
|
||||
*/
|
||||
private addSessionPlatformSourceColumn(): void {
|
||||
|
||||
@@ -131,10 +131,6 @@ import { MemoryRoutes } from './worker/http/routes/MemoryRoutes.js';
|
||||
// Process management for zombie cleanup (Issue #737)
|
||||
import { startOrphanReaper, reapOrphanedProcesses, getProcessBySession, ensureProcessExit } from './worker/ProcessRegistry.js';
|
||||
|
||||
// Transcript watcher for external CLI session monitoring
|
||||
import { TranscriptWatcher } from './transcripts/watcher.js';
|
||||
import { loadTranscriptWatchConfig, expandHomePath, DEFAULT_CONFIG_PATH as TRANSCRIPT_CONFIG_PATH } from './transcripts/config.js';
|
||||
|
||||
/**
|
||||
* Build JSON status output for hook framework communication.
|
||||
* This is a pure function extracted for testability.
|
||||
|
||||
@@ -284,10 +284,11 @@ export class DataRoutes extends BaseRouteHandler {
|
||||
const platformSource = req.query.platformSource as string | undefined;
|
||||
|
||||
if (platformSource) {
|
||||
const projects = store.getAllProjects(platformSource);
|
||||
res.json({
|
||||
projects: store.getAllProjects(platformSource),
|
||||
projects,
|
||||
sources: [platformSource],
|
||||
projectsBySource: { [platformSource]: store.getAllProjects(platformSource) }
|
||||
projectsBySource: { [platformSource]: projects }
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -706,15 +706,14 @@ export class SessionRoutes extends BaseRouteHandler {
|
||||
const activeSession = this.sessionManager.getSession(sessionDbId);
|
||||
if (!activeSession) {
|
||||
// Session may not be in memory (already completed or never initialized)
|
||||
logger.debug('SESSION', 'session-complete: Session not in active map', {
|
||||
// Still proceed with DB-backed completion so the row gets marked completed
|
||||
logger.debug('SESSION', 'session-complete: Session not in active map; continuing with DB-backed completion', {
|
||||
contentSessionId,
|
||||
sessionDbId
|
||||
});
|
||||
res.json({ status: 'skipped', reason: 'not_active' });
|
||||
return;
|
||||
}
|
||||
|
||||
// Complete the session (removes from active sessions map)
|
||||
// Complete the session (removes from active sessions map if present)
|
||||
// Note: The Stop hook (summarize handler) waits for pending work before calling
|
||||
// this endpoint. No polling here — that's the hook's responsibility.
|
||||
await this.completionHandler.completeByDbId(sessionDbId);
|
||||
@@ -724,7 +723,7 @@ export class SessionRoutes extends BaseRouteHandler {
|
||||
sessionDbId
|
||||
});
|
||||
|
||||
res.json({ status: 'completed', sessionDbId });
|
||||
res.json({ status: activeSession ? 'completed' : 'completed_db_only', sessionDbId });
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -746,7 +745,7 @@ export class SessionRoutes extends BaseRouteHandler {
|
||||
// may omit prompt/project in their payload (#838, #1049)
|
||||
const project = req.body.project || 'unknown';
|
||||
const prompt = req.body.prompt || '[media prompt]';
|
||||
const platformSource = req.body.platformSource || 'claude';
|
||||
const platformSource = normalizePlatformSource(req.body.platformSource);
|
||||
const customTitle = req.body.customTitle || undefined;
|
||||
|
||||
logger.info('HTTP', 'SessionRoutes: handleSessionInitByClaudeId called', {
|
||||
|
||||
@@ -96,12 +96,16 @@ export function useContextPreview(settings: Settings): UseContextPreviewResult {
|
||||
params.append('platformSource', selectedSource);
|
||||
}
|
||||
|
||||
const response = await fetch(`/api/context/preview?${params}`);
|
||||
const text = await response.text();
|
||||
try {
|
||||
const response = await fetch(`/api/context/preview?${params}`);
|
||||
const text = await response.text();
|
||||
|
||||
if (response.ok) {
|
||||
setPreview(text);
|
||||
} else {
|
||||
if (response.ok) {
|
||||
setPreview(text);
|
||||
} else {
|
||||
setError('Failed to load preview');
|
||||
}
|
||||
} catch {
|
||||
setError('Failed to load preview');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user