Pull requests / #3612

#3612 [GUI] Add Opt-In Windows Close To Tray

open · draft · @medking82 · 0 コメント · GitHub で見る

BenchmarksSetup & installServer & APIAMD / HIPNVIDIA / CUDAModels & quantsDocumentationWindowsLinux

本文

## Problem and result

Closing the Windows App with X currently destroys its Host. Keeping only a Tray or Engine alive cannot preserve the full owner Web UI. This opt-in native hook lets a visible companion keep the same App Host alive while X hides the main window. Launching the App again restores the same instance; explicit Windows `--quit` and owner exit retain clean Host shutdown.

## Related discussion

Related: #2034 and #3365. [Native lifecycle scope proposal](https://github.com/Niko1221/Strata/issues/2034#issuecomment-6320053297). Scope agreement is requested, not assumed; this PR is a Draft. The managed-model Tray and App contract proposals keep their separate scope.

## Approach

- Require `STRATA_CLOSE_TO_TRAY=1`, the companion's PID and its absolute executable path. Open and verify that process, retain its exact handle to avoid PID reuse, and hide only after native hiding succeeds. Missing, inaccessible, mismatched or exited owners keep normal X behavior.
- Reuse the original single-instance restore, Host shutdown, resource lookup, shutdown token, Windows Job and signed-updater paths. The native hook is compiled/called only on Windows; no Engine, Control, server, frontend, dependency, installer or default-setting changes are included. No built-in Tray, detached Host, close interceptor, new endpoint or daemon is added.
- Add focused Windows checks. A stale literal App version in one existing crash-report test now follows the package version; runtime logging is unchanged.

## Actual reference screenshot

This is an actual acceptance capture from the deployed native Extension on official App 0.2.2 `011c9e60`, Windows x64, Engine 0.1.47, RTX 5080 16 GB and 61.4 GB usable RAM. Native X hid the App; its companion Open restored the same window, App and Host. Hidden again, owner Web generated `CLOSE_TO_TRAY_FINAL_OK` with the loaded IQ3_S model at effective Context 204800 (200K). Models metadata and Monitor returned HTTP 200 and listener identities stayed unchanged. Explicit Quit and subsequent companion cold-open were also observed. The physical taskbar icon was not clicked by automation.

The screenshot contains only QA content and generic UI. No account identity, hostname, credentials, private path or original user screenshot is published. Incidental usage figures are not a benchmark. This deployed reference has separate resource/companion startup adapters and **is not a claim that this submitted candidate has been installed or GUI-tested**.

![Actual Owner Web Reply While The App Was Hidden](https://raw.githubusercontent.com/medking82/Strata/60ae1685a51c8f6d9c0c9700c59844a2ade2e905/docs/windows-close-to-tray/web-background.jpg)

## Validation

Base: official App 0.2.2 main `011c9e600a93bbc9fd451c563501b5831c32bbca`. Tested candidate source: `39ef5d46623cd086e75764755e1400a4ef9f05c3`. Current head `60ae1685` changes only the screenshot extension and its documentation link. `git diff 39ef5d46..60ae1685 -- apps/desktop/src-tauri .github/workflows/desktop-window-lifecycle.yml` is empty; the tested Rust and build inputs are identical.

**Passed:**

- `git diff --check` and staged diff check on Windows.
- Screenshot visual privacy review and JPEG header audit: no EXIF/XMP/IPTC/comment metadata. Only the QA screenshot is included; raw logs, private config and original screenshots are excluded.
- [Windows Desktop Window Lifecycle](https://github.com/medking82/Strata/actions/runs/39628081736/job/119318592960), Windows GitHub runner: `cargo test --locked -- --test-threads=1` passed **25 tests, 0 failed**, including live/mismatched owner identity, owner exit and exact Quit parsing. `cargo build --locked --release` completed successfully. The disposable build uses an inert compile-only page and no bundled resources; this is an unbundled native executable build, not an installer or GUI acceptance.
- [Portable Monitor Client](https://github.com/medking82/Strata/actions/runs/39628081650): success on the tested candidate commit.
- [Minimal Serving Runtime](https://github.com/medking82/Strata/actions/runs/39628081333): success, including its full server suite with runtime requirements only.
- [Upstream Intake](https://github.com/Niko1221/Strata/actions/runs/39628507319/job/119320111578): success on this PR. Its scheduled `sweep` job is skipped, not a failure.

Observed native build output:

```text
test result: ok. 25 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Finished `release` profile [optimized] target(s) in 4m 18s
```

**Failed:**

- None unresolved in the candidate checks above.

**Not run:**

- Candidate GUI execution, installer/update/restart/logoff, other App versions and Linux/macOS builds. No C++/CUDA/HIP/SYCL/Metal backend is changed or built by this PR. No production model or App setting was changed while preparing it.

## Limits

Companions must provide a visible Open/Exit entry and start the App outside a server-only Job. Process identity validation proves the configured process is alive; it cannot prove the companion offers a usable icon. This does not create a general plugin or browser deployment API. Future-version compatibility and updater execution are unverified. Scope agreement remains outstanding.

Reproduction and evidence boundaries: [Windows Close To Tray Acceptance](https://github.com/medking82/Strata/blob/codex/windows-close-to-tray-20261021/docs/windows-close-to-tray/README.md).

関連リンク

インストール・モデル・リリースへのサイト内リンク。