feat: high-visibility approval banner for pending tool calls#6
Conversation
A pending tool approval only surfaced as a one-line worker row — same visual weight as the idle/thinking indicator — plus an inline tool card that scrolls away. Easy to miss in a busy autonomous session. Add a dedicated, high-contrast banner above the prompt that appears only while the focused session has a tool awaiting confirmation: a bold-bordered "⚠ APPROVAL NEEDED" block showing the tool + what it wants to do, with [Y] approve / [D] deny / [Esc] cancel as colored chips. The worker row no longer duplicates the approval text. The banner only occupies layout space when there's something to approve. `pending_tool` is a pure, unit-tested lookup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a dedicated TUI approval banner for pending tool confirmations, conditionally inserts it into the main layout, and removes the older inline approval warning from the worker status line. ChangesApproval banner flow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6 +/- ##
===========================================
+ Coverage 36.79% 49.44% +12.64%
===========================================
Files 30 31 +1
Lines 5156 5362 +206
===========================================
+ Hits 1897 2651 +754
+ Misses 3259 2711 -548
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/codeoid-tui/src/ui/approval.rs`:
- Around line 70-82: The truncation budget for the description in the action
Line construction does not account for the width of the tool name prefix that
appears before it. Currently, only 2 is subtracted from inner.width in the
truncate call, but this ignores the actual rendered width of the tool label
itself plus the surrounding spaces. Calculate the total width of the prefix (the
space, the tool name, and the two spaces) and subtract that complete width from
inner.width to determine the proper truncation budget for the description text,
ensuring the full line does not exceed the available width.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7f959bd7-89ab-4682-89b9-908facd3a366
📒 Files selected for processing (3)
crates/codeoid-tui/src/ui/approval.rscrates/codeoid-tui/src/ui/mod.rscrates/codeoid-tui/src/ui/worker.rs
Extract render_banner so the drawing is exercised without an AppState, and assert the rendered buffer carries the title, tool, description, and the approve/deny key prompts. Lifts patch coverage on the new render code. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drive the full ui::render with a session whose tool is awaiting confirmation and assert the banner appears — covering the conditional layout zone in ui::mod plus pending/is_pending/render. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…abbit) truncate() was given inner.width - 2, ignoring the rendered ' <tool> ' prefix, so a long tool+description could overflow and wrap the banner. Subtract the prefix columns so the line stays single-row. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Good catch @coderabbitai — fixed in d952299: the description budget now subtracts the |
|
Tip For best results, initiate chat on the files or code changes.
|
Makes tool-approval requests impossible to miss.
Problem
A pending approval surfaced only in low-key places: a one-line worker row (same weight as the idle/thinking indicator), an inline tool card that scrolls away, a footer hint, and a
!on the tab. There's a modal system, but it was only used for destroy confirmation — tool approvals got no prominent treatment, so in a busy autonomous session the request was easy to overlook.Change
A dedicated high-contrast approval banner rendered above the prompt, but only while the focused session has a tool awaiting confirmation:
Y/D/Escas green/red/grey background chips so the action reads at a glance.Tests
pending_tool(the focused-session lookup) is pure + unit-tested (finds a waiting tool, ignores completed ones, ellipsis truncation). Fullcodeoid-tuisuite: 159 passed, clippy clean.🤖 Generated with Claude Code
Summary by CodeRabbit