Skip to content

Keep startup prompts interactive#2373

Open
nightt5879 wants to merge 2 commits into
Hmbown:mainfrom
nightt5879:nightt5879/initial-prompt-stays-interactive
Open

Keep startup prompts interactive#2373
nightt5879 wants to merge 2 commits into
Hmbown:mainfrom
nightt5879:nightt5879/initial-prompt-stays-interactive

Conversation

@nightt5879
Copy link
Copy Markdown
Contributor

@nightt5879 nightt5879 commented May 30, 2026

Summary

  • Treat top-level prompt input as an interactive startup prompt instead of running it through one-shot mode.
  • Add explicit startup input modes so codewhale pr still pre-fills editable text while codewhale --prompt auto-submits the initial request.
  • Keep startup prompt dispatch robust for multibyte text and onboarding-gated startup flows.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features
    • Passed with existing warnings outside this patch.
  • cargo test -p codewhale-cli --lib --all-features
  • cargo test -p codewhale-cli --lib --all-features top_level
  • cargo test -p codewhale-tui --bin codewhale-tui --all-features prompt_flag_starts_interactive_submit_input
  • cargo test -p codewhale-tui --bin codewhale-tui --all-features initial_input_
  • cargo test -p codewhale-tui --bin codewhale-tui --all-features startup_prompt_waits_for_onboarding_then_dispatches
  • cargo test --workspace --all-features
    • Passed by PR CI on ubuntu-latest, macos-latest, and windows-latest.
  • GitHub Actions CI
    • Lint, Version drift, Test (ubuntu-latest), Test (macos-latest), Test (windows-latest), npm wrapper smoke, GitGuardian, and Greptile Review all passed.

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes
    • Covered by direct command-line equivalent CLI/TUI startup tests in this Windows session: prompt_flag_starts_interactive_submit_input, initial_input_, and startup_prompt_waits_for_onboarding_then_dispatches.

Closes #2370

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request changes the top-level prompt flag (-p / --prompt) behavior to start an interactive TUI session and automatically submit the initial prompt, rather than running in a non-interactive one-shot mode. Non-interactive runs are now directed to use the exec command. To support this, an InitialInput enum is introduced with Prefill and Submit variants. The review feedback correctly identifies a potential bug where text.len() is used to set the cursor position instead of text.chars().count(), which could lead to incorrect cursor placement or panics when handling multi-byte UTF-8 characters.

Comment thread crates/tui/src/tui/app.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b0562a10f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/tui/src/tui/app.rs Outdated
Comment thread crates/tui/src/tui/ui.rs Outdated
@nightt5879
Copy link
Copy Markdown
Contributor Author

Updated the PR description after follow-up validation.

Review feedback addressed in 77bb447a:

  • Startup prompt cursor now uses character counts, so multibyte input is handled correctly.
  • Deferred startup prompts now remain pending through onboarding and auto-submit once onboarding completes, avoiding the stale setup message path.

Re-ran direct command-line equivalent CLI/TUI behavior tests on this Windows checkout:

  • cargo test -p codewhale-tui --bin codewhale-tui --all-features prompt_flag_starts_interactive_submit_input
  • cargo test -p codewhale-tui --bin codewhale-tui --all-features startup_prompt_waits_for_onboarding_then_dispatches
  • cargo test -p codewhale-tui --bin codewhale-tui --all-features initial_input_
  • cargo test -p codewhale-cli --lib --all-features top_level

Full workspace validation is green in PR CI on Ubuntu, macOS, and Windows.

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.

feat: Keep interactive REPL alive after processing initial prompt

1 participant