Skip to content

fix(memory): keep Windows background service console-free - #368

Merged
syzsunshine219 merged 1 commit into
MemTensor:release/v1.1.3from
syzsunshine219:codex/fix-windows-memory-console
Sep 7, 2026
Merged

syzsunshine219 merged 1 commit into
MemTensor:release/v1.1.3from
syzsunshine219:codex/fix-windows-memory-console

Conversation

@syzsunshine219

Copy link
Copy Markdown
Collaborator

Memmy v1.1.2 on Windows can leave a persistent CMD window showing Memory capture and summary logs. The login task launches a .cmd directly, and the service launcher inherits its console. Hiding the installer's schtasks call cannot hide a task started independently by Task Scheduler.

This change starts the task through a hidden WScript host that waits for Node, keeps the service child attached, and appends stdout/stderr and launcher errors to memory-service/logs/service.log and service-error.log. Task settings ignore duplicate runs, remove the execution time limit, and allow background operation on battery. Windows standalone restart uses the existing local service rebuild loop so it does not depend on a helper surviving termination of its own task.

Existing launchers are refreshed on install, compatible reuse and start. Desktop also repairs a retained legacy task before returning early for a healthy compatible runtime, waits for a live database owner to finish startup/migrations first, and re-probes before taking ownership. Repair matches only the old task command for the current home, updates its definition without starting it, and preserves configuration, data and compatible runtime selection.

Validation:

  • Regression tests were observed failing before implementation for task entry/logging/refresh/stop behavior, Windows restart dispatch and Desktop's same-version reuse path.
  • Targeted Memory/CLI suites: 79 passed, 1 Windows-only integration test skipped on macOS.
  • Targeted Desktop lifecycle suites: 64 passed.

Windows native validation remains required: this development host is macOS. An opt-in integration test creates a unique temporary task and checks the real WScript/Node process tree, duplicate runs, stop/start, Unicode paths, output logs and main-window handles. On an interactive Windows desktop, run in PowerShell:

$env:MEMMY_WINDOWS_SERVICE_INTEGRATION = '1'
npm test -w @memmy/memory -- tests/runtime-installer-windows.integration.test.ts

Also visually confirm there is no transient console flash during install/login/restart. The integration test never registers the product's default task.

Target: release/v1.1.3. No version publication or merge is included.

Memmy v1.1.2 on Windows can leave a persistent CMD window showing Memory capture and summary logs. The login task launches a `.cmd` directly, and the service launcher inherits its console. Hiding the installer's `schtasks` call cannot hide a task started independently by Task Scheduler.

This change starts the task through a hidden WScript host that waits for Node, keeps the service child attached, and appends stdout/stderr and launcher errors to `memory-service/logs/service.log` and `service-error.log`. Task settings ignore duplicate runs, remove the execution time limit, and allow background operation on battery. Windows standalone restart uses the existing local service rebuild loop so it does not depend on a helper surviving termination of its own task.

Existing launchers are refreshed on install, compatible reuse and start. Desktop also repairs a retained legacy task before returning early for a healthy compatible runtime, waits for a live database owner to finish startup/migrations first, and re-probes before taking ownership. Repair matches only the old task command for the current home, updates its definition without starting it, and preserves configuration, data and compatible runtime selection.

Validation:
- Regression tests were observed failing before implementation for task entry/logging/refresh/stop behavior, Windows restart dispatch and Desktop's same-version reuse path.
- Targeted Memory/CLI suites: 79 passed, 1 Windows-only integration test skipped on macOS.
- Targeted Desktop lifecycle suites: 64 passed.

Windows native validation remains required: this development host is macOS. An opt-in integration test creates a unique temporary task and checks the real WScript/Node process tree, duplicate runs, stop/start, Unicode paths, output logs and main-window handles. On an interactive Windows desktop, run in PowerShell:

```powershell
$env:MEMMY_WINDOWS_SERVICE_INTEGRATION = '1'
npm test -w @memmy/memory -- tests/runtime-installer-windows.integration.test.ts
```

Also visually confirm there is no transient console flash during install/login/restart. The integration test never registers the product's default task.

Target: `release/v1.1.3`. No version publication or merge is included.
@syzsunshine219

Copy link
Copy Markdown
Collaborator Author

Project Harness review handoff marker. Only reviews submitted strictly after this GitHub timestamp qualify.

@syzsunshine219
syzsunshine219 marked this pull request as ready for review September 7, 2026 07:09
@syzsunshine219
syzsunshine219 merged commit 6486fc2 into MemTensor:release/v1.1.3 Sep 7, 2026
3 checks passed
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.

1 participant