Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions dev-reports/bug-fix/287-bug2/acceptance-context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"bug_id": "287-bug2",
"bug_description": "auto-yes-manager.ts と route.ts のカーソルキー送信ロジック重複を共通関数に抽出し、フォールバックを統一する(DRY原則)",
"fix_summary": "src/lib/prompt-answer-sender.ts に sendPromptAnswer() 共通関数を新規作成。route.ts と auto-yes-manager.ts の重複カーソルキー送信ロジックをこの共通関数に置換。fallbackPromptType/fallbackDefaultOptionNumber によるフォールバック機構を統一。",
"acceptance_criteria": [
"route.ts と auto-yes-manager.ts のカーソルキー送信ロジックが sendPromptAnswer() に統一されていること",
"route.ts の bodyPromptType フォールバック(Bug1修正)が引き続き動作すること",
"auto-yes-manager.ts から sendPromptAnswer() が正しく呼び出されること",
"既存テスト(auto-yes-manager.test.ts, prompt-response-verification.test.ts)が全てパスすること",
"新規テストケース(prompt-answer-sender.test.ts)が共通関数に対して追加されていること",
"ESLint/TypeScript エラーが 0 件であること",
"ビルドが成功すること"
],
"test_scenarios": [
"シナリオ1: prompt-answer-sender.test.ts の全16テストがパスすること",
"シナリオ2: auto-yes-manager.test.ts の全53テストがパスすること(既存動作保持)",
"シナリオ3: prompt-response-verification.test.ts の全21テストがパスすること(既存動作保持)",
"シナリオ4: TypeScript型チェック(npx tsc --noEmit)がエラー0件であること",
"シナリオ5: ESLint(npm run lint)がエラー・警告0件であること",
"シナリオ6: ビルド(npm run build)が成功すること",
"シナリオ7: route.ts が sendPromptAnswer を呼び出しており、buildNavigationKeys/CHECKBOX_OPTION_PATTERN の直接定義がないこと",
"シナリオ8: auto-yes-manager.ts が sendPromptAnswer を呼び出しており、カーソルキーロジックの直接実装がないこと"
],
"related_files": [
"src/lib/prompt-answer-sender.ts",
"src/app/api/worktrees/[id]/prompt-response/route.ts",
"src/lib/auto-yes-manager.ts",
"tests/unit/lib/prompt-answer-sender.test.ts",
"tests/unit/lib/auto-yes-manager.test.ts",
"tests/unit/api/prompt-response-verification.test.ts"
]
}
84 changes: 84 additions & 0 deletions dev-reports/bug-fix/287-bug2/acceptance-result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"status": "passed",
"test_cases": [
{
"scenario": "Scenario 1: prompt-answer-sender.test.ts 16 tests pass",
"result": "passed",
"evidence": "16 tests passed (516ms) - All cursor-key navigation, fallback, text send, multi-select, and priority tests verified"
},
{
"scenario": "Scenario 2: auto-yes-manager.test.ts 53 tests pass (existing behavior preserved)",
"result": "passed",
"evidence": "53 tests passed (17ms) - All existing auto-yes state, polling, thinking skip, cursor navigation, and globalThis tests verified"
},
{
"scenario": "Scenario 3: prompt-response-verification.test.ts 21 tests pass (existing behavior preserved)",
"result": "passed",
"evidence": "21 tests passed (405ms) - All prompt re-verification, fallback, error handling, and multi-select tests verified"
},
{
"scenario": "Scenario 4: TypeScript type check (npx tsc --noEmit) has 0 errors",
"result": "passed",
"evidence": "npx tsc --noEmit completed with no output (0 errors)"
},
{
"scenario": "Scenario 5: ESLint (npm run lint) has 0 errors/warnings",
"result": "passed",
"evidence": "npm run lint: 'No ESLint warnings or errors'"
},
{
"scenario": "Scenario 6: Build (npm run build) succeeds",
"result": "passed",
"evidence": "npm run build: 'Compiled successfully', all routes generated without errors"
},
{
"scenario": "Scenario 7: route.ts uses sendPromptAnswer and has no direct buildNavigationKeys/CHECKBOX_OPTION_PATTERN",
"result": "passed",
"evidence": "route.ts imports sendPromptAnswer from '@/lib/prompt-answer-sender' (line 15), calls it at line 100. No direct imports of sendKeys/sendSpecialKeys. No buildNavigationKeys or CHECKBOX_OPTION_PATTERN found."
},
{
"scenario": "Scenario 8: auto-yes-manager.ts uses sendPromptAnswer and has no direct cursor-key logic",
"result": "passed",
"evidence": "auto-yes-manager.ts imports sendPromptAnswer from './prompt-answer-sender' (line 15), calls it at line 343. No direct imports of sendKeys/sendSpecialKeys. No buildNavigationKeys or CHECKBOX_OPTION_PATTERN definitions. Only cursor-related text is in a code comment."
}
],
"acceptance_criteria_status": [
{
"criterion": "route.ts and auto-yes-manager.ts cursor-key sending logic is unified in sendPromptAnswer()",
"verified": true
},
{
"criterion": "route.ts bodyPromptType fallback (Bug1 fix) continues to work",
"verified": true
},
{
"criterion": "auto-yes-manager.ts correctly calls sendPromptAnswer()",
"verified": true
},
{
"criterion": "Existing tests (auto-yes-manager.test.ts, prompt-response-verification.test.ts) all pass",
"verified": true
},
{
"criterion": "New test cases (prompt-answer-sender.test.ts) are added for the shared function",
"verified": true
},
{
"criterion": "ESLint/TypeScript errors are 0",
"verified": true
},
{
"criterion": "Build succeeds",
"verified": true
}
],
"evidence_files": [
"tests/unit/lib/prompt-answer-sender.test.ts (16 tests passed)",
"tests/unit/lib/auto-yes-manager.test.ts (53 tests passed)",
"tests/unit/api/prompt-response-verification.test.ts (21 tests passed)",
"npx tsc --noEmit (0 errors)",
"npm run lint (0 warnings/errors)",
"npm run build (compiled successfully)"
],
"message": "All acceptance criteria are satisfied. The sendPromptAnswer() shared function in src/lib/prompt-answer-sender.ts correctly unifies the cursor-key sending logic previously duplicated in route.ts and auto-yes-manager.ts. All 90 tests pass across the three test suites, TypeScript and ESLint checks are clean, and the build succeeds."
}
32 changes: 32 additions & 0 deletions dev-reports/bug-fix/287-bug2/investigation-context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"issue_description": "auto-yes-manager.ts L343-345 の isClaudeMultiChoice 判定にフォールバックが一切ない。promptDetection.promptData?.type が multiple_choice にならない場合(タイミングや部分レンダリングによる誤判定)、テキスト送信パスに落ちて Claude Code が入力を認識しない。route.ts の Bug1 と同じパターンの問題だが、auto-yes-manager はサーバーサイドポーリングであるため bodyPromptType のようなクライアント送信情報は利用できない。",
"error_logs": [],
"affected_files": [
"src/lib/auto-yes-manager.ts"
],
"reproduction_steps": [
"1. Auto-Yes が有効な状態で Claude Code セッションに AskUserQuestion(複数選択肢プロンプト)が表示される",
"2. auto-yes-manager のポーリングが captureSessionOutput + detectPrompt を実行",
"3. detectPrompt が multiple_choice 以外のタイプを返す(タイミングによる誤判定)",
"4. isClaudeMultiChoice が false → テキスト送信パスに落ちる",
"5. sendKeys('1') + Enter が送信されるが Claude Code はカーソルキーを期待 → 無視"
],
"environment": {
"os": "macOS",
"node_version": "18.x",
"framework": "Next.js 14"
},
"severity_hint": "high",
"related_issue": 287,
"bug_location": {
"file": "src/lib/auto-yes-manager.ts",
"lines": "343-345",
"current_code": "const isClaudeMultiChoice = cliToolId === 'claude' && promptDetection.promptData?.type === 'multiple_choice' && /^\\d+$/.test(answer);",
"issue": "route.ts とは異なり、クライアント送信の bodyPromptType を利用できないため、detectPrompt の結果のみに依存している。promptDetection.promptData?.type が multiple_choice にならない場合のフォールバックが無い。"
},
"context": {
"difference_from_route_ts": "route.ts はクライアントから bodyPromptType を受け取れるが、auto-yes-manager.ts はサーバーサイドポーリングのため外部からの型情報がない",
"auto_yes_flow": "captureSessionOutput → stripAnsi → detectPrompt → resolveAutoAnswer → sendKeys/sendSpecialKeys",
"note": "auto-yes-manager.ts の detectPrompt は直前のキャプチャ結果を使うため route.ts よりタイミング問題は少ないが、ゼロではない"
}
}
Loading