feat(lib-ollama-client): DEFAULT_NUM_CTX → 32768 (Phase C / 順位 98 root cause fix)#143
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughOllama クライアントのコンテキストサイズを DEFAULT_NUM_CTX=8192 から 32768 に上げ、関連テストとドキュメントを更新し、push-runner の quality gate タイムアウトを 180→600 秒に延長、Phase C の検証結果と次フェーズ用 TODO を追記しました。 変更内容DEFAULT_NUM_CTX 段階的増加と Phase C 完了
🎯 3 (中程度) | ⏱️ ~20 分関連する可能性のあるプルリクエスト
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib-ollama-client/src/lib.rs (1)
128-139: 💤 Low value詳細な進化履歴の配置を検討してください。
DEFAULT_NUM_CTXの doc comment に 12 行の詳細な進化履歴が記録されていますが、このレベルの詳細情報はコード内コメントより ADR-038 やdocs/local-llm-offload-history.mdに配置する方が適切かもしれません。推奨: コード内には以下の essential 情報のみを残し、詳細な dogfood 経緯は ADR に委譲する構成:
/// Ollama 既定の `num_ctx` (2048) は本リポジトリの lint-screen prompt に対して不足。 /// mistral:7b の theoretical max である 32768 を default とする。 /// 進化履歴の詳細は ADR-038 参照。 pub const DEFAULT_NUM_CTX: u32 = 32768;ただし、現状の詳細コメントも「コード近傍で判断根拠を即座に確認できる」利点があるため、プロジェクトの方針次第です。
🤖 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 `@src/lib-ollama-client/src/lib.rs` around lines 128 - 139, The doc comment for DEFAULT_NUM_CTX in lib.rs contains an overly long evolution history; trim it to the essential rationale (that Ollama's default 2048 is insufficient for our lint-screen prompts and we choose mistral:7b's theoretical max 32768 as the default) and replace the long timeline with a brief pointer to ADR-038 or docs/local-llm-offload-history.md for full details; locate the constant named DEFAULT_NUM_CTX in src/lib-ollama-client/src/lib.rs, remove the 12-line history block, leave a 2–3 line explanatory comment and add a single-line reference to the ADR/doc file.
🤖 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.
Inline comments:
In `@docs/todo-summary.md`:
- Line 78: The rank-109 mismatch: update the todo item so both sources agree on
Tier; locate the entry for rank 109 (the summary line showing "🚀 Tier 1") and
the detailed todo entry that currently labels "PR `#142` post-merge-feedback
T2-#1" and make them consistent—preferably change the detailed todo label
"T2-#1" to "T1-#1" (or alternatively change the summary Tier to Tier 2) and
ensure the text mentions "Tier 1" where Severity High/Phase C/D dogfood
precondition is asserted so both the summary and detailed todo reflect the same
Tier and label.
---
Nitpick comments:
In `@src/lib-ollama-client/src/lib.rs`:
- Around line 128-139: The doc comment for DEFAULT_NUM_CTX in lib.rs contains an
overly long evolution history; trim it to the essential rationale (that Ollama's
default 2048 is insufficient for our lint-screen prompts and we choose
mistral:7b's theoretical max 32768 as the default) and replace the long timeline
with a brief pointer to ADR-038 or docs/local-llm-offload-history.md for full
details; locate the constant named DEFAULT_NUM_CTX in
src/lib-ollama-client/src/lib.rs, remove the 12-line history block, leave a 2–3
line explanatory comment and add a single-line reference to the ADR/doc file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 212f08bf-ad7a-46d7-ae47-9817aebf9808
📒 Files selected for processing (5)
docs/local-llm-offload-analysis.mddocs/todo-summary.mddocs/todo6.mdpush-runner-config.tomlsrc/lib-ollama-client/src/lib.rs
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…4) + workflow gap 反映 Phase D dogfood の 1 本目 (D-1)。3 件 ADR 採用 + Phase D 計画 land + workflow gap 反映を bundled。 順位 112 (PR #142 T3-#3): ADR-038 に 2 section 追記 - Diagnostic logging scope: eprintln (CLI 前提) と structured logging 移行条件 - 90% 閾値 rationale: 保守採用根拠 + Phase D 完了時の precision/recall 評価方針 順位 113 (PR #142 T3-#4): ADR-027 に metrics override 判断基準追記 - Incidental change vs Responsibility change の線引き - Override 記述様式 (Override / Reason / Rationale の 3 項目) 順位 114 (PR #143 T3-#1): ADR-040 新規作成 - mistral:7b context size 実測値 (8K 512MB 5-20s ↔ 32K 2GB 30-90s) - step_timeout 3.33x 比例係数の根拠 - num_ctx 選定 flow chart - CLAUDE.md ADR index 追加 - lib-ollama-client/src/lib.rs L128-139 dogfood evolution コメントを 4 行参照に短縮 Phase D 計画 land + workflow gap (新規): - analysis.md に D-1/D-2/D-3 PR 構成 + 計測手順 + 想定リスクを追加 - D-1 着手時に判明した workflow gap (jj auto-snapshot vs session-only opt-in) を計測手順に反映 - env var override (LINT_SCREEN_ENABLED) を todo8.md / todo-summary.md (順位 115) に backlog 登録 - D-1 自身は dogfood skip、env var override land 後に D-2 / D-3 で実 dogfood 実施 D-1 lint_screen 状態: skipped。Phase D guide §1 session-only opt-in workflow が jj auto-snapshot と 本質的に衝突するため、配列 env var override の cli-push-runner 実装 (順位 115) を D-2 前に land 必須。
…4) + workflow gap 反映 (#145) Phase D dogfood の 1 本目 (D-1)。3 件 ADR 採用 + Phase D 計画 land + workflow gap 反映を bundled。 順位 112 (PR #142 T3-#3): ADR-038 に 2 section 追記 - Diagnostic logging scope: eprintln (CLI 前提) と structured logging 移行条件 - 90% 閾値 rationale: 保守採用根拠 + Phase D 完了時の precision/recall 評価方針 順位 113 (PR #142 T3-#4): ADR-027 に metrics override 判断基準追記 - Incidental change vs Responsibility change の線引き - Override 記述様式 (Override / Reason / Rationale の 3 項目) 順位 114 (PR #143 T3-#1): ADR-040 新規作成 - mistral:7b context size 実測値 (8K 512MB 5-20s ↔ 32K 2GB 30-90s) - step_timeout 3.33x 比例係数の根拠 - num_ctx 選定 flow chart - CLAUDE.md ADR index 追加 - lib-ollama-client/src/lib.rs L128-139 dogfood evolution コメントを 4 行参照に短縮 Phase D 計画 land + workflow gap (新規): - analysis.md に D-1/D-2/D-3 PR 構成 + 計測手順 + 想定リスクを追加 - D-1 着手時に判明した workflow gap (jj auto-snapshot vs session-only opt-in) を計測手順に反映 - env var override (LINT_SCREEN_ENABLED) を todo8.md / todo-summary.md (順位 115) に backlog 登録 - D-1 自身は dogfood skip、env var override land 後に D-2 / D-3 で実 dogfood 実施 D-1 lint_screen 状態: skipped。Phase D guide §1 session-only opt-in workflow が jj auto-snapshot と 本質的に衝突するため、配列 env var override の cli-push-runner 実装 (順位 115) を D-2 前に land 必須。
Summary
Phase d retirement への critical path Phase C (
DEFAULT_NUM_CTX増加) を land。Phase B で確定した「mistral:7b の context overflow が真因」を decisive に解消し、Phase D criteria (fallback rate < 50%) を classifier preview で達成。DEFAULT_NUM_CTX = 8192 → 32768(mistral:7b theoretical max)step_timeout = 180s → 600s(PR feat(cli-push-runner): Phase c MVP — pre-push lint-screen step (default OFF) #132 から 2 回目の bump)変更内容
Commit 1: docs only (前 turn carry-over)
順位 109-113 (PR #142 post-merge-feedback 採用分) を docs/todo6.md + docs/todo-summary.md に登録。
Commit 2: Phase C 実装
src/lib-ollama-client/src/lib.rsdoc comment を dogfood の進化記録 (2048 → 4096 → 8192 → 16384 → 32768) を含めて更新。Phase B 真因仮説 (overflow 時に Ollama は prompt_eval_count を num_ctx に clamp 報告) を inline で説明。
test 1 件 (
num_ctx_is_serialized_into_request_body) をnum_ctx:32768期待値に更新。lib-ollama-client 17/17 pass + cli-finding-classifier evals 20/20 pass。push-runner-config.tomlcargo test -- --ignored(12 件 mistral invoke) が num_ctx 32768 で local 269s 観測 → 180s 超過。600s への拡大で安全マージン込み。docs/local-llm-offload-analysis.mdPhase C row を ✅ 完了化 + Phase C smoke dogfood table を追加 (3 PRs replay 結果)。Phase D criteria (<50%) を classifier preview で 達成 表示。
Phase C smoke dogfood signal (32768 で 3 PRs replay、本 PR commit 2 後に取得)
auto_fix(real classification, finding detected)invalid severity: error= contract violation、num_ctx 起因ではない)auto_fix(real classification, finding detected)結果集計:
severity: "error"を返した = invalid)。Phase b' agreement 75% で説明可能な mistral semantic 精度の別問題、Phase C scope 外Critical path 進捗 (analysis.md 削除へ)
Test plan
cargo test -p lib-ollama-client17/17 passcargo test -p cli-finding-classifier --test lint_screen_evals20/20 pass (1 ignored = Ollama integration、別途 ignored test で確認)cargo test -- --ignored --test-threads=1全 pass (local 269s、step_timeout=600s で push pipeline pass).claude/cli-finding-classifier.exeで stderr に warn log emit されなくなったことを確認 (overflow 解消の subset 検証)Phase D 基準と残課題
Phase D criteria 達成判定の caveat:
残課題 (Phase E までに対応 / out-of-scope):
invalid severity: error) は semantic 精度問題、Phase b' agreement 75% で説明可能、Phase C scope 外Out of scope
invalid severity: error): mistral 出力崩壊系、prompt v4 検討 or model swap 別 phaselib-ollama-clientは本リポ専用、共有 crate 化は未計画Summary by CodeRabbit
バグ修正
ドキュメント