fix(plan): skip auto-execute when run --plan produces a direct answer#135
fix(plan): skip auto-execute when run --plan produces a direct answer#135zjshen14 wants to merge 1 commit into
Conversation
When 'opencli run --plan' received a plan-mode response that was already a complete informational answer (e.g. "The file has 11 lines"), it would still replay the answer text back into a fresh react-mode agent pass, which had nothing actionable to do and prompted the user for a plan. The fix adds a looksLikeActionablePlan guard that detects numbered steps (1. ...), step headings (Step N:), or plan/steps section headers (## Plan, ## Steps). Only plan text with these markers triggers auto-execution; a direct prose answer is treated as the final response. Closes #125 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Clean fix for a real problem. The One edge case to be aware of: an informational answer that happens to include a numbered list. For example: This matches If false positives become noisy in practice, requiring both a numbered step AND an imperative verb at the start of the step (e.g. Recommendation: merge. The status quo (every response routed through execute) is worse than this heuristic's occasional false positive. Generated by Claude Code |
Summary
opencli run --planwas unconditionally replaying the plan text back into a react-mode agent pass, even when the plan-mode pass had already produced a complete informational answer (no steps to execute)looksLikeActionablePlanguard that checks for numbered steps (1.), step headings (Step N:), or plan/steps section headers (## Plan,## Steps) — only text matching these patterns triggers auto-executionCloses #125
Test plan
npm run typecheck && npm run lint && npm run format:check && npm test— all pass (531 tests, 10 new)src/cli/plan.test.tscover: numbered steps → actionable, indented numbered steps → actionable,## Planheader → actionable,## Stepsheader → actionable,# Steps→ actionable,Step N:heading → actionable, plain informational answer → not actionable, single-sentence answer → not actionable, empty string → not actionable, prose without step markers → not actionableopencli run "List files in src/ and tell me how many lines src/math.ts has." --plan --yes→ plan answer printed, no "Executing plan…" follow-upopencli run "Add a divide(a,b) function to src/math.ts" --plan --yes→ numbered plan printed, then "Executing plan…" and execution proceedsCo-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Generated by Claude Code