Skip to content

fix(cli): stop blank api key exiting deep_research prompt#184

Merged
cyfyifanchen merged 1 commit into
mainfrom
fix/onboard_api_key_prompt_whitespace_cancel
Jul 22, 2026
Merged

fix(cli): stop blank api key exiting deep_research prompt#184
cyfyifanchen merged 1 commit into
mainfrom
fix/onboard_api_key_prompt_whitespace_cancel

Conversation

@0xKT

@0xKT 0xKT commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The deep_research API key prompt (onboard Step 5 and raven deep-research enable) exited raven with no message when a blank key was entered, and had
no clean way to cancel once you started configuring.

Root cause: _prompt_api_key validated the raw input length (len(v) >= 8)
but consumed the stripped value. An all-whitespace key (e.g. 8 spaces) passed
the check, stripped to empty, and hit typer.Exit -- quitting raven. This
shared helper backs 8 call sites, so the crash affected every no-back caller.

Changes:

  • Validate the stripped value. Whitespace-only input is now rejected and
    re-prompts (the reported "8 spaces exits raven" case); a truly-empty submit
    is the back/cancel signal only where a caller opts in.
  • Give deep_research's key prompt a cancel path: an empty submit cancels
    configuration without touching the stored key (previously only Ctrl+C, which
    killed the whole process). _back_placeholder / _prompt_api_key take an
    optional label so the in-field hint reads "cancel" here instead of the
    default "go back", which would have been misleading.

Type

  • Fix

Verification

  • uv run pytest tests/test_cli_onboard_commands.py tests/test_cli_deep_research_commands.py -> 95 passed

  • uv run ruff check on the changed files -> clean

  • Relevant tests pass locally

  • Relevant lint / type checks pass locally

  • User-facing docs or screenshots are updated when needed

Risk

  • Security impact considered
  • Backward compatibility considered

The fix only changes rejection/cancel behavior of a blank submit; a valid key
flows through unchanged. The stripped-value validation and the empty-submit
cancel were verified against all 8 _prompt_api_key call sites (2 already
used allow_back and are behavior-identical for a real key).

Related Issues

Closes #180

_prompt_api_key validated the raw input length but consumed the
stripped value, so an all-whitespace key (e.g. 8 spaces) passed the
>= 8 check, stripped to empty, and hit typer.Exit -- quitting raven
with no message. Validate the stripped value instead: whitespace-only
input is now rejected and re-prompts, matching every other caller.

deep_research's key prompt also had no clean cancel path (only Ctrl+C,
which exits the whole process). Pass allow_back so a truly-empty submit
cancels configuration without touching the stored key, and give the
prompt a "cancel"-worded hint via a new back_label so the placeholder
no longer says "go back" where it actually cancels.

Add tests covering the stripped-value validation, the empty-vs-blank
distinction, and cancelling both the fresh and reconfigure flows.

Co-authored-by: Claude (claude-opus-4-8) <noreply@anthropic.com>
@0xKT
0xKT requested review from arelchan and cyfyifanchen July 22, 2026 13:47
@cyfyifanchen
cyfyifanchen merged commit d92efba into main Jul 22, 2026
8 checks passed
@cyfyifanchen
cyfyifanchen deleted the fix/onboard_api_key_prompt_whitespace_cancel branch July 22, 2026 13:55
@0xKT 0xKT mentioned this pull request Jul 22, 2026
3 tasks
0xKT added a commit that referenced this pull request Jul 22, 2026
## Summary

Bump version from 0.1.7 to 0.1.8. Release commit only touches
`pyproject.toml` and `uv.lock` (kept in sync via `uv lock`).

Changes bundled into this release since v0.1.7:

- feat(importer): cold-start import from other AI tools with EverOS HTTP
backend (#170)
- fix(build): pin locked dependency versions in installers (#185)
- fix(cli): stop blank api key exiting deep_research prompt (#184)
- fix: use redirect-free install.ps1 url on windows powershell 5.1
(#182)
- fix(tui): brighten selection highlight for readability (#175)
- fix(commitlint): align subject-case with conventional-commits standard
(#187)

## Type

- [x] Other

## Verification

- [x] Relevant lint / type checks pass locally

```
python3 scripts/check_commit_messages.py origin/main..HEAD  # exit 0
git diff --stat  # pyproject.toml + uv.lock, 1 line each
```

## Risk

- [x] Backward compatibility considered

Version bump only; no source changes.

## Related Issues

N/A

Co-authored-by: Claude (claude-opus-4-8) <noreply@anthropic.com>
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.

fix: Deep research tool config exits when an invalid key is entered

2 participants