1+ /** Builds minimal, portable environment blocks for managed daemon services. */
12import fs from "node:fs" ;
23import os from "node:os" ;
34import path from "node:path" ;
@@ -65,6 +66,8 @@ export const SERVICE_PROXY_ENV_KEYS = [
6566function readServiceProxyEnvironment (
6667 env : Record < string , string | undefined > ,
6768) : Record < string , string | undefined > {
69+ // Service env intentionally preserves only the canonical OpenClaw proxy knob;
70+ // generic shell proxy vars are audited but not frozen into services.
6871 const proxyUrl = normalizeOptionalString ( env . OPENCLAW_PROXY_URL ) ;
6972 return proxyUrl ? { OPENCLAW_PROXY_URL : proxyUrl } : { } ;
7073}
@@ -90,6 +93,8 @@ function realpathServicePathDir(dir: string): string | undefined {
9093function realpathExistingServicePathDir ( dir : string ) : string | undefined {
9194 const parts : string [ ] = [ ] ;
9295 let current = dir ;
96+ // Resolve the nearest existing ancestor so future-created bin dirs can still
97+ // be compared against the install workspace realpath.
9398 while ( current && current !== path . posix . dirname ( current ) ) {
9499 const realCurrent = realpathServicePathDir ( current ) ;
95100 if ( realCurrent ) {
@@ -333,6 +338,8 @@ function resolveLinuxUserBinDirs(
333338export function getMinimalServicePathParts ( options : MinimalServicePathOptions = { } ) : string [ ] {
334339 const platform = options . platform ?? process . platform ;
335340 if ( platform === "win32" ) {
341+ // Windows scheduled tasks inherit PATH from the task host; generated cmd
342+ // launchers should not freeze install-time PATH snapshots.
336343 return [ ] ;
337344 }
338345
0 commit comments