Repository navigation
Fix: Toggle agentop's spend drawer with $, and leave esc to the pane - #1356
Conversation
The drawer took esc before the pane did, so with it open, leaving a pane took two presses. Its hint line also advertised esc as the way to close it, so `$` closing it went unnoticed. `$` is now the only close: esc always reaches the pane, and the hint line and the ? overlay say `$`. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe spend drawer now closes with ChangesSpend drawer key handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The updated controls and documented behavior are consistent; no merge-blocking issue is identified. Pre-merge checks |
|
Fixes review: the README demo storyboard and its capture test closed the drawer with esc, and the committed SVG showed "esc closes" Files: - docs/assets/cortex-demo.svg - scripts/readme-demo/capture_test.go - scripts/readme-demo/demo.yaml Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
esnible
left a comment
There was a problem hiding this comment.
The change is correct and well-tested. Esc no longer goes to the drawer. The poll-chain invalidation is untouched on the $ path, which is now the only close. The new Events→Sessions subtest checks both that Esc reaches the pane and that the drawer survives. I also checked the overlay comment's claim: a {"$", "close"} row would trip TestGlobalKeys_AdvertiseNoKeyTwice, since $ is already a jump target. Merged with current main (after #1352), go vet and go test ./tui/ pass in cmd/agentop. scripts/readme-demo's asset staleness check also passes, so the one-line SVG change still matches after main's SVG edits.
One stale reference is outside the diff, so it can't go inline. cmd/agentop/tui/app.go:1783-1784 (the spendDrawerTickMsg case) still says "see the esc handler, which leaves the flag alone precisely so returning finds the drawer as the operator left it". That handler is the one this PR deletes. The same sentence in spend_drawer_test.go:1387 was updated to "only $ clears it, so returning finds the drawer as the operator left it", and the same rewording fits here. (nit)
Author: huang195 (MEMBER — maintainer)
Areas reviewed: Go (agentop TUI, readme-demo), Docs (agentop README), YAML (demo storyboard), generated SVG
Agent/IDE config (.claude/.vscode): none
Commits: 2 commits, all signed-off: yes (both use Assisted-By)
CI status: passing (Spellcheck skipped)
| // reaching the pane, so with the drawer open, leaving a pane took two presses, and which | ||
| // press did what depended on whether the drawer was open. The drawer is not modal (it | ||
| // stays open alongside the table, and `a`/`w` are the only keys it takes), so esc keeps | ||
| // its one meaning on every pane: go back. |
There was a problem hiding this comment.
suggestion (not blocking): In picker mode, Esc on Sessions goes back to the Pods picker and tears down the port-forward and SSE stream. The old Esc-closes-drawer path also protected that: someone who pressed Esc to dismiss the drawer lost nothing. Now that press costs the connection. When they pick the pod again the drawer is still open, because expanded survives.
The back-out block's own rule (keys.go:459-460) is that "a key-opened surface returning to its caller must never cost the connection", and the drawer is opened by a key. The [$] closes hint probably makes this acceptable. If so, it's worth saying here that Sessions in picker mode is the one place this choice has a cost.
Summary
$now opens and closes agentop's spend drawer. Esc no longer closes it.The problem: the drawer handled Esc before the pane did. With the drawer open, the first Esc closed the drawer and the second one left the pane. The drawer's hint line also said
esc closes, so nothing on screen said that$already closed it.What changed
tui/keys.go). It always reaches the pane, so leaving a pane takes one press. The drawer stays open, as it already did when you moved between panes.[$] closesinstead ofesc closes. It's the same width, so the layout doesn't move.?overlay says the drawer is "opened and closed with $" and no longer lists Esc. There is no separate$close row, becauseTestGlobalKeys_AdvertiseNoKeyTwiceforbids the overlay listing one key for two things, and a toggle is one thing.Tests
$only, since that is the only way to close it.gofmtandgo vetare clean incmd/agentop, andgo test ./...passes.Deferred from review
cmd/agentop/tui/help_overlay.go:155:helpGlobalGroups's doc says the drawer block on a refused pane would be "three keys of pure noise"; with the$ · escrow gone it is two (nit).scripts/readme-demo/capture_test.go:87: nothing asserts the drawer actually closed before Usage, so a regression shows up only downstream as the missed tool manifest and the stale SVG; assert the usage screen lacksWHERE IT WENT(nit).Assisted-By: Claude (Anthropic AI) noreply@anthropic.com
Summary by CodeRabbit
$. When the drawer is open,Escno longer closes it and continues to work for pane navigation.$as the close key, keeping the on-screen guidance consistent with the keyboard behavior.