Skip to content

fix(memory): supply the output schema to CLI distill extractors and unwrap fences - #979

Merged
jinon86 merged 1 commit into
mainfrom
fix/piri-distill-schema-prompt
Aug 6, 2026
Merged

fix(memory): supply the output schema to CLI distill extractors and unwrap fences#979
jinon86 merged 1 commit into
mainfrom
fix/piri-distill-schema-prompt

Conversation

@jinon86

@jinon86 jinon86 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

문제

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 경로와 동일한 스키마 소스)
  • 레거시 훅 distiller와 동일하게 단일 markdown 펜스로 감싼 객체 JSON만 언랩(_strip_markdown_fence), 나머지는 strict 파서 그대로
  • 신규 오류 코드 distill_schema_unsafe를 terminal 분류에 등록

검증

  • pytest bridge/tests 2335 passed (신규 1건: 펜스 언랩 + 스키마 프롬프트 포함 단언)
  • ruff/mypy clean, ruff format diff는 베이스라인과 동일(8 hunks)

연쇄 수정 3부작: #974(스냅샷 폴백) → #978(real CLI 경로) → 본 PR(출력 스키마)

…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.
@jinon86
jinon86 requested a review from seoseo-ai as a code owner August 6, 2026 03:22

@seoseo-ai seoseo-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after explicit operator authorization using the local seoseo-ai credential.

@jinon86
jinon86 merged commit db0c364 into main Aug 6, 2026
8 checks passed
@jinon86
jinon86 deleted the fix/piri-distill-schema-prompt branch August 6, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants