CLI 자식 프로세스 환경에 Windows 필수 변수 백필

공개 런타임 승격 체인이 psutil로 이전 프로세스 환경을 통째로 이식하는 과정에서
SystemRoot 가 유실됐고, Go 계열 CLI(agy)는 시스템 인증서 풀/홈 해석에 SystemRoot 가
필요해 agy models 가 조용히 빈 목록을 반환했다(관리자 AI 운영 화면의
'Agy가 선택 가능한 모델을 반환하지 않았습니다' 두 번째 원인).
- _cli_subprocess_env(): 상속 환경에서 빠진 SystemRoot/SystemDrive/ComSpec 만
  기본값으로 백필해 모든 CLI 스폰(_run_process·codex app-server·agy stream·claude 세션)에 적용.
  os.environ 의 Windows 대문자 정규화를 고려한 대소문자 무시 조회
- Set-CompleteProcessEnvironment: 이식본에 빠진 Windows 필수 키를 Machine 스코프
  표준값으로 병합해 승격 체인 자체의 유실을 원천 보강
- 검증: 신규 2단위 RED→GREEN, engine_gateway 65 passed, app 924 passed,
  PS 5.1 parser OK, SystemRoot 제거 환경에서 실제 agy CLI 14모델 live 조회 확인
This commit is contained in:
Yun Chan 2026-08-18 13:25:08 +09:00
parent 5afd92f8f3
commit 6369f29439
4 changed files with 73 additions and 0 deletions

View file

@ -533,6 +533,20 @@ function Save-CompleteProcessEnvironment {
function Set-CompleteProcessEnvironment {
param([System.Collections.IDictionary]$Environment)
# psutil 환경 캡색에서 SystemRoot 같은 Windows 필수 변수가 유실되면 Go 계열 CLI(agy)가
# 시스템 인증서 풀/홈 해석에 실패해 조용히 빈 결과를 낸다(2026-08-18 실측). 이식본에
# 빠진 필수 키는 Machine 스코프 표준값으로 되살린다.
$windowsEssentials = @('SystemRoot', 'windir', 'SystemDrive', 'ComSpec')
foreach ($name in $windowsEssentials) {
$missing = -not $Environment.Contains($name) -or [string]::IsNullOrWhiteSpace([string]$Environment[$name])
if ($missing) {
$machineValue = [System.Environment]::GetEnvironmentVariable($name, 'Machine')
if ($machineValue) {
$Environment[$name] = $machineValue
}
}
}
$current = [System.Environment]::GetEnvironmentVariables(
[System.EnvironmentVariableTarget]::Process
)