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:
parent
5afd92f8f3
commit
6369f29439
4 changed files with 73 additions and 0 deletions
|
|
@ -36,6 +36,33 @@ class _FakeAgyProcess:
|
|||
|
||||
|
||||
class ProviderRegistryTest(unittest.IsolatedAsyncioTestCase):
|
||||
def test_cli_subprocess_env_backfills_windows_essentials(self):
|
||||
# 런타임 승격 체인의 psutil 환경 이식에서 SystemRoot 가 유실되면 agy(Go)가
|
||||
# 인증서 풀/홈 해석에 실패해 빈 모델 목록을 내놓는다(2026-08-18 실측).
|
||||
scrubbed = {
|
||||
"PATH": r"C:\Windows\System32",
|
||||
"USERPROFILE": r"C:\Users\encep",
|
||||
}
|
||||
with patch.dict(provider_registry.os.environ, scrubbed, clear=True):
|
||||
env = provider_registry._cli_subprocess_env()
|
||||
|
||||
self.assertEqual(env["SystemRoot"], r"C:\Windows")
|
||||
self.assertEqual(env["SystemDrive"], "C:")
|
||||
self.assertEqual(env["ComSpec"], r"C:\Windows\system32\cmd.exe")
|
||||
self.assertEqual(env["PATH"], r"C:\Windows\System32")
|
||||
|
||||
def test_cli_subprocess_env_preserves_existing_essentials(self):
|
||||
# os.environ은 Windows에서 키를 대문자로 정규화한다. 이미 값이 있으면
|
||||
# 기본 케이스 키를 덧붙이지 않고 기존값을 그대로 둔다.
|
||||
scrubbed = {
|
||||
"SYSTEMROOT": r"D:\Win",
|
||||
"PATH": "x",
|
||||
}
|
||||
with patch.dict(provider_registry.os.environ, scrubbed, clear=True):
|
||||
env = provider_registry._cli_subprocess_env()
|
||||
|
||||
self.assertEqual(env["SYSTEMROOT"], r"D:\Win")
|
||||
self.assertNotIn("SystemRoot", env)
|
||||
def setUp(self):
|
||||
provider_registry.clear_capability_cache()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue