[PR #4435] [CLOSED] [Other] Follow this computer's proxy, and keep state intact across a crash #5046

Closed
opened 2026-11-07 16:32:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4435
Author: @xvcezrqpbxtpzblrt
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: host/network-durability-027


📝 Commits (3)

  • 8769346 [Host] Use this computer's proxy, and keep state intact across a crash
  • 18b406e host: the network settings screen that writes the choice
  • 0801f56 host: the tests that pin the proxy variables and the engine download

📊 Changes

31 files changed (+2219 additions, -56 deletions)

View changed files

📝 apps/host/server/agent/harness-runtime.mjs (+10 -1)
➕ apps/host/server/atomic-file.mjs (+174 -0)
📝 apps/host/server/chat-uploads.mjs (+5 -2)
📝 apps/host/server/cloudflared-install.mjs (+4 -1)
📝 apps/host/server/control-runtime.mjs (+4 -1)
➕ apps/host/server/disk-space.mjs (+56 -0)
📝 apps/host/server/engine-install.mjs (+10 -2)
📝 apps/host/server/image-models.mjs (+7 -6)
📝 apps/host/server/index.mjs (+116 -6)
➕ apps/host/server/keep-awake.mjs (+207 -0)
➕ apps/host/server/log-files.mjs (+76 -0)
📝 apps/host/server/model-providers.mjs (+2 -1)
📝 apps/host/server/native-autotune.mjs (+3 -2)
📝 apps/host/server/native-control.mjs (+26 -15)
➕ apps/host/server/net.mjs (+613 -0)
📝 apps/host/server/skill-files.mjs (+4 -3)
📝 apps/host/server/store.mjs (+6 -5)
📝 apps/host/server/updates.mjs (+2 -1)
📝 apps/host/server/web-search-ddg.mjs (+2 -1)
📝 apps/host/server/web-search-keyed.mjs (+7 -6)

...and 11 more files

📄 Description

## Two problems, both in the host's own plumbing

1. Every outside request went straight out. Node's fetch ignores the proxy a Windows PC is set up to use, so on a machine behind Clash, a company proxy or an antivirus that scans HTTPS, downloads, update checks, model API calls and web search either failed or left without the proxy the person expected.

server/net.mjs answers one question - through which door does this request leave? - and then uses it: this computer's own addresses never go through a proxy; the saved choice (follow the system / direct / one address) comes next; following the system reads HTTPS_PROXY/NO_PROXY, then the Windows registry, then goes direct. The registry is read once per 30 s. A proxy that is set but does not answer is an error naming the proxy, never a quiet direct connection. Engine and connector downloads, model providers, the update check and web search all go through it.

2. A power cut could truncate the small files the next start reads (job list, run configuration, workspaces, image models, upload index, skills, settings). They are now written to a temporary file, flushed, renamed, and a .bak of the last good one is kept; a truncated file is never copied over that backup.

Also in this branch, because they are the same layer: the host keeps the computer awake while a run, install or download is in progress (Windows SetThreadExecutionState, caffeinate, systemd-inhibit; STRATA_NO_KEEP_AWAKE=1 turns it off); a download refuses to start below 2 GiB free (and below the size of the model being installed); logs rotate at 64 MiB.

Validation

node --test tests/net.test.mjs tests/offline-start.test.mjs tests/packaged-control.test.mjs tests/atomic-file.test.mjs tests/keep-awake.test.mjs tests/disk-space.test.mjs tests/log-files.test.mjs tests/durability.test.mjs → 58 pass, 0 fail (this branch runs 27 of those files; the rest cover the same modules).

On the machine used: the system proxy (127.0.0.1:10090) is picked up, a real request through it answers, 192.168.*/10.*/172.16-31.* are never sent to a proxy, and a truncated run configuration is reported with its line instead of starting an engine that dies on it.

Limits

  • macOS and Linux read the environment only (no scutil); a PAC script is not executed - the setting says so.
  • The Python Control process has its own downloader and does not read this file; strata update from the Terminal still uses its own proxy handling.
  • Logs written by a running engine or the desktop shell cannot be rotated while their handle is open.
  • The keep-awake behaviour is tested with a fake child process, not by a machine actually going to sleep.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4435 **Author:** [@xvcezrqpbxtpzblrt](https://github.com/xvcezrqpbxtpzblrt) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `host/network-durability-027` --- ### 📝 Commits (3) - [`8769346`](https://github.com/Niko1221/Strata/commit/8769346eec2cc88af062d51b4d06724d953fedf0) [Host] Use this computer's proxy, and keep state intact across a crash - [`18b406e`](https://github.com/Niko1221/Strata/commit/18b406eff01038aa44d05921ab855734f89a2e3f) host: the network settings screen that writes the choice - [`0801f56`](https://github.com/Niko1221/Strata/commit/0801f56aca3b74cdde723f95752c9cb6cd53ce58) host: the tests that pin the proxy variables and the engine download ### 📊 Changes **31 files changed** (+2219 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/server/agent/harness-runtime.mjs` (+10 -1) ➕ `apps/host/server/atomic-file.mjs` (+174 -0) 📝 `apps/host/server/chat-uploads.mjs` (+5 -2) 📝 `apps/host/server/cloudflared-install.mjs` (+4 -1) 📝 `apps/host/server/control-runtime.mjs` (+4 -1) ➕ `apps/host/server/disk-space.mjs` (+56 -0) 📝 `apps/host/server/engine-install.mjs` (+10 -2) 📝 `apps/host/server/image-models.mjs` (+7 -6) 📝 `apps/host/server/index.mjs` (+116 -6) ➕ `apps/host/server/keep-awake.mjs` (+207 -0) ➕ `apps/host/server/log-files.mjs` (+76 -0) 📝 `apps/host/server/model-providers.mjs` (+2 -1) 📝 `apps/host/server/native-autotune.mjs` (+3 -2) 📝 `apps/host/server/native-control.mjs` (+26 -15) ➕ `apps/host/server/net.mjs` (+613 -0) 📝 `apps/host/server/skill-files.mjs` (+4 -3) 📝 `apps/host/server/store.mjs` (+6 -5) 📝 `apps/host/server/updates.mjs` (+2 -1) 📝 `apps/host/server/web-search-ddg.mjs` (+2 -1) 📝 `apps/host/server/web-search-keyed.mjs` (+7 -6) _...and 11 more files_ </details> ### 📄 Description ## Two problems, both in the host's own plumbing **1. Every outside request went straight out.** Node's `fetch` ignores the proxy a Windows PC is set up to use, so on a machine behind Clash, a company proxy or an antivirus that scans HTTPS, downloads, update checks, model API calls and web search either failed or left without the proxy the person expected. `server/net.mjs` answers one question - through which door does this request leave? - and then uses it: this computer's own addresses never go through a proxy; the saved choice (follow the system / direct / one address) comes next; following the system reads `HTTPS_PROXY`/`NO_PROXY`, then the Windows registry, then goes direct. The registry is read once per 30 s. A proxy that is set but does not answer is an error naming the proxy, never a quiet direct connection. Engine and connector downloads, model providers, the update check and web search all go through it. **2. A power cut could truncate the small files the next start reads** (job list, run configuration, workspaces, image models, upload index, skills, settings). They are now written to a temporary file, flushed, renamed, and a `.bak` of the last good one is kept; a truncated file is never copied over that backup. Also in this branch, because they are the same layer: the host keeps the computer awake while a run, install or download is in progress (Windows `SetThreadExecutionState`, `caffeinate`, `systemd-inhibit`; `STRATA_NO_KEEP_AWAKE=1` turns it off); a download refuses to start below 2 GiB free (and below the size of the model being installed); logs rotate at 64 MiB. ## Validation `node --test tests/net.test.mjs tests/offline-start.test.mjs tests/packaged-control.test.mjs tests/atomic-file.test.mjs tests/keep-awake.test.mjs tests/disk-space.test.mjs tests/log-files.test.mjs tests/durability.test.mjs` → 58 pass, 0 fail (this branch runs 27 of those files; the rest cover the same modules). On the machine used: the system proxy (`127.0.0.1:10090`) is picked up, a real request through it answers, `192.168.*`/`10.*`/`172.16-31.*` are never sent to a proxy, and a truncated run configuration is reported with its line instead of starting an engine that dies on it. ## Limits - macOS and Linux read the environment only (no `scutil`); a PAC script is not executed - the setting says so. - The Python Control process has its own downloader and does not read this file; `strata update` from the Terminal still uses its own proxy handling. - Logs written by a running engine or the desktop shell cannot be rotated while their handle is open. - The keep-awake behaviour is tested with a fake child process, not by a machine actually going to sleep. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:32:16 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5046
No description provided.