specmem-hardwicksoftware 3.7.4 → 3.7.5

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.4",
3
+ "version": "3.7.5",
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",
@@ -3129,6 +3129,14 @@ async function indexCodebase(projectPath, ui, embeddingResult) {
3129
3129
  // Use Python directly - built-in thread limiting via torch.set_num_threads()
3130
3130
  initLog('[EMBED] Starting frankenstein-embeddings.py directly');
3131
3131
  const pythonPath = getPythonPath();
3132
+
3133
+ // Redirect stdout/stderr to log file instead of piping
3134
+ // CRITICAL: Piped stdio keeps a reference to the child process even after unref(),
3135
+ // which can cause SIGTERM/SIGPIPE when the parent's event loop is under heavy load
3136
+ // (e.g. during batch embedding). Using 'ignore' or file descriptors prevents this.
3137
+ const embedLogPath = path.join(projectPath, 'specmem', 'sockets', 'embedding-autostart.log');
3138
+ const embedLogFd = fs.openSync(embedLogPath, 'a');
3139
+
3132
3140
  const embeddingProcess = spawn(pythonPath, [embeddingScript], {
3133
3141
  cwd: path.dirname(embeddingScript),
3134
3142
  env: {
@@ -3137,7 +3145,7 @@ async function indexCodebase(projectPath, ui, embeddingResult) {
3137
3145
  SPECMEM_PROJECT_PATH: projectPath
3138
3146
  },
3139
3147
  detached: true,
3140
- stdio: ['ignore', 'pipe', 'pipe']
3148
+ stdio: ['ignore', embedLogFd, embedLogFd]
3141
3149
  });
3142
3150
 
3143
3151
  // error handler BEFORE unref - prevents silent spawn failures
@@ -3145,13 +3153,8 @@ async function indexCodebase(projectPath, ui, embeddingResult) {
3145
3153
  ui.setSubStatus('Embedding spawn error: ' + err.message);
3146
3154
  });
3147
3155
 
3148
- // CRITICAL: Consume stdout/stderr so Python startup banner doesn't leak to terminal
3149
- embeddingProcess.stdout.on('data', (chunk) => {
3150
- initLog('[EMBED-STDOUT] ' + chunk.toString().trim());
3151
- });
3152
- embeddingProcess.stderr.on('data', (chunk) => {
3153
- initLog('[EMBED-STDERR] ' + chunk.toString().trim());
3154
- });
3156
+ // Close the fd in the parent so only the child holds it
3157
+ fs.closeSync(embedLogFd);
3155
3158
 
3156
3159
  embeddingProcess.unref();
3157
3160