Repository navigation
Fix: Shorten the sessions table's context heading to CTX(1M) - #1246
Conversation
The sessions table's CONTEXT(1M) heading was clipped at 14 terminal widths, 45 through 58, so the column rendered "CONTE…" and lost the "(1M)" denominator the title exists to state. Its declared width equalled the title's eleven columns, but fitTableColumns shrinks the widest column against one global floor of four, and at eleven this was often the widest. No declared width prevents that. CTX(1M) is seven columns and clears every width from 45 to 200, with no rows, with untitled and titled rows, and with the AGENT column two agents add. table_ansi_test.go's heading sweep loses its exemption for the column, so it now holds every heading to its fitted width. Removing the exemption on main fails at exactly widths 45-58. The narrower column moves every threshold the comments and README quote. Re-measured: declared/rendered 88/104 -> 84/100, TITLE from 73 -> 69, COST and SAVED absent 73-96 -> 69-92 and back at 97 -> 93, SESSION 12 at 97 and 14 from 100, and the money columns' own floor 73 -> 71. Two of those were already stale on main: SESSION reached 14 from 104, not the quoted 116. Every comment and the README that names the column by its heading moves with it. The README's rendered sample is re-rendered from the code at 100 columns, and scripts/readme-demo's recording is regenerated because it captures the real TUI. Fixes rossoctl#1094. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
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 sessions table context heading changes from ChangesSessions table heading
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to The shorter heading fits narrow terminals without displacing adjacent headings, and the documented column cutoffs match the table behavior. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❓ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation Issue ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
mrsabath
left a comment
There was a problem hiding this comment.
Review
I checked out the PR head and measured every numeric claim in the body against the real render path (model.layout() + rebuildSessionsTable()), with an origin/main baseline for comparison.
| Claim | Measured | |
|---|---|---|
| declared 84 / rendered 100 | 84 / 100 | ✅ |
| TITLE renders from 69 | 69 | ✅ |
| money absent 69–92, returns at 93 | gap 69→92, returns 93 | ✅ |
| money columns' own floor 71 (no TITLE) | 71 | ✅ |
| SESSION 12 at 97, 14 from 100 | 12 at 97, 13 at 98–99, 14 at 100+ | ✅ |
| non-TITLE/non-money columns render 63 | 63 | ✅ |
CTX(1M) clips at no width 45–200 |
zero clips | ✅ |
| exemption deleted on main fails at exactly 45–58 | exactly 14 failures, widths 45–58 | ✅ |
The headline test-plan claim is the strongest one and it holds precisely: deleting the exemption on origin/main produces exactly 14 failures at widths 45–58, no more and no fewer. The rename makes the sweep pass with no exemption at all.
The README sample is consistent with the code rather than hand-edited — at 100 columns the fitter gives SESSION=14, matching the widened ctx-abc-123-4… prefix, and CTX(1M)=7.
./tui passes clean. The cmd/agentop failures in my sandbox are environment artifacts (/private/var/select/sh: Operation not permitted, PID-inspection tests) unrelated to this change, and CI is green on all 28 checks.
Notes
- Removing the exemption rather than widening it is the right call. The old comment diagnosed its own trap — "an exemption retiring on a PR with no reason to touch it is permanent by accident" — and this PR closes it by making the sweep unconditional. That is a net tightening of the test, not just a rename.
- The comment discipline holds up. The "WRONG NUMBERS THREE TIMES" paragraph names its own failure mode and the sweep that catches it, and the two history sentences deliberately keep
CONTEXT(1M)where they describe the past. Rewriting those would have made the history incoherent; leaving them is correct.
No must-fix, no suggestions, no nits. I went looking for a stale threshold and did not find one.
One note on my own process, since it is the exact trap this code warns about: my first sweep used sessionsColumnsFor(w) directly and reported SESSION as 14 at every width, which made the "12 at 97" claim look wrong. That helper skips the fitting that actually sizes the columns — the claim is correct and my measurement was not. A declared width is not a fitted one.
LGTM.
Summary
Fixes #1094. The sessions table's context heading is now
CTX(1M)instead ofCONTEXT(1M), so the column stops clipping on narrow terminals.CONTEXT(1M)was clipped toCONTE…or shorter at 14 terminal widths (45–58). The first thing lost was the(1M), the denominator the title exists to state. Declaring the column at the title's own eleven columns could not prevent it:fitTableColumnsshrinks the widest column against one global floor of four, and at eleven this column was often the widest.CTX(1M)is seven columns. Measured at every width from 45 to 200, it clips at none of them under four data conditions:CONTEXT(1M)clips at exactly 45–58 under all four.Changes
tui/sessions_pane.go: the constant changes. Its doc comment now says why seven columns, and names the sweep that keeps it true.tui/table_ansi_test.go: the heading sweep's exemption for this column is deleted, so it holds every heading to its fitted width. With the exemption removed and the old title kept, it fails at exactly widths 45–58.Re-measured thresholds: the narrower column moves every number that comments and the README quote. Each one was measured before and after:
The SESSION row was already stale on main: the comment said "14 from 116 up", but it measured 104.
Heading references: every comment that names the column by its heading moves with it. These are the files the issue lists, plus
sessions_context_wire_test.go,selected_highlight_test.goand thescripts/readme-demosources. Two history sentences about the eleven-column title keep the old name.cmd/agentop/README.md: the prose and the threshold paragraph are updated. The rendered sample is re-rendered from the code at 100 columns, not hand-edited: the CTX column is narrower, and at 100 SESSION is now 14 wide. The sample's caption now says 93 is the narrowest width that carries every column.scripts/readme-demo:capture_test.goasserts the new heading.docs/assets/cortex-demo.svgis regenerated withGOWORK=off go run ., because the demo captures the real TUI: 12 lines change, all in the sessions table.Test plan
GOWORK=off go test -count=1 ./...incmd/agentop(withSSL_CERT_FILEunset, for the knownTestRunExec_BeforeFirstStartRunsAndSaysWhatIsLostinteraction) and inscripts/readme-demo. That includesTestCommittedAssetIsCurrent, which failed before the regeneration.go vet ./...andgofmt -l .are clean in both modules.Assisted-By: Claude (Anthropic AI) [email protected]
Summary by CodeRabbit
User Interface
CTX(1M), freeing space for other columns.Documentation