specmem-hardwicksoftware 3.7.3 → 3.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specmem-hardwicksoftware",
3
- "version": "3.7.3",
3
+ "version": "3.7.4",
4
4
  "type": "module",
5
5
  "description": "Persistent memory system for coding sessions - semantic search with pgvector, token compression, team coordination, file watching. Needs root: installs system-wide hooks, manages docker/PostgreSQL, writes global configs, handles screen sessions. justcalljon.pro",
6
6
  "main": "dist/index.js",
@@ -3731,8 +3731,20 @@ async function indexCodebase(projectPath, ui, embeddingResult) {
3731
3731
 
3732
3732
  client.setTimeout(TIMEOUTS.EMBEDDING_REQUEST * 2); // Longer timeout for batch
3733
3733
 
3734
+ // HARD WALL-CLOCK TIMEOUT: Cannot be reset by data/heartbeats
3735
+ // Prevents infinite hangs on large files where server keeps sending heartbeats
3736
+ const HARD_TIMEOUT_MS = TIMEOUTS.EMBEDDING_REQUEST * 3; // 270s absolute max
3737
+ const hardTimeout = setTimeout(() => {
3738
+ if (!settled) {
3739
+ settled = true;
3740
+ if (!client.destroyed) client.destroy();
3741
+ reject(new Error(`Hard wall-clock timeout after ${HARD_TIMEOUT_MS}ms - embedding took too long (heartbeats: ${heartbeatCount})`));
3742
+ }
3743
+ }, HARD_TIMEOUT_MS);
3744
+
3734
3745
  // Cleanup helper to avoid leaked resources
3735
3746
  const cleanup = () => {
3747
+ clearTimeout(hardTimeout);
3736
3748
  if (!client.destroyed) client.destroy();
3737
3749
  };
3738
3750
 
@@ -4253,6 +4265,16 @@ async function indexCodebase(projectPath, ui, embeddingResult) {
4253
4265
  setPhase('Embedding');
4254
4266
 
4255
4267
  let fileEmbeddings = [];
4268
+ // FIX: If activeSocketPath is gone (socket died), try to revalidate before skipping
4269
+ if (fileEmbedTexts.length > 0 && !activeSocketPath) {
4270
+ initLog('No active socket for embedding phase - attempting revalidation...');
4271
+ const revalidated = await revalidateSocket();
4272
+ if (revalidated) {
4273
+ initLog(`Socket revalidated successfully: ${activeSocketPath}`);
4274
+ } else {
4275
+ initLog('Socket revalidation failed - embeddings will be skipped for this batch');
4276
+ }
4277
+ }
4256
4278
  if (fileEmbedTexts.length > 0 && activeSocketPath) {
4257
4279
  try {
4258
4280
  ui.setSubStatus(`Generating ${fileEmbedTexts.length} embeddings in batch...`);