Skip to content

Add error popup - #6

Merged
Pajn merged 1 commit into
mainfrom
error-handling
Jul 3, 2026
Merged

Add error popup#6
Pajn merged 1 commit into
mainfrom
error-handling

Conversation

@Pajn

@Pajn Pajn commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added an in-app error popup that appears when an action fails, with a clear message and a prompt to dismiss it.
  • Bug Fixes
    • Improved picker behavior so failed actions no longer close the interface.
    • After certain errors, the app now preserves the current search state and returns you to browsing instead of exiting.
    • Error handling for session actions is now more resilient across different backends.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Pajn, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 097d0609-79d8-4834-ace8-d9abf1900c1e

📥 Commits

Reviewing files that changed from the base of the PR and between b2e2def and 1bac044.

📒 Files selected for processing (2)
  • crates/wisp-bin/src/main.rs
  • crates/wisp-ui/src/lib.rs
📝 Walkthrough

Walkthrough

Adds a dismissable error popup to the picker UI: SurfaceModel gains an error: Option<String> field rendered via new render_error_popup/centered_rect helpers. The picker event loop introduces a report_err! macro and error state so activate, rename, kill-session, and temp-worktree-deletion failures surface via the popup instead of terminating the picker.

Changes

Error Popup Feature

Layer / File(s) Summary
Error popup rendering
crates/wisp-ui/src/lib.rs
SurfaceModel gains an error field; render_surface overlays a centered "Error" popup via new render_error_popup/centered_rect helpers; tests verify presence/absence of the popup.
Error state and dismissal
crates/wisp-bin/src/main.rs
Adds error state and report_err! macro to the event loop, wires the value into SurfaceModel, and dismisses the popup on the next keypress instead of processing intents.
Routing action failures to popup
crates/wisp-bin/src/main.rs
Activate, rename, kill-session, and temp-worktree-deletion paths now capture failures via report_err! or explicit error-setting flows, restoring UI state and continuing instead of propagating errors.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PickerLoop
    participant Backend
    participant SurfaceModel
    participant UI as render_surface

    User->>PickerLoop: trigger action (activate/rename/kill/delete)
    PickerLoop->>Backend: call backend operation
    Backend-->>PickerLoop: Err(failure)
    PickerLoop->>PickerLoop: set error, restore state, continue loop
    PickerLoop->>SurfaceModel: build model with error
    SurfaceModel->>UI: render_surface(model)
    UI->>UI: render_error_popup(message)
    User->>PickerLoop: press any key
    PickerLoop->>PickerLoop: take() error, dismiss popup
Loading

Possibly related PRs

  • Pajn/wisp#4: Both PRs modify the same activate/rename/kill-session paths in crates/wisp-bin/src/main.rs, with this PR rerouting those failure paths into the new error popup.

Poem

A popup pops when things go wrong,
No crash, no exit, just carry on!
Press any key, the fright will fade,
Back to the burrow, unafraid. 🐇
Hop, hop, error—dismissed, hooray!

🚥 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 matches the main change: adding a dismissible error popup for picker failures.
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.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@Pajn

Pajn commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/wisp-bin/src/main.rs (1)

1891-1898: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Dismiss the error popup before translating the key
translate_key returns None for every unhandled KeyCode—for example Tab, Home, End, Delete, page keys, and function keys—so those keys never reach error.take() and the popup stays open despite the “press any key to dismiss” copy. Move the modal dismissal before intent translation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/wisp-bin/src/main.rs` around lines 1891 - 1898, The key handling in
main’s event loop dismisses the error popup only after translate_key runs, so
unhandled keys never clear the modal. Update the event flow around event::poll,
event::read, and translate_key so the error.take() check happens immediately
after reading a Key event and before translating it into an intent. Keep the
modal-dismiss behavior in the same loop, but ensure any key press can close the
popup regardless of whether translate_key recognizes the key.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/wisp-ui/src/lib.rs`:
- Around line 110-142: The popup sizing in the error rendering logic is
underestimating wrapped height because `message_len.div_ceil(inner_width)` does
not match `Paragraph::wrap(Wrap { trim: true })` word-based wrapping, which can
cause the dismiss hint to be clipped. Update the height calculation in the error
popup rendering path around `wrapped_lines`, `height`, and
`Paragraph::new(text)` to compute the body height using the same wrapping
behavior as `Paragraph`, and keep the “press any key to dismiss” line reserved
as its own row below the message.

---

Outside diff comments:
In `@crates/wisp-bin/src/main.rs`:
- Around line 1891-1898: The key handling in main’s event loop dismisses the
error popup only after translate_key runs, so unhandled keys never clear the
modal. Update the event flow around event::poll, event::read, and translate_key
so the error.take() check happens immediately after reading a Key event and
before translating it into an intent. Keep the modal-dismiss behavior in the
same loop, but ensure any key press can close the popup regardless of whether
translate_key recognizes the key.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: da649f5d-a7e3-4d38-9a5c-c394fde62c90

📥 Commits

Reviewing files that changed from the base of the PR and between 6089ecb and b2e2def.

📒 Files selected for processing (2)
  • crates/wisp-bin/src/main.rs
  • crates/wisp-ui/src/lib.rs

Comment thread crates/wisp-ui/src/lib.rs
@Pajn
Pajn force-pushed the error-handling branch from b2e2def to 1bac044 Compare July 3, 2026 05:23
@Pajn
Pajn merged commit 1f964a9 into main Jul 3, 2026
3 checks passed
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.

2 participants