fix: detect claude-terminal prompt with v2.1 placeholder hint#766
Conversation
The tail-line regex required the prompt line to be exactly `❯` (or `❱` / `>`), but Claude Code v2.1 renders the input row as `❯ Try "..."` so the regex never matches and `waitForClaudeInputReady` times out after 60s. Relax the pattern to `^[❯❱>](?:\s|$)` so any prompt char followed by whitespace (or end-of-line) is accepted. The busy pattern still gates ready-detection, so the placeholder hint cannot cause a false positive. Refs nrslib#765 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughプロンプト判定正規表現を拡張し、信頼ダイアログ表示時とプレースホルダーヒント付きプロンプトの両方について pasteText の振る舞いを検証するテストを追加しました。 Changesプロンプト検出パターン拡張と pasteText テスト
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The previous regex `^[❯❱>](?:\s|$)` accepted lines like `❯ 1. Yes, I trust this folder` as a ready prompt, which would cause `pasteText` to silently forward the user's prompt body into a trust/permission dialog instead of the real input box. The old `^[❯❱>]$` failed-loud with a 60s timeout in this scenario; the v2.1 fix re-introduced it as a silent regression. Tighten the pattern with a negative lookahead so any `<prompt> <digit>.` sequence (numbered menus) is rejected, and add a regression test that proves the trust dialog stays not-ready until claude transitions to a real input row. Refs nrslib#765 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
レビューサマリー総合判定: APPROVEサマリーPR #766(claude-terminal の v2.1 プロンプト検出パターン修正)に対する 6 観点レビューはすべて APPROVE。要件 7 項目(v2.1 検出 / NBSP 対応 / 信頼ダイアログ回避 / BUSY 両立 / v2.0 リグレッションなし / 回帰テスト 2 件)はいずれも実コード( レビュー結果
今回の指摘(new)
継続指摘(persists)
解消済み(resolved)
改善提案
REJECT判定条件
|
|
ありがとうございます |
Summary
provider: claude-terminalの tmux backend が Claude Code v2.1.x のプロンプト UI と非互換で、入力欄を検出できず 60s でTimed out waiting for Claude terminal input prompt.と落ちる問題を修正^[❯❱>]$を^[❯❱>](?:\s|$)に緩和し、❯ Try "..."形式でも ready と判定されるようにRefs #765
背景
Claude Code v2.0 系では tmux pane 末尾に
❯単独の行が出ていたが、v2.1.x で入力欄が❯ Try "refactor routing.ts"のようなプレースホルダ付き表記に変わった(pane の hex dump でe2 9d af c2 a0 54 72 79 ...を確認)。isClaudeInputReadyは.trim()後の各行が^[❯❱>]$に完全一致するかを見ていたため、v2.1 以降では永久に ready と判定されなくなっていた。BUSY 判定 (
Running|thinking|Searching|Reading|Writing|Editing|Crunched) は別途行われており、プレースホルダ文字列 (Try ...) はそのいずれにも一致しないため、緩和による誤検出は発生しない。Test plan
npm run build成功npm run lint成功npm test: 6154 tests passednpm run test:e2e:mock: 107 tests passedGiven Claude v2.1 pane with placeholder hint after prompt char, ...が通るtakt --pipeline -t "..." -w defaultの通過確認🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes