fix(deps): kiwi-rs libkiwi 0.23 ABI 불일치로 인한 sync 세그폴트 수정 - #143
Conversation
kiwi-rs 0.1.4의 KiwiAnalyzeOption(Kiwi 0.22.x 5필드 레이아웃)이 libkiwi >= 0.23.0의 kiwi_analyze_option_t(typo_transformer/typo_threshold 추가, 값 전달 48바이트)와 불일치. kiwi_analyze가 구조체 뒤 16바이트의 초기화되지 않은 스택을 typo 필드로 읽어 sync ingest 중 SIGSEGV. 업스트림(JAICHANGPARK/kiwi-rs) 수정 릴리스 전까지 포크 브랜치 yeonsh/kiwi-rs#fix/analyze-option-abi-kiwi-0.23 으로 패치.
📝 WalkthroughWalkthroughCargo.toml에 [patch.crates-io] 섹션이 추가되어 kiwi-rs 의존성을 crates.io 버전 대신 지정된 rev의 Git 저장소로 재지정합니다. ABI 비호환 문제로 인한 임시 조치임을 설명하는 주석이 포함되어 있습니다. Changes의존성 패치 설정
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Cargo.toml (1)
62-67: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value개인 포크 의존에 대한 추적 이슈 링크 추가 권장.
개인 GitHub 계정(
yeonsh)의 포크 브랜치를 임시로 참조하는 것은 문서화가 잘 되어 있어 심각도는 낮지만, 상류 PR/이슈 링크를 주석에 추가하면 추후 이 패치를 제거해야 할 시점을 추적하기 더 쉬워집니다.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Cargo.toml` around lines 62 - 67, The temporary kiwi-rs patch is fine, but the comment should also include a traceable upstream link for when to remove it. Update the [patch.crates-io] note near the kiwi-rs git override to reference the related upstream PR or issue, alongside the existing branch/rev context, so the fallback dependency is easier to track and retire later.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Cargo.toml`:
- Around line 62-67: The temporary kiwi-rs patch is fine, but the comment should
also include a traceable upstream link for when to remove it. Update the
[patch.crates-io] note near the kiwi-rs git override to reference the related
upstream PR or issue, alongside the existing branch/rev context, so the fallback
dependency is easier to track and retire later.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b7f54e76-6274-4621-b35f-cc108a334168
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
Cargo.toml
There was a problem hiding this comment.
Code Review
This pull request patches the kiwi-rs dependency in Cargo.toml and Cargo.lock to use a specific git revision. This temporary patch resolves an ABI-incompatibility issue between kiwi-rs 0.1.4 and libkiwi >= 0.23.0 that causes a segmentation fault in kiwi_analyze. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
@
머지 전 검증한 내용FFI ABI + 개인 포크 의존성이라 신중하게, 세 갈래로 독립 검증했습니다:
조치
|
FFI 회귀 테스트가 실제 버그를 잡음: 정품 libkiwi 0.23.2 로는 seCall 바인딩이 Kiwi::new() (builder/init 경로)에서 SEGFAULT. 같은 lib+model 로 번들 kiwi-cli 0.23.2 는 정상 분석 → lib/model 이 아니라 바인딩 문제. #143 은 analyze 경로(KiwiAnalyzeOption) ABI 를 고쳤으나 init 경로 0.23 비호환은 미해결(상류 kiwi-rs 조사 영역). - KIWI_LIBKIWI_TAG: v0.23.2 -> v0.22.2 (실증된 working 버전). 0.22.2 통과, 0.23.2 는 init crash 를 동일 env 메커니즘·테스트로 확인. 컴파일된 48B KiwiAnalyzeOption 은 0.22.2 의 32B prefix 만 읽혀 안전. - ci.yml: 이전 kiwi-ffi 잡은 포크의 깨진 auto-download 에 의존해 CI 에서 실패했음 (find_asset_url 이 릴리스 JSON 의 중첩 uploader 객체에서 brace 매칭 실패 -> asset not found). 이제 인증된 gh release download 로 libkiwi+model 을 직접 provision 하고 KIWI_LIBRARY_PATH/KIWI_MODEL_PATH 로 넘겨 Kiwi::new() 가 다운로드 없이 로드. 검증: fresh 0.22.2 provision -> env -> FFI 테스트 통과(2.18s). secall-core 485 green, clippy -Dwarnings 클린, ci.yml YAML valid. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVEL1SnCQBtUMeWVy99ebj
|
@ 1. libkiwi >= 0.23 →
|
….22.2 #143(kiwi-rs ABI 포크 패치)/#144(버전 핀 + FFI 회귀 테스트 + CI) 머지, libkiwi 0.23 init 비호환 발견(이슈 #145), MCP/컨텍스트 점검 요약. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVEL1SnCQBtUMeWVy99ebj
문제
secall sync가 "Ingesting local sessions..." 단계에서 매번 SIGSEGV로 죽음 (2026-07-03, 07-06 크래시 리포트 동일 시그니처 —kiwi_analyze→splitByTrieUsingTypo→PreparedTypoTransformer::generateGraph,KERN_INVALID_ADDRESS at 0x8).근본 원인
kiwi-rs 0.1.4의
#[repr(C)] KiwiAnalyzeOption(5필드 32바이트)은 Kiwi 0.22.x의kiwi_analyze_option_t레이아웃. Kiwi 0.23.0부터 이 C 구조체 끝에kiwi_prepared_typo_h typo_transformer+float typo_threshold가 추가되어 48바이트가 됐고, 값(by value)으로 전달되기 때문에 libkiwi 0.23.x의toAnalyzeOption()이 Rust가 초기화하지 않은 +32..+48 스택 쓰레기를 typo 필드로 읽음 → 쓰레기 값이 오타 교정 경로를 켜면 무효한PreparedTypoTransformer로 분석을 시도하다 널/쓰레기 포인터 역참조.로컬에 수동 설치된 libkiwi가 0.23.2라 즉시 노출됐지만, kiwi-rs의 자동 다운로드 기본값도
latest(현재 0.23.2)라서 크레이트 자체 결함임.수정
kiwi-rs 포크에 두 필드를 추가하고 모든 생성 지점(6곳)에서
null/2.5(헤더 문서화 기본값)로 초기화 — 구조체가 커지는 방향은 0.22.x에도 안전(callee가 아는 prefix만 읽음). seCall은 업스트림 수정 릴리스 전까지[patch.crates-io]로 이 포크를 참조:rev고정, Cargo.lock 검증 완료 — 리뷰 시점git ls-remote로 도달성 확인)kiwi_config_t0.23 중간 삽입 불일치, seCall 미사용 API — 도 함께 보고)검증
cargo build --release성공,cargo test746 passed / 0 failed.secall sync경로가 exit 0으로 완주 — 밀려 있던 249개 세션 ingest, 그래프 1,278노드/1,039엣지 갱신, 한국어 recall 검색 정상.Fast-follow 제안 (이번 PR 범위 밖)
CI cargo 스텝에
--locked추가 — 현재 CI가 lockfile을 강제하지 않아cargo update시 git 의존성이 이동할 수 있음 (rev 고정으로 이번 건은 방어됨).🤖 Generated with Claude Code