Skip to content

Conversation

@bigph00t
Copy link
Owner

Summary

  • Eliminates Windows console popups during daemon spawn and Chroma operations
  • Uses cmd /c start /B workaround on Windows to allow windowsHide: true to work
  • Root cause: detached: true + windowsHide: true are incompatible on Windows

Issues

Fixes thedotmack#748, thedotmack#708, thedotmack#681, thedotmack#676

Test plan

  • Verify no console popups on Windows when worker daemon spawns
  • Verify worker still starts correctly on Linux/macOS
  • Community testing requested for Windows environments

🤖 Generated with Claude Code

@greptile-apps
Copy link

greptile-apps bot commented Jan 18, 2026

Greptile Summary

This PR fixes Windows console popups during daemon spawn and Chroma operations by using WMIC instead of detached: true for process spawning on Windows, and disabling Chroma vector search on Windows entirely.

Key Changes

  • ProcessManager.ts: Replaced spawn() with detached: true with WMIC command execution on Windows, which spawns processes independent of the parent console without popups
  • ChromaSync.ts: Added platform check to disable all Chroma operations on Windows, returning early from sync methods with no-op behavior
  • YAML frontmatter: Added to slash command files for discoverability

Technical Approach

The fix uses WMIC's process call create command on Windows, which creates processes not associated with the parent console. The worker reads its port from settings.json rather than environment variables, so WMIC's inability to pass environment variables is not an issue. On Unix, the standard detached: true spawn approach continues to work as before.

Trade-offs

Disabling Chroma on Windows means vector search functionality is unavailable on that platform until the MCP SDK subprocess spawning can be fixed or migrated to a persistent HTTP server approach.

Confidence Score: 4/5

  • This PR is safe to merge with good community testing on Windows
  • The implementation correctly addresses the Windows console popup issue using WMIC. The approach is sound: WMIC spawns processes independently of the parent console. The worker properly reads configuration from settings file rather than environment variables, so WMIC's limitation doesn't affect functionality. Chroma is safely disabled on Windows with proper no-op behavior. However, the WMIC command uses deprecated Windows tooling (though still widely available), and the fix needs real-world Windows testing to confirm it works across different Windows environments and configurations.
  • src/services/infrastructure/ProcessManager.ts should be monitored for Windows compatibility as WMIC is deprecated in favor of PowerShell cmdlets

Important Files Changed

Filename Overview
src/services/infrastructure/ProcessManager.ts Replaced detached: true with WMIC on Windows to eliminate console popups; environment variables not passed with WMIC but worker reads port from settings file
src/services/sync/ChromaSync.ts Disabled Chroma on Windows to prevent MCP SDK subprocess console popups; returns early from sync methods when disabled

Sequence Diagram

sequenceDiagram
    participant Plugin as Claude Code Plugin
    participant PM as ProcessManager
    participant WMIC as Windows WMIC
    participant Worker as Worker Service
    participant Settings as settings.json
    
    Note over Plugin,Worker: Windows Daemon Spawn Flow
    
    Plugin->>PM: spawnDaemon(scriptPath, port)
    PM->>PM: Check if Windows platform
    
    alt Windows Platform
        PM->>PM: Build WMIC command<br/>(execPath + scriptPath + --daemon)
        Note over PM: Environment variables NOT passed<br/>with WMIC (limitation)
        PM->>WMIC: execSync("wmic process call create ...")
        WMIC-->>PM: Return 0 (immediate)
        Note over WMIC,Worker: Process spawned independently<br/>without console popup
        WMIC->>Worker: Spawn worker process
        Worker->>Settings: Read port from settings.json
        Worker->>Worker: Start HTTP server on port
        Worker->>PM: Write PID file after listen()
    else Unix Platform
        PM->>Worker: spawn() with detached: true
        Note over PM,Worker: Environment variables passed<br/>via spawn options
        Worker->>Worker: Read port from env or settings
        Worker->>Worker: Start HTTP server
        Worker->>PM: Write PID file after listen()
    end
    
    PM-->>Plugin: Return PID (0 on Windows)
    Plugin->>Worker: Health check loop
    Worker-->>Plugin: Ready
Loading

@greptile-apps
Copy link

greptile-apps bot commented Jan 18, 2026

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

…operations

Two changes to fix Windows Terminal popup issues:

1. Worker daemon spawn (ProcessManager.spawnDaemon):
   - Windows: Use WMIC to spawn truly independent process without console
   - WMIC creates processes that survive parent exit and have no console association
   - Properly handles paths with spaces via double-quoting
   - Unix: Unchanged behavior with standard detached spawn

2. PID file handling (worker-service.ts):
   - Worker now writes its own PID after listen() succeeds (all platforms)
   - Removes race condition where spawner wrote PID before worker was ready
   - On Windows, spawner PID was useless anyway

3. Chroma vector search (ChromaSync.ts):
   - Temporarily disabled on Windows to prevent MCP SDK subprocess popups
   - Will be re-enabled when we migrate to persistent HTTP server architecture
   - Windows users still get full observation storage, just no semantic search

Tested on Windows 11 via SSH - worker spawns without console popups,
survives parent process exit, and all lifecycle commands (start/stop/restart)
work correctly.

Fixes thedotmack#748, thedotmack#708, thedotmack#681, thedotmack#676, thedotmack#675

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bigph00t bigph00t force-pushed the fix/windows-console-popups branch from ada1289 to e171557 Compare January 19, 2026 00:36
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +86 to +88
// Windows: Chroma disabled due to MCP SDK spawning console popups
// See: https://github.com/anthropics/claude-mem/issues/675
// Will be re-enabled when we migrate to persistent HTTP server
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Issue reference links to anthropics org instead of current repo

Suggested change
// Windows: Chroma disabled due to MCP SDK spawning console popups
// See: https://github.com/anthropics/claude-mem/issues/675
// Will be re-enabled when we migrate to persistent HTTP server
// Windows: Chroma disabled due to MCP SDK spawning console popups
// See: https://github.com/bigph00t/claude-mem/issues/675
// Will be re-enabled when we migrate to persistent HTTP server
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/sync/ChromaSync.ts
Line: 86:88

Comment:
**syntax:** Issue reference links to anthropics org instead of current repo

```suggestion
  // Windows: Chroma disabled due to MCP SDK spawning console popups
  // See: https://github.com/bigph00t/claude-mem/issues/675
  // Will be re-enabled when we migrate to persistent HTTP server
```

How can I resolve this? If you propose a fix, please make it concise.

Commands /do and /make-plan were not appearing in Claude Code because
they lacked the required YAML frontmatter metadata. Added description
and argument-hint fields to both commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

const execPath = process.execPath;
const script = scriptPath;
// WMIC command format: wmic process call create "\"path1\" \"path2\" args"
const command = `wmic process call create "\\"${execPath}\\" \\"${script}\\" --daemon"`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider migrating from WMIC (deprecated in Windows 11+) to PowerShell Start-Process

Suggested change
const command = `wmic process call create "\\"${execPath}\\" \\"${script}\\" --daemon"`;
const command = `powershell -NoProfile -NonInteractive -WindowStyle Hidden -Command "Start-Process -FilePath '${execPath}' -ArgumentList '\\"${script}\\"','--daemon' -WindowStyle Hidden"`;

The current WMIC approach works well, so this is a minor suggestion for future-proofing.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/infrastructure/ProcessManager.ts
Line: 294:294

Comment:
**style:** Consider migrating from WMIC (deprecated in Windows 11+) to PowerShell `Start-Process`

```suggestion
    const command = `powershell -NoProfile -NonInteractive -WindowStyle Hidden -Command "Start-Process -FilePath '${execPath}' -ArgumentList '\\"${script}\\"','--daemon' -WindowStyle Hidden"`;
```

The current WMIC approach works well, so this is a minor suggestion for future-proofing.

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Windows] Terminal window pops up on every message when realtime hooks are enabled

1 participant