feat(#3703): 계획 실행기 rhwp run — 선언적 편집 계획의 정적 선검증·원자 실행·저널 (#3608 실행 3층) — #3705 적층 - #3710
Open
kevin9327 wants to merge 5 commits into
Open
feat(#3703): 계획 실행기 rhwp run — 선언적 편집 계획의 정적 선검증·원자 실행·저널 (#3608 실행 3층) — #3705 적층#3710kevin9327 wants to merge 5 commits into
kevin9327 wants to merge 5 commits into
Conversation
… 단일 출처)
이름 환각은 경량 에이전트의 1순위 실패 유형인데, 미지 명령/도구가 교정 단서 없이
돌아와 맹목 재시도 루프의 원료가 됐다.
- CLI: 미지 명령 exit 2 stderr 에 힌트 1줄. 후보는 capabilities 명령 목록 단일
출처(commands vec 을 capabilities_command_entries() 로 승격 — 동작 무변경)
- 레벤슈타인(의존성 0) + 임계 초과 무제안(오제안 0 원칙)
- MCP: 미지 도구 isError 를 {error:<원문>, didYouMean:[…]} 구조화 — 하위호환 유지
검증: did_you_mean_contract 3건 green, cli_json 22·server 6 무회귀, clippy 0.
실측: exprot-svg→'export-svg' 힌트, hwp_serch→didYouMean:[hwp_search] 원문 동봉.
정보 없는 오류는 맹목 재시도 루프의 원료다(edwardkim#3630 실패 유형 4). tool_error 를 {error:<원문>, nextCall:{name,arguments,why}} 로 구조화(원문 보존 = 하위호환): - 닫힌/모르는 핸들 8개 사이트 전부 → hwp_open 교정 호출 동봉 - 미지 도구 → didYouMean 최근접을 nextCall 로 병기 (edwardkim#3694 단일 출처 재사용) - nextCall.name 은 실존 도구만 — capabilities 선언 대조를 계약 테스트로 고정 검증: mcp_next_call_contract 3건 green, did_you_mean 3·server 6·session_edit 5 무회귀, clippy 0. 실측: 닫힌 핸들 fill → hwp_open nextCall 라이브 원문 동봉.
"잘 됐겠지" 저장은 에이전트 실패 유형 2의 원료다. 편집 3종+세션 save 에
저장 바이트 즉시 재파싱→IR 대조 자기검증을 내장:
- edit fill-fields/replace-text/set-cell --verify → verify:{identical,diffCount}
동봉, identical=false 면 봉투 출력 후 exit 3 (판정은 데이터·exit 와 무모순)
- 미요청 시 verify:null = 기존 소비자 하위호환
- 재파싱 실패는 identical:false+reparseError 로 보고 (저장물은 남긴다)
- 교차 포맷 저장은 strip_cross_format_noise 후 판정
- mcp-serve hwp_doc_save verify:true — 같은 헬퍼 재사용
검증: edit_verify_contract 4건 green, fill 7·replace 4·set-cell 5 무회귀,
clippy 0. 실측: 3계열 라이브 identical:true (evidence.txt).
…dwardkim#3608 실행 3층) 다단 체이닝(호출 사이 상태 유실·중간 실패의 반편집 문서)이 에이전트 실패의 뿌리다. 절차 대신 의도(계획서)를 받는 3층을 신설한다: - rhwp run <계획.json> [--json] + --plan-json 인라인 (MCP 경로) - 정적 선검증(실행 0): 필드 존재·순번, 치환 일치 건수, 셀 좌표, □ 계수 — 위반 전부를 invalid[{step,action,reason}] 로 한 번에 보고 + exit 2, 출력 파일을 아예 만들지 않는다 - 원자 실행: 전 step 인메모리 IR 적용, 사후 단언(verify=edwardkim#3702 재사용) 통과 시에만 단 한 번 저장 — 실패 시 디스크 무변경(자연 트랜잭션), 단언 실패 exit 3 - 저널 봉투: step 별 결과 + verify + assertions 에코 — 판정은 전부 데이터 - 새 편집 로직 0: 판정자·적용자가 기존 edit 3종과 동일 함수 - MCP hwp_run_plan{plan}: capabilities 단일 출처 cmdTemplate 등록(서버 무변경) 검증: run_plan_contract 6건 green, cli_json·edit 4계열·mcp_server 무회귀, clippy 0, fmt clean. 실측: 정상 저널·선검증 exit 2(출력 부재)·MCP 인라인 3계열. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 1, 2026
`cargo fmt --all -- --check` 가 tests/run_plan_contract.rs:65 에서 걸려 Lint 잡이 멈췄고, Build & Test 워커 전체가 그 결과를 물려받아 skipped 로 떨어졌다. 동작 변경 없음 — 체이닝 어서션 한 건의 줄바꿈만 규범형으로 맞춘다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
8 tasks
jangster77
self-requested a review
August 1, 2026 14:17
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.
요약 (#3703 · #3608 실행 3층 · #3705 적층)
에이전트 실패의 뿌리는 다단 체이닝입니다 — 호출 사이에서 상태를 잃고, 중간 실패가
반편집 문서를 남깁니다. 이 PR은 절차(도구 호출 나열) 대신 의도(계획서) 를 받는
3층, 계획 실행기
rhwp run을 신설합니다.동작
{ "planVersion": "1.0", "input": "서식.hwp", "output": "제출본.hwp", "steps": [ { "action": "fill_fields", "data": {"성명":"홍길동"} }, { "action": "replace_text", "find": "2025년", "replace": "2026년" }, { "action": "set_cell", "table": 1, "row": 0, "col": 0, "text": "값" }, { "action": "set_checkbox", "occurrence": 1 } ], "assertions": { "notFoundEmpty": true, "verify": true } }rhwp run plan.json --json(파일 대신--plan-json '<인라인>'가능):(grep 읽기 전용)·셀 좌표(resolve_table_cell)·□ 계수를 전부 미리 검사. 위반을
한 번에 모아
invalid[{step,action,reason}]+ exit 2. 출력 파일을 아예 만들지않습니다(두더지잡기 방지 + 실행 0 증명).
set_cell 좌표는 앞 step 편집으로 밀릴 수 있어 실행 시점에 재해석합니다.
assertions.verify는 [내성 P2] 편집 --verify 내장 — 저장 직후 자기검증 봉투(verify:{identical,diffCount})와 exit 3 (#3630 3호) #3702edit_verify_report재사용(저장 바이트 재파싱↔IR 대조). 실패 시 저장 없이 exit 3 — 자연 트랜잭션.
새 편집 로직 0 — 판정자와 적용자가 기존 edit 3종과 동일 함수입니다.
MCP
hwp_run_plan{plan}은 capabilities 단일 출처에 cmdTemplate 로 등록해mcp-serve 본체 무변경입니다. help·capabilities 명령 목록 동기화 포함.
실측 (mydocs/report/task_m100_3703/evidence.txt)
verify identical:true+ exit 0.invalid[]에 두 위반 동시 보고, exit 2, 출력 파일 부재 = 실행 0 증명.hwp_run_plan인라인: isError:false + structuredContent 동일 저널.검증
run_plan_contract6건 green: 선검증 exit 2·출력 부재 / 중간 불가 원자성 /저널-단언 정합 / 왕복 재독(fields 재독으로 새 값 확인) / capabilities 선언 / MCP 저널
-D warnings0 · fmt clean처리결과문서
🤖 Generated with Claude Code