fix(memory): supply the output schema to CLI distill extractors and unwrap fences - #979
Merged
Merged
Conversation
…nwrap fences The Claude/Piri runtime CLI backend told the extractor to 'match the supplied schema' but never supplied one (stdin carries only the transcript envelope), so every model invented its own schema and the strict parser rejected the output as distill_output_invalid. Embed the checked-in extraction schema in the system prompt, and unwrap a single markdown fence around object JSON the way the legacy hook distiller did. Also classify the new distill_schema_unsafe code as terminal.
seoseo-ai
approved these changes
Aug 6, 2026
seoseo-ai
left a comment
Collaborator
There was a problem hiding this comment.
Approved after explicit operator authorization using the local seoseo-ai credential.
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.
문제
RuntimeCliDistillBackend(claude/piri 추출 경로)은 프롬프트에서 "supplied schema에 맞춰라"라고 지시하지만 스키마를 어디에도 공급하지 않습니다(stdin은 트랜스크립트 봉투뿐, codex 경로만 스키마 파일을 넘김). 결과적으로 모든 모델이 자의적 스키마(memory_records,memories등)를 출력해 strict 파서가distill_output_invalid로 종결했습니다.실측(2026-08-06, dungae): #974+#978 배포 후 스냅샷·추출 프로세스는 정상이나 출력 3/3
distill_output_invalid. 실제 프롬프트/stdin으로 수동 재현 시 glm-5.2와 claude 둘 다 엉뚱한 스키마 + markdown 펜스 출력 확인.수정
schemas/codex-distill-extraction-v1.schema.json을 안전 검증(소유자/권한/크기 상한) 후 시스템 프롬프트에 첨부 (codex 경로와 동일한 스키마 소스)_strip_markdown_fence), 나머지는 strict 파서 그대로distill_schema_unsafe를 terminal 분류에 등록검증
pytest bridge/tests2335 passed (신규 1건: 펜스 언랩 + 스키마 프롬프트 포함 단언)연쇄 수정 3부작: #974(스냅샷 폴백) → #978(real CLI 경로) → 본 PR(출력 스키마)