Isolate writable Codex session state for LLM triage runs#12
Merged
R00T-Kim merged 1 commit intoApr 23, 2026
Merged
Conversation
SCOUT was launching in read-only mode, which caused Codex to fail before inference when it tried to initialize its local session/state files. This change gives Codex an isolated writable home under the run directory by default, keeps external CODEX_HOME overrides working, and seeds auth.json into the isolated home so the CLI can still authenticate without writing back into the user's primary Codex state. Constraint: SCOUT should keep Codex writes scoped away from the user's primary ~/.codex state Rejected: Keep read-only sandbox and rely on ~/.codex writes | reproduced readonly session-init failures in llm_triage traces Rejected: Reuse ~/.codex directly with workspace-write | broadens write scope and mixes run-local state with user-global state Confidence: medium Scope-risk: narrow Reversibility: clean Directive: Keep Codex writable state isolated to the run directory unless a caller explicitly provides CODEX_HOME Tested: pytest -q tests/test_llm_driver.py Tested: pytest -q tests/test_llm_driver_conformance.py Tested: python3 -m py_compile src/aiedge/llm_driver.py tests/test_llm_driver.py Not-tested: end-to-end llm_triage success against the live Codex service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change fixes a reproducible Codex CLI session-initialization failure in SCOUT's LLM driver by giving Codex an isolated writable home under the run directory instead of launching it in a fully read-only state.
Problem
In
llm_triage, SCOUT launchedcodex execwith-s read-only. In real runs this caused Codex to fail before inference with errors like:That failure mode was reproduced from saved
llm_traceartifacts in a firmware analysis run.What changed
workspace-writeinstead ofread-only.CODEX_HOMEis not provided, the driver creates an isolated run-local home atrun_dir/.codex-home.CODEX_HOMEis provided outside the run directory, the driver adds it via--add-dirso Codex can write there intentionally.auth.jsonfrom the user's existing Codex home when available, so authentication can continue without writing into the primary global state directory.Why this scope
This PR is intentionally narrow: it fixes the deterministic session/state write failure in the driver. It does not claim to fully resolve every possible live-service/auth/runtime cause of
llm_triagepartial outcomes.Verification
pytest -q tests/test_llm_driver.pypytest -q tests/test_llm_driver_conformance.pypython3 -m py_compile src/aiedge/llm_driver.py tests/test_llm_driver.pyNotes
A follow-up may still be needed for any separate live Codex service/auth issues, but this removes the reproducible SCOUT-side read-only session-init failure.
요약
이 변경은 SCOUT의 LLM 드라이버가 Codex CLI를 완전한 읽기 전용 상태로 실행하면서 발생하던 재현 가능한 세션 초기화 실패를 수정합니다. 이제 Codex는 run 디렉터리 아래의 격리된 writable 홈을 사용합니다.
문제
llm_triage에서 SCOUT는codex exec를-s read-only로 실행하고 있었습니다. 실제 실행에서는 이 때문에 추론 이전 단계에서 아래와 같은 에러로 실패했습니다.이 실패는 실제 펌웨어 분석 run의
llm_trace산출물로 재현 확인했습니다.변경 사항
read-only에서workspace-write로 변경했습니다.CODEX_HOME이 없으면run_dir/.codex-home에 격리된 run-local 홈을 생성합니다.CODEX_HOME이 run 디렉터리 밖에 있으면--add-dir를 추가해서 의도적으로 writable 하게 만듭니다.auth.json을 가능한 경우 복사해서, 전역 상태 디렉터리에 쓰지 않고도 인증을 이어갈 수 있게 했습니다.범위
이 PR은 의도적으로 범위를 좁게 잡았습니다. 즉, 드라이버 레벨의 결정적 session/state write 실패를 고치는 것이 목적입니다.
llm_triage의 모든 partial 원인이 완전히 해결되었다고 주장하지는 않습니다.검증
pytest -q tests/test_llm_driver.pypytest -q tests/test_llm_driver_conformance.pypython3 -m py_compile src/aiedge/llm_driver.py tests/test_llm_driver.py비고
Codex 서비스 인증이나 런타임 쪽의 별도 이슈는 후속 조치가 필요할 수 있지만, 이 변경으로 SCOUT 측에서 재현되던 read-only session-init 실패는 제거합니다.