feat: add TUI session controls#66
Conversation
Zero automated PR reviewVerdict: No blockers found Blockers
Validation
ScopeHead: This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality. |
|
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 (4)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughAdds three TUI commands (/effort, /style, /compact), records agent usage events into the UI, and extends model/options/rendering to surface session preferences, compaction status, and usage summaries. ChangesTUI Session Controls for Effort, Style, Compaction & Usage Tracking
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/tui/rendering.go (1)
55-64: 💤 Low valueDecide whether session control commands should appear in the footer
internal/tui/rendering.goshows a hard-codedfeaturedlist (anddefaultCommandFooterText) containing only/help /model /provider /context /tools /permissions /clear /exit(plusEsc clear/Esc cancelandCtrl+C quit), intentionally omitting/compact,/effort, and/styleeven though they’re registered ininternal/tui/commands.go. If discoverability in the footer is desired, addcommandCompact,commandEffort, andcommandStyleto thefeaturedslice; otherwise the current behavior is consistent.🤖 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 `@internal/tui/rendering.go` around lines 55 - 64, The footer's featured command list currently omits session control commands; update the featured []commandKind slice in internal/tui/rendering.go to include commandCompact, commandEffort, and commandStyle (in addition to commandHelp, commandModel, etc.) so those registered commands from internal/tui/commands.go appear in the footer; ensure the defaultCommandFooterText remains consistent with the footer presentation after adding these symbols.
🤖 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 `@internal/tui/session_controls.go`:
- Around line 183-190: The current error handling around m.usageTracker.Record
in recordUsageEvent always treats any Record(...) error as a pricing-unavailable
case and increments m.unpricedRequests/m.unpricedTokens; change this so only
known "unpriced" Record errors increment those counters. Implement an
isUnpricedUsageError(err) predicate (or use the usageTracker's typed error) and,
after calling usageTracker.Record, if err != nil then: if
isUnpricedUsageError(err) increment m.unpricedRequests and m.unpricedTokens and
return as before; otherwise convert the error into a rowError transcript (like
other normalization errors) and append it rather than marking the request as
unpriced. Ensure you reference usageTracker.Record, recordUsageEvent,
m.unpricedRequests, m.unpricedTokens, and the new isUnpricedUsageError helper
when making the change.
---
Nitpick comments:
In `@internal/tui/rendering.go`:
- Around line 55-64: The footer's featured command list currently omits session
control commands; update the featured []commandKind slice in
internal/tui/rendering.go to include commandCompact, commandEffort, and
commandStyle (in addition to commandHelp, commandModel, etc.) so those
registered commands from internal/tui/commands.go appear in the footer; ensure
the defaultCommandFooterText remains consistent with the footer presentation
after adding these symbols.
🪄 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: 0f0a5f0e-3954-4b8b-ba1b-b55132153e29
📒 Files selected for processing (8)
internal/tui/command_center.gointernal/tui/commands.gointernal/tui/model.gointernal/tui/model_test.gointernal/tui/options.gointernal/tui/rendering.gointernal/tui/session_controls.gointernal/tui/session_controls_test.go
gnanam1990
left a comment
There was a problem hiding this comment.
[P1] Do not collapse all usage record failures into unpriced usage
currently treats every error as a pricing-unavailable case by incrementing and . I verified can fail from () as well as pricing paths such as missing rates or tier selection. The TUI should only use the token-only/cost-unavailable fallback for known pricing/unpriced failures; non-pricing tracker errors should be surfaced as a transcript, like the existing normalization error path. Otherwise future tracker failures can be silently hidden in the footer as if they were expected custom-model pricing gaps.
Validation run on PR head :
- ok github.com/Gitlawb/zero/internal/tui 0.230s
ok github.com/Gitlawb/zero/internal/usage 0.606s
ok github.com/Gitlawb/zero/internal/modelregistry 0.776s
CI is green, but this behavior issue should be fixed before merge.
|
Correction to my review body above, the shell stripped the Markdown code spans. The intended blocker is: [P1] Do not collapse all usage record failures into unpriced usage
Validation run on PR head
CI is green, but this behavior issue should be fixed before merge. |
gnanam1990
left a comment
There was a problem hiding this comment.
Looks good on the updated head eec0cc2bd7a4f11e9b225e538777f79d0314365f.
The previous blocker is resolved enough for this slice: invalid usage normalization now appends a transcript error instead of being counted as unpriced, and the remaining unknown/custom-model path is intentionally treated as token-only cost-unavailable usage for custom TUI models.
Validation:
go test -count=1 ./internal/tui ./internal/usage ./internal/modelregistrygit diff --check origin/main...HEAD
GitHub checks are green: Ubuntu/macOS/Windows Smoke, Performance Smoke, Zero Review, and CodeRabbit.
Summary
Tests
Summary by CodeRabbit
New Features
/effort,/style, and/compactsession commands for runtime configurationTests