Skip to content

fix(cli): preserve default in promptYesNo for invalid input#5

Open
Atman36 wants to merge 1 commit intobasilisk-labs:mainfrom
Atman36:codex/fix-prompt-yesno-default
Open

fix(cli): preserve default in promptYesNo for invalid input#5
Atman36 wants to merge 1 commit intobasilisk-labs:mainfrom
Atman36:codex/fix-prompt-yesno-default

Conversation

@Atman36
Copy link

@Atman36 Atman36 commented Feb 14, 2026

Summary

Fixes promptYesNo behavior for invalid non-empty input.

Problem

promptYesNo previously returned false for any non-empty input that was not in the affirmative list. This incorrectly overrode defaultValue=true on invalid input.

Changes

  • update promptYesNo parsing to handle both affirmative and negative tokens explicitly
  • for unknown input, fallback to defaultValue
  • add unit test coverage for invalid-input fallback

Validation

  • npx vitest run packages/agentplane/src/cli/prompts.test.ts
  • repository hooks (pre-commit, pre-push) passed

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of invalid input responses to yes/no prompts with better fallback behavior when unrecognized input is provided.

@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

The promptYesNo function's input handling is improved to explicitly distinguish between affirmative responses (y/yes/true/1/on), negative responses (n/no/false/0/off), and unrecognized input that defaults to the provided fallback value. A test case verifies this default fallback behavior.

Changes

Cohort / File(s) Summary
Input Validation Enhancement
packages/agentplane/src/cli/prompts.ts, packages/agentplane/src/cli/prompts.test.ts
Modified promptYesNo to use explicit conditional checks for true/false recognition instead of a single expression, with fallback to defaultValue for unrecognized input. Added test case covering fallback behavior for both true and false defaults.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A prompt asks yes or no, we say,
Now input gets its proper way,
Yes, no, or back to default we go,
Each answer clear, no longer slow! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main fix: improving promptYesNo to preserve the default value when receiving invalid input, which is the core objective of the changeset.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant