feat(wiki): P55 — ollama_cloud wiki review backend 추가#64
Conversation
… 환경 대안) P51 의 `WIKI_REVIEW_DEFAULT = "haiku"` 가 ANTHROPIC_API_KEY 없는 환경 (사용자 보고) 에서 fail. 사용자가 OLLAMA_CLOUD_API_KEY 보유 — cloud reviewer 로 review 가능하게 backend 추가. ## 변경 1. **`wiki/reviewers/ollama.rs`** `OllamaReviewer` 에 `api_key: Option<String>` 필드 추가. 있으면 bearer auth. 없으면 local Ollama 그대로 동작. - reqwest client 에 120s timeout 추가 (graph llm.rs 와 일관) 2. **`llm/defaults.rs`** `WIKI_REVIEW_OLLAMA_CLOUD_DEFAULT = "kimi-k2.6:cloud"` 신규 상수 (long context + JSON 출력 안정). 3. **`commands/wiki.rs` build_reviewer**: `"ollama_cloud"` branch 신규. `OLLAMA_CLOUD_API_KEY` env 또는 config 의 cloud_api_key 보면서 bearer auth 포함 OllamaReviewer 인스턴스. cloud_host 미설정 시 `https://ollama.com`. 4. **`commands/wiki.rs` resolve_review_backend**: matches! 에 `"ollama_cloud"` 추가 (default_backend fallback 시 인식). 5. **`commands/wiki.rs` resolve_review_model**: `"ollama_cloud"` 분기 추가. config 의 cloud_model 우선, 없으면 WIKI_REVIEW_OLLAMA_CLOUD_DEFAULT. ## 사용법 config.toml 에 명시: ```toml [wiki] review_backend = "ollama_cloud" # review_model 미설정 → kimi-k2.6:cloud 사용 ``` 또는 CLI: `secall wiki update --review --review-backend ollama_cloud`. ## 회귀 - cargo test (전체, integration 포함) — 0 failed - RUSTFLAGS=-Dwarnings cargo check — 경고 0 - tests/wiki_reviewers.rs 의 OllamaReviewer fixture 3건 `api_key: None` 추가 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces support for the ollama_cloud backend for wiki reviews. Key changes include updating the OllamaReviewer to support bearer authentication and a 120-second timeout, as well as integrating the new backend into the configuration resolution logic. Review feedback identifies a potential crash if ollama_cloud is used as the default backend because build_wiki_backend was not updated. Additionally, it is suggested to prioritize specific backend configurations for API keys and URLs over global settings to allow for more granular control.
| if matches!( | ||
| config.wiki.default_backend.as_str(), | ||
| "claude" | "codex" | "haiku" | "ollama" | "lmstudio" | ||
| "claude" | "codex" | "haiku" | "ollama" | "ollama_cloud" | "lmstudio" |
There was a problem hiding this comment.
Adding ollama_cloud to this list allows it to be automatically picked up as the review backend if it is set as the default_backend in the configuration. However, build_wiki_backend (lines 615-664) has not been updated to support ollama_cloud.
If a user sets default_backend = "ollama_cloud" in their config.toml, the application will crash with an "Unknown backend" error during the wiki generation phase (line 220) before it even reaches the review phase. Please ensure build_wiki_backend is also updated to handle ollama_cloud or reconsider adding it to this matches! block.
| "ollama_cloud" => { | ||
| let api_key = std::env::var("OLLAMA_CLOUD_API_KEY") | ||
| .ok() | ||
| .or_else(|| config.graph.cloud_api_key.clone()) | ||
| .or_else(|| config.log.cloud_api_key.clone()) | ||
| .ok_or_else(|| { | ||
| anyhow::anyhow!( | ||
| "ollama cloud api key not set \ | ||
| (set OLLAMA_CLOUD_API_KEY env or [graph].cloud_api_key in config.toml)" | ||
| ) | ||
| })?; | ||
| let api_url = config | ||
| .graph | ||
| .cloud_host | ||
| .clone() | ||
| .unwrap_or_else(|| "https://ollama.com".to_string()); |
There was a problem hiding this comment.
The API key and URL lookup for ollama_cloud should ideally check the specific wiki backend configuration first, consistent with how the ollama (local) backend is handled. This allows users to provide specific credentials or endpoints for wiki reviews that differ from the global graph or log settings.
"ollama_cloud" => {
let wiki_cfg = config.wiki.backends.get("ollama_cloud");
let api_key = std::env::var("OLLAMA_CLOUD_API_KEY")
.ok()
.or_else(|| wiki_cfg.and_then(|c| c.api_key.clone()))
.or_else(|| config.graph.cloud_api_key.clone())
.or_else(|| config.log.cloud_api_key.clone())
.ok_or_else(|| {
anyhow::anyhow!(
"ollama cloud api key not set \
(set OLLAMA_CLOUD_API_KEY env or [wiki.backends.ollama_cloud].api_key in config.toml)"
)
})?;
let api_url = wiki_cfg
.and_then(|c| c.api_url.clone())
.or_else(|| config.graph.cloud_host.clone())
.unwrap_or_else(|| "https://ollama.com".to_string());
Ok(Box::new(secall_core::wiki::OllamaReviewer {
api_url,
model: model.to_string(),
api_key: Some(api_key),
}))
}…d 지원 HIGH finding: `resolve_review_backend` 가 default_backend fallback 으로 `"ollama_cloud"` 를 인식하지만, `build_wiki_backend` (615-664) 는 미지원. 사용자가 config 에 `[wiki] default_backend = "ollama_cloud"` 설정 시 wiki generation 측이 fail → 일관성 깨짐. 변경: - build_wiki_backend 에 "ollama_cloud" branch 추가 - OllamaBackend 의 `api_key: Some(_)` 으로 bearer auth 활성 - API URL: wiki backend config 의 api_url > graph.cloud_host > "https://ollama.com" - Model: wiki backend config 의 model > WIKI_REVIEW_OLLAMA_CLOUD_DEFAULT - "Unknown backend" 메시지에도 ollama_cloud 추가 Gemini 의 MEDIUM finding (wiki backend config 의 cloud_api_key/cloud_host 별도 lookup) 은 WikiBackendConfig struct 확장 필요 → 별도 PR. 회귀: cargo test 전체 0 failed, RUSTFLAGS=-Dwarnings cargo check 경고 0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lias (#66) 두 fix 묶음: ## 1. WikiBackendConfig 에 `cloud_api_key` / `cloud_host` 필드 추가 Gemini PR #64 MEDIUM 후속 반영. ollama_cloud backend (P55) 의 API 키/엔드포인트 lookup 이 graph/log 의 cloud_* 만 봤었음 → wiki 전용 키/엔드포인트 지정 불가. 이제 우선순위: `[wiki.backends.ollama_cloud].cloud_api_key` → `OLLAMA_CLOUD_API_KEY` env → `[graph].cloud_api_key` / `[log].cloud_api_key` `[wiki.backends.ollama_cloud].cloud_host` → `[graph].cloud_host` → `https://ollama.com` build_wiki_backend / build_reviewer 의 ollama_cloud branch 양쪽 동일 로직. 에러 메시지도 갱신 — `[wiki.backends.ollama_cloud].cloud_api_key` 안내. ## 2. claude CLI 의 `"haiku"` model alias 추가 `WIKI_REVIEW_DEFAULT = "haiku"` (P51) 가 claude CLI 사용 시 의도대로 동작 안 함 — 이전엔 ClaudeBackend 의 model match 가 "haiku" → fallback sonnet 으로 매핑. review default 효과 잃음. ```rust let model_id = match self.model.as_str() { "opus" => "claude-opus-4-6", "haiku" => "claude-haiku-4-5", // ← P56 신규 _ => "claude-sonnet-4-6", }; ``` 이제 claude CLI 환경에서도 review default = haiku 가 의도대로 claude-haiku-4-5 사용. ANTHROPIC_API_KEY 없어도 claude CLI subscription 으로 haiku 활용. 회귀: cargo test 전체 0 failed, RUSTFLAGS=-Dwarnings cargo check 경고 0. Co-authored-by: d9ng <d9ng@outlook.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
P51 의
WIKI_REVIEW_DEFAULT = "haiku"가 ANTHROPIC_API_KEY 없는 환경에서 fail. 사용자 환경에는 OLLAMA_CLOUD_API_KEY 보유 — cloud reviewer 로 review 가능하게 backend 추가.(2026-05-15 sync-monitor 보고서 의 "추가 발견" 후속 fix)
변경
wiki/reviewers/ollama.rsOllamaReviewer.api_key: Option<String>field + bearer auth + 120s timeoutllm/defaults.rsWIKI_REVIEW_OLLAMA_CLOUD_DEFAULT = "kimi-k2.6:cloud"신규commands/wiki.rs build_reviewer"ollama_cloud"branch (OLLAMA_CLOUD_API_KEY env 또는 config cloud_api_key, cloud_host defaulthttps://ollama.com)commands/wiki.rs resolve_review_backend"ollama_cloud"추가commands/wiki.rs resolve_review_model"ollama_cloud"분기 → cloud_model 또는 WIKI_REVIEW_OLLAMA_CLOUD_DEFAULTtests/wiki_reviewers.rsapi_key: None추가사용법
또는 CLI:
secall wiki update --review --review-backend ollama_cloud.Test plan
cargo test전체 — 0 failedRUSTFLAGS=-Dwarnings cargo check— 경고 0cargo fmt --all -- --checkOKsecall wiki update --review --review-backend ollama_cloud실행 시 bearer auth + kimi-k2.6:cloud 호출 확인🤖 Generated with Claude Code