fix: resolve all CodeRabbit review comments

Critical fixes:
- GeminiCliHooksInstaller: wrap install/uninstall prep in try/catch to maintain
  numeric return contract
- McpIntegrations: move mkdirSync inside try block for Goose installer

Major fixes:
- import-xml-observations: guard invalid dates before toISOString()
- runtime.ts: guard response.json() parsing
- WorktreeAdoption: delay adoptedSqliteIds mutation until SQL succeeds
- CursorHooksInstaller: move mkdirSync inside try block
- McpIntegrations: throw on failed claude-mem block replacement
- OpenClawInstaller: propagate parse failure instead of returning {}
- OpenClawInstaller: move mkdirSync inside try block
- WindsurfHooksInstaller: validate hooks.json shape with optional chaining
- timeline/queries: pass normalized Error directly to logger
- ChromaSync: use composite dedup key (entityType:id) to prevent cross-type collisions
- EnvManager: wrap preflight directory/file ops in try/catch with ENV logging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-04-19 20:17:57 -07:00
parent 30a0ab4ddb
commit d2eb89d27f
11 changed files with 104 additions and 84 deletions
+9 -3
View File
@@ -809,7 +809,7 @@ export class ChromaSync {
// chroma_query_documents returns nested arrays (one per query text)
// We always pass a single query text, so we access [0]
const ids: number[] = [];
const seen = new Set<number>();
const seen = new Set<string>();
const docIds = results?.ids?.[0] || [];
const rawMetadatas = results?.metadatas?.[0] || [];
const rawDistances = results?.distances?.[0] || [];
@@ -828,16 +828,22 @@ export class ChromaSync {
const promptMatch = docId.match(/prompt_(\d+)/);
let sqliteId: number | null = null;
let entityType: string | null = null;
if (obsMatch) {
sqliteId = parseInt(obsMatch[1], 10);
entityType = 'observation';
} else if (summaryMatch) {
sqliteId = parseInt(summaryMatch[1], 10);
entityType = 'session_summary';
} else if (promptMatch) {
sqliteId = parseInt(promptMatch[1], 10);
entityType = 'user_prompt';
}
if (sqliteId !== null && !seen.has(sqliteId)) {
seen.add(sqliteId);
if (sqliteId !== null && entityType) {
const dedupeKey = `${entityType}:${sqliteId}`;
if (seen.has(dedupeKey)) continue;
seen.add(dedupeKey);
ids.push(sqliteId);
metadatas.push(rawMetadatas[i] ?? null);
distances.push(rawDistances[i] ?? 0);