15 KiB
Step 0: 유한 실행시간 조정과 정상 검증 경로 보존
- Feature ID:
mitc4-shell-feast-eigen - Plan owner:
implementation-planning-agent - Execution owner:
implementation-agent - Input contract revision:
r2 - Phase:
mitc4-shell-feast-eigen-execution-prep - Requirement:
FEM-REQ-MITC4-EIGEN-023/025;MFE-C27,IO-T11 - 이 Step은 운영준비이고 solver physics/C++ 기능 변경이 아니다.
필수 입력
Feature 폴더 docs/mitc4-shell-feast-eigen/와 다음 management/approved bundle을 읽는다.
- AGENTS.md
- docs/SOLVER_AGENT_DESIGN.md
- docs/FEATURE_DOCUMENTATION.md
- docs/PRD.md
- docs/ARCHITECTURE.md
- docs/ADR.md
- docs/CODINGSTYLE.md
- docs/TOLERANCE.md
- .codex/skills/fem-implementation-tdd/SKILL.md
- .agents/skills/harness/SKILL.md
- .codex/agents/implementation-agent.toml
- docs/mitc4-shell-feast-eigen/FEATURED_AGENTS.md
- docs/mitc4-shell-feast-eigen/PRD.md
- docs/mitc4-shell-feast-eigen/ADR.md
- docs/mitc4-shell-feast-eigen/coordination.md
- docs/mitc4-shell-feast-eigen/requirements.md
- docs/mitc4-shell-feast-eigen/requirements-evidence.md
- docs/mitc4-shell-feast-eigen/research.md
- docs/mitc4-shell-feast-eigen/research-evidence.md
- docs/mitc4-shell-feast-eigen/formulation.md
- docs/mitc4-shell-feast-eigen/formulation-mass.md
- docs/mitc4-shell-feast-eigen/formulation-eigen.md
- docs/mitc4-shell-feast-eigen/formulation-verification.md
- docs/mitc4-shell-feast-eigen/formulation-stabilization.md
- docs/mitc4-shell-feast-eigen/numerical-review.md
- docs/mitc4-shell-feast-eigen/numerical-review-evidence.md
- docs/mitc4-shell-feast-eigen/numerical-review-controls.md
- docs/mitc4-shell-feast-eigen/numerical-review-cases.md
- docs/mitc4-shell-feast-eigen/reference-model.md
- docs/mitc4-shell-feast-eigen/io.md
- docs/mitc4-shell-feast-eigen/io-input.md
- docs/mitc4-shell-feast-eigen/io-schema.md
- docs/mitc4-shell-feast-eigen/io-mapping.md
- docs/mitc4-shell-feast-eigen/implementation-plan.md
- docs/mitc4-shell-feast-eigen/implementation-environment.md
- docs/mitc4-shell-feast-eigen/implementation-interfaces.md
- docs/mitc4-shell-feast-eigen/implementation-verification.md
추가 필수: 현재 Executor, 등록 hooks, Stop, CommandSpec, process, config, CMake adapter, HARNESS, WORKFLOW, 환경·activation 상세. 현재 config schema에는 timeout option이 없다. 이번에 새 config field를 만들지 않는다.
재개 시 복구 계획과 실제 classifier 재현을 추가 입력으로 읽는다. 아래 classifier delta는 기존 owned scripts/execute.py/tests/test_execute.py에 한정된 TDD 작업이다. 현재 blocked history와 실제 Hook 쓰기 거부는 그대로 보존한다. 현재 WIP 보존 뒤 별도 Correction Agent가 classifier 소스/테스트와 corrections.md를 먼저 완성한다. 그 실제 결과·별도 checkpoint 감사·수정 classifier를 읽는 새 process activation이 완료되기 전 이 prep를 재실행하지 않는다. 재개 Implementation은 선행 RED/GREEN evidence를 읽고 아래 회귀를 다시 실행하며, 이미 통과한 assertion을 새 RED라고 주장하지 않는다.
Owned paths
[
"scripts/execute.py",
".codex/hooks.json",
"scripts/hooks/stop_validation.py",
"scripts/msvc_harness/models.py",
"scripts/msvc_harness/process.py",
"tests/test_execute.py",
"tests/test_harness_timeouts.py",
"docs/HARNESS_WORKFLOW.md",
"docs/mitc4-shell-feast-eigen/implementation-prep-evidence.md"
]
타 owner 변경을 보존한다. docs/HARNESS_WORKFLOW.md는 실제 deadline 값의 설명 문단만 수정하고 workflow/approval/Git/Hook 계약을 바꾸지 않는다.
RED
먼저 tests/test_harness_timeouts.py를 작성한다. 실제 hook를 수동 실행하지 않고 기존 Python tests 방식으로 clock/subprocess/adapter를 주입한다.
-
StepExecutor._invoke_codex가 기본14400초를 전달함과 실제 TimeoutExpired가 terminal result 없을 때만 최대2번 재시도되는 것을 검사한다. 기존tests/test_execute.py의1800 message 기대값은 승인 default14400으로 갱신하되 explicit injected1800 exception의 actual timeout message는 그대로 구분한다. -
stop_validation.run_validations에서 새 shared deadline7200이 discovery/toolchain/execute_plan까지 같은 deadline으로 전달되는지 검사한다. Hook entry/reentry/doc-only 정책은 기존 tests로 보존한다. -
CommandSpecdefault7200 및execute_plan자체 default7200을 검사한다. Fake elapsed2000 뒤 다음 command cap이 remaining5200이고 explicit cap5이면5를 유지하는지, deadline 만료·nonzero subprocess가 계속 failure인지 확인한다. 실제 대기는 하지 않는다. -
등록 Stop timeout7500이 shared7200보다 크며 command/matcher/PreToolUse timeout30이 그대로인지 검사한다. Executor14400>registered7500 관계와 finite positive 값을 확인한다.
-
One-time module invocation은 딱
StepExecutor.CODEX_TIMEOUT_SECONDS만 유한14400으로 지정하고 unchangedexecute.main()을 호출한다는 계약을 mock entry로 검사한다. Sandbox modes/default, MAX_TRANSPORT_ATTEMPTS, ownership/preflight/branch/commit/terminal result는 기존 tests를 유지한다. -
tests/test_execute.py에서 실제_codex_environment_failure와_classify_attempt, 기존step_runtime을 사용하는 회귀를 먼저 추가한다. 필수 이름은test_environment_classifier_ignores_successful_source_echo,test_environment_classifier_retains_runtime_helper_failure,test_successful_source_echo_preserves_terminal_and_retry다. 첫 test는 archive의 source excerpt와 실제 JSONLitem.completed/command_execution/exit_code=0의 marker 포함aggregated_output을 주입해None을 기대한다. 성공 command가 실제 helper 오류 문장까지 source로 출력한 경우도 포함한다. 현재 broad substring은 environment로 오판하므로 RED다. 두 번째는 기존 실제 stderr helper diagnostic을 exit0/1에서 계속 검출하고, 성공 source echo와 진짜 stderr failure가 함께 있을 때도 차단함을 확인한다. 마지막은 성공 echo만 있는 completed/exit0의 완료, 명시 error/blocked의 원래 reason·history 보존, pending/exit0의 missing-result 오류, 실제 wrapper timeout만 최대2회 재시도되는 기존 분기를 검증한다. 이 positive regression들은 최초부터 pass할 수 있으므로 새 RED로 주장하지 않는다.
uv run --with pytest python -B -m pytest -v -rs tests/test_execute.py -k 'environment_classifier or successful_source_echo'
Case3개의 collection inventory/parameter 전개와 actual failure를 기록한다. 무관 import/setup
오류는 classifier RED가 아니다. 마지막 attempt1의 test-only .value 수정은 별도 미검증이므로
기존 focused 명령으로 실제 재확인하고 원 보고서도 Implementation owner가 수정한다.
uv run --with pytest python -B -m pytest -v -rs tests/test_harness_timeouts.py
Actual nonzero exit와 기존1800 기본값 때문에 실패한 assertions를 기록한다. Import/setup/인증 오류는 RED가 아니다.
Minimal GREEN
변경은 아래 다섯 runtime 설정의 literal default와 필요한 설명, 이어지는 재현된 classifier 결함의 최소 수정에 한정한다.
| 파일 / symbol | 기존 | 새 값 |
|---|---|---|
| scripts/execute.py / StepExecutor.CODEX_TIMEOUT_SECONDS | 1800 | 14400 |
| .codex/hooks.json / Stop command timeout | 1800 | 7500 |
| scripts/hooks/stop_validation.py / TOTAL_TIMEOUT_SECONDS | 1800 | 7200 |
| scripts/msvc_harness/models.py / CommandSpec.timeout_seconds | 1800 | 7200 |
| scripts/msvc_harness/process.py / execute_plan total_timeout_seconds default | 1800 | 7200 |
Classifier GREEN은 _codex_environment_failure의 helper marker 판별만 좁힌다. 성공한
source/tool 출력의 임의 substring을 runtime diagnostic으로 사용하지 않는다. Stderr의 실제
helper diagnostic과 관찰된 명시 runtime failure 형식을 보존하고, JSONL 성공 command의
command/aggregated_output 같은 source payload는 제외한다. Plain Source excerpt: 문장도
진짜 runtime error 형식이 아니므로 무시한다. 모든 exit0을 정상으로 간주하거나 stderr 검사를
제거하지 않는다. 필요한 작은 private 판별 함수는 같은 scripts/execute.py 안에 둔다.
기존 auth/CLI nonzero 진단, explicit terminal·history, retry 분기와 횟수는 바꾸지 않는다.
min(command cap, shared remaining) 알고리즘은 그대로 둔다. 이 classifier delta 외의 함수·
sandbox·transport/Coordinator retry·Hook scope/active flags·ownership/Git/API를 변경하지 않는다.
docs/HARNESS_WORKFLOW.md의 이전1800 설명은 위 유한 deadline/새 process activation을 정확히
반영한다. Config field/환경변수/새 public CLI timeout option은 만들지 않는다.
Focused VERIFY
uv run --with pytest python -B -m pytest -v -rs tests/test_harness_timeouts.py tests/test_execute.py tests/test_execute_ownership.py tests/test_hook_validation_scope.py tests/test_harness_preset_contract.py
Exit0, failures0, 현재 sandbox/terminal/ownership regressions 보존을 확인한다. PreToolUse/Stop unit tests는 mock 테스트이고 실제 등록 Stop 통과 evidence가 아니다.
위 신규 classifier test3개의 실제 collection 이름과 parameter case 존재도 확인한다. 등록된 기존 suite만 실행되었다고 새로운 behavior가 검증됐다고 보고하지 않는다.
Full VERIFY
cmake -S . -B .harness/build -A x64
if ($LASTEXITCODE -ne 0) { throw 'configure failed' }
cmake --build .harness/build --config Debug
if ($LASTEXITCODE -ne 0) { throw 'build failed' }
ctest --test-dir .harness/build -C Debug --show-only=json-v1
if ($LASTEXITCODE -ne 0) { throw 'discovery failed' }
ctest --test-dir .harness/build -C Debug --output-on-failure
if ($LASTEXITCODE -ne 0) { throw 'full CTest failed' }
uv run --with pytest python -B -m pytest -v -rs
if ($LASTEXITCODE -ne 0) { throw 'full pytest failed' }
C++는 수정하지 않는다. 기존 same-binary cache를 쓰는 helper와 항상 fresh solver를 호출하는 nonlinear helper를 구별한다. 모든 full CTest를 실제 실행하고 완결 count/exit/duration을 기록한다. Cached outputs를 이번 eigen 신규 검증이라고 부르지 않는다. 등록 Stop도 정상 수행하며 full VERIFY를 생략/분할 성공으로 대체하지 않는다.
현재 prep Executor와 Codex의 activation 경계는 environment대로다. 이미 실행 중인 Executor timeout self-edit는 활성화되지 않으며 launch-time Stop outer1800이 유지될 수 있다. 성공을 가정하지 말고 actual registered Stop·Codex exit0을 gate로 확인한다. 등록 Stop 초과/실패 시 정상 terminal evidence와 원시 로그를 보존해 Coordinator에 반환한다. Hook 직접 실행, 재진입 flag/state 조작, 거짓 Markdown-only skip으로 우회하지 않는다.
Evidence / result
docs/mitc4-shell-feast-eigen/implementation-prep-evidence.md에 feature/owner/r2, 각 RED/GREEN command/exit/duration, 전체 pytest/CTest counts, cap before/after, 실제 code diff 범위, current loaded wrapper14400과 등록 Stop launch1800 가능성, 그 시점에 관찰된 Stop/Codex exit 또는 아직 확인 대기인 항목을 기록한다. Raw logs는 ignored .harness/build/mitc4-eigen-evidence/prep/다. CTest log는 즉시 복사 보존한다.
보고서 작성 시점에는 마지막 registered Stop/Codex exit가 아직 발생하지 않을 수 있다. Implementation은 실제 완료된 manual 검증과 미관찰 Stop을 구분하고 미래 성공을 선기록하지 않는다. completed payload는 그 자체로 Stop 성공 증거가 아니다. Executor 종료 뒤 Coordinator가 raw output·등록 Hook evidence·actual exit를 management 문서에서 사후 감사한다. Specialist 보고서 본문은 Coordinator가 대신 수정하지 않는다.
이 Step의 manual AC가 통과하면 현재 phase index Step0의 completed/summary만 기록한다. 실패는 error/error_message 또는 blocked/blocked_reason이며 attempt_history/timestamps/다른Step/top index는 건드리지 않는다. 최종 phase commit/branch/checkpoint는 Executor가 수행한다. 마지막 응답은 common envelope다. Main invocation은 prep Executor의 실제 종료·completed·registered Stop 성공·actual Codex exit0·code/control commit·clean 및 Coordinator 사후 감사 완료 후 Coordinator가 새 process로 시작한다.