feat: add --context-window setting for Vibe Local (#374)#377
Merged
Conversation
…truncated re-detection When extractResponse() early check detects a Codex prompt using the full tmux output, the detection result is now carried through ExtractionResult.promptDetection to checkForResponse(). This prevents the second detectPromptWithOptions() call from failing due to the extracted portion (from lastCapturedLine) potentially missing the › indicator line. Root cause: Codex TUI renders prompts progressively. When CODEX_PROMPT_PATTERN matches the › line before all options are rendered, isCodexOrGeminiComplete fires and extraction stops at the › line. The response is saved as type=normal with lineCount=endIndex. On the next poll, the early detection finds the full prompt but buildPromptExtractionResult only extracts from lastCapturedLine onwards, potentially excluding the › indicator line from the extracted content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… buffer reset Two issues prevented Codex CLI confirmation prompts from being detected: 1. Prompt detector continuation line scan traversed entire command output because Codex TUI indents all lines with 2 spaces, matching isContinuationLine(). This caused numbered lists in body text to be collected as false options, breaking isConsecutiveFromOne() validation. Fixed by adding MAX_CONTINUATION_LINES=5 limit. 2. Buffer reset (TUI redraw) caused lineCount < lastCapturedLine, triggering the duplicate prevention check incorrectly. Fixed by propagating bufferReset flag through ExtractionResult and skipping duplicate checks when buffer reset is detected. Also added logging for silent session-not-running poller stops. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dow size - Add VIBE_LOCAL_CONTEXT_WINDOW_MIN/MAX constants and isValidVibeLocalContextWindow() type guard to types.ts (DRY: shared between API and CLI layers) - Add vibeLocalContextWindow field to Worktree interface (models.ts) - Add DB migration v20: vibe_local_context_window INTEGER DEFAULT NULL column - Add updateVibeLocalContextWindow() DB function; update getWorktrees/getWorktreeById SELECT statements (6 modification points) - Add PATCH API validation for vibeLocalContextWindow with isValidVibeLocalContextWindow() - Add --context-window CLI argument in vibe-local.ts startSession() with defense-in-depth validation and Number() cast for template literal safety - Add Context Window number input UI in AgentSettingsPane (vibe-local only) - Add i18n keys (en/ja) for vibeLocalContextWindow and vibeLocalContextWindowDefault - Props propagation through NotesAndLogsPane and WorktreeDetailRefactored - Add unit tests for isValidVibeLocalContextWindow() (21 test cases) - Update db-migrations.test.ts CURRENT_SCHEMA_VERSION expectations to 20 - Update component test props factories Resolves #374 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ature - Replace hardcoded min/max values (128/2097152) in AgentSettingsPane with VIBE_LOCAL_CONTEXT_WINDOW_MIN/MAX constants (DRY principle) - Use constant-derived error message in API route validation - Handle NaN from parseInt in client-side context window input - Align migration v20 down-message style with v19 pattern - Add boundary and invariant tests for context window constants - Add OLLAMA_MODEL_PATTERN validation tests (defense-in-depth coverage) Quality Metrics: - TypeScript errors: 0 - ESLint errors: 0 - Tests: 4057 -> 4079 (22 new tests added) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update module descriptions for types.ts, vibe-local.ts, and AgentSettingsPane.tsx with Issue #374 changes. Add design policy, review reports, work plan, and TDD results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
--context-windowパラメータを追加し、worktree単位でOllamaのコンテキストウィンドウサイズを設定可能にするvibeLocalModel実装パターン(DB永続化 → API → UI → CLIオプション)を踏襲Changes
DB層
db-migrations.ts: version 20 マイグレーション(vibe_local_context_window INTEGER DEFAULT NULL)db.ts:updateVibeLocalContextWindow()関数追加、getWorktrees()/getWorktreeById()のSELECT文修正(6箇所)API層
route.ts: PATCH/api/worktrees/[id]にvibeLocalContextWindowバリデーション追加(128〜2097152の整数 or null)CLI層
vibe-local.ts:startSession()で--context-window ${Number(ctxWindow)}をdefense-in-depthバリデーション付きで追加types.ts:VIBE_LOCAL_CONTEXT_WINDOW_MIN/MAX定数、isValidVibeLocalContextWindow()型ガード関数UI層
AgentSettingsPane.tsx: Vibe Local選択時にコンテキストウィンドウ入力欄表示NotesAndLogsPane.tsx: props伝播WorktreeDetailRefactored.tsx: state/callback管理テスト
types.test.ts: 新規43テスト(バリデーション関数 + OLLAMA_MODEL_PATTERN)db-migrations.test.ts: CURRENT_SCHEMA_VERSION期待値を20に更新Test plan
npx tsc --noEmit— TypeScriptエラー 0件npm run lint— ESLintエラー 0件npm run test:unit— 4079テスト全パス(+43件新規)Closes #374
🤖 Generated with Claude Code