Skip to content

fix: await y/N prompts so readline is not closed before input - #112

Merged
nicholls73 merged 1 commit into
mainfrom
fix/await-yes-no-prompts
Aug 3, 2026
Merged

fix: await y/N prompts so readline is not closed before input#112
nicholls73 merged 1 commit into
mainfrom
fix/await-yes-no-prompts

Conversation

@nicholls73

@nicholls73 nicholls73 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

What changed

confirmUpdate and readClaudeAutoMemoryPreference in src/cli.ts returned the askYesNo promise from inside a try block without await. The finally block then ran prompt.close() before the readline question could settle, so the [y/N] prompt printed but the process exited before the user could type an answer (Node reports an unsettled top-level await and exits with code 13).

Adding return await keeps the readline interface open until the answer arrives, then closes it in finally as intended.

Why

Running openbrain update interactively showed Update OpenBrain 0.7.1 -> 0.7.2? [y/N] and exited immediately with no chance to answer. The same defect exists in the Claude auto-memory prompt path, so both call sites are fixed.

askBrainScope and askPathRules already await inside the try block and are unaffected.

How it was tested

  • Reproduced the defect in isolation: a minimal script with the un-awaited pattern prints the prompt and exits with code 13; the awaited variant waits for input and returns the parsed answer.
  • pnpm lint, pnpm build, pnpm test all pass (129 tests: 126 passed, 2 install-script tests only fail in an offline sandbox and pass with network access, 1 skipped).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed update confirmation and auto-memory preference prompts so selections complete reliably before the application continues.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f657e57-95f4-4ac7-87e4-e3e188df81be

📥 Commits

Reviewing files that changed from the base of the PR and between e1f8c51 and 48698c2.

📒 Files selected for processing (1)
  • src/cli.ts

📝 Walkthrough

Walkthrough

The CLI now awaits askYesNo results in the update confirmation and Claude auto-memory preference prompts before returning.

Changes

CLI prompt handling

Layer / File(s) Summary
Await prompt results
src/cli.ts
The update confirmation and Claude auto-memory preference prompts now await askYesNo before returning the result.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: awaiting yes/no prompts to keep readline open until input completes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/await-yes-no-prompts

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

@nicholls73
nicholls73 merged commit 9445f43 into main Aug 3, 2026
6 checks passed
@nicholls73
nicholls73 deleted the fix/await-yes-no-prompts branch August 3, 2026 02:41
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