Skip to content

Fix: Shorten the sessions table's context heading to CTX(1M) - #1246

Merged
huang195 merged 1 commit into
rossoctl:mainfrom
huang195:fix/ctx-1m-heading
Oct 2, 2026
Merged

huang195 merged 1 commit into
rossoctl:mainfrom
huang195:fix/ctx-1m-heading

Conversation

@huang195

@huang195 huang195 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #1094. The sessions table's context heading is now CTX(1M) instead of CONTEXT(1M), so the column stops clipping on narrow terminals.

CONTEXT(1M) was clipped to CONTE… 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: fitTableColumns shrinks 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:

  • no rows;
  • untitled rows;
  • titled rows;
  • two agents, which adds the AGENT column. That column didn't exist when the issue was measured.

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:

    before after
    declared / rendered widths 88 / 104 84 / 100
    TITLE renders from 73 69
    COST + SAVED absent, then return 73–96, return at 97 69–92, return at 93
    SESSION 12 at 100, 14 from 104 12 at 97, 14 from 100
    money columns' own floor (no TITLE) 73 71

    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.go and the scripts/readme-demo sources. 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.go asserts the new heading. docs/assets/cortex-demo.svg is regenerated with GOWORK=off go run ., because the demo captures the real TUI: 12 lines change, all in the sessions table.

Test plan

  • Deleting the exemption alone, on main, fails the sweep at exactly widths 45–58. The rename makes it pass.
  • GOWORK=off go test -count=1 ./... in cmd/agentop (with SSL_CERT_FILE unset, for the known TestRunExec_BeforeFirstStartRunsAndSaysWhatIsLost interaction) and in scripts/readme-demo. That includes TestCommittedAssetIsCurrent, which failed before the regeneration.
  • go vet ./... and gofmt -l . are clean in both modules.

Assisted-By: Claude (Anthropic AI) [email protected]

Summary by CodeRabbit

  • User Interface

    • The sessions table now labels the context gauge CTX(1M), freeing space for other columns.
    • The table can display the title column at widths of 69 characters and above; cost and savings columns appear at 93 characters and above.
  • Documentation

    • Updated the sessions table and demo guidance to reflect the abbreviated gauge label and revised width thresholds.

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]>
@huang195
huang195 requested a review from a team as a code owner October 2, 2026 21:48
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 97371c30-c571-45d4-912e-ba155d3299a8

📥 Commits

Reviewing files that changed from the base of the PR and between ef241eb and 16954cf.

⛔ Files ignored due to path filters (1)
  • docs/assets/cortex-demo.svg is excluded by !**/*.svg
📒 Files selected for processing (16)
  • cmd/agentop/README.md
  • cmd/agentop/tui/app.go
  • cmd/agentop/tui/detail_fetch.go
  • cmd/agentop/tui/event_retention_test.go
  • cmd/agentop/tui/selected_highlight_test.go
  • cmd/agentop/tui/sessions_context_wire_test.go
  • cmd/agentop/tui/sessions_money_test.go
  • cmd/agentop/tui/sessions_pane.go
  • cmd/agentop/tui/sessions_title_test.go
  • cmd/agentop/tui/styles.go
  • cmd/agentop/tui/table_ansi_test.go
  • scripts/readme-demo/README.md
  • scripts/readme-demo/capture_test.go
  • scripts/readme-demo/fixturedata.go
  • scripts/readme-demo/staleness_test.go
  • scripts/readme-demo/tuicapture.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The sessions table context heading changes from CONTEXT(1M) to CTX(1M). The related width documentation, heading-width test, comments, test descriptions, and readme-demo references are updated.

Changes

Sessions table heading

Layer / File(s) Summary
Heading and width behavior
cmd/agentop/tui/sessions_pane.go, cmd/agentop/tui/table_ansi_test.go, cmd/agentop/README.md
The table heading changes to CTX(1M). Width notes and examples are updated. The heading-width test now checks the context column.
Updated heading references
cmd/agentop/tui/app.go, cmd/agentop/tui/detail_fetch.go, cmd/agentop/tui/event_retention_test.go, cmd/agentop/tui/selected_highlight_test.go, cmd/agentop/tui/sessions_context_wire_test.go, cmd/agentop/tui/sessions_money_test.go, cmd/agentop/tui/sessions_title_test.go, cmd/agentop/tui/styles.go, scripts/readme-demo/*
Comments, test descriptions, expected output, and readme-demo text use the CTX(1M) label.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: esnible

Merge Risk: ⚪ Minimal · up to 16954

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)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive Issue #1094 requires the CTX(1M) heading, removal of the heading-sweep exemption, updated comments, and updated README prose and rendered sample. The summary establishes the heading change, exemptio… Provide reviewable evidence that docs/assets/cortex-demo.svg contains the updated CTX(1M) heading and regenerated sample. The remaining #1094 coding requirements are supported by the pull request summary.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: shortening the sessions table context heading to CTX(1M).
Out of Scope Changes check ✅ Passed The reported changes support issue #1094. They update the sessions heading, related comments and tests, width documentation, README content, demo checks, and the rendered sample. No unrelated change i…
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 14 files. (2 skipped: 2 …
Full details: Linked Issues check

Explanation

Issue #1094 requires the CTX(1M) heading, removal of the heading-sweep exemption, updated comments, and updated README prose and rendered sample. The summary establishes the heading change, exemption removal, comment updates, README update, and validation. The required regenerated sample asset docs/assets/cortex-demo.svg is excluded from review, so its content cannot be verified.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@huang195
huang195 merged commit d55ddd7 into rossoctl:main Oct 2, 2026
29 checks passed
@huang195
huang195 deleted the fix/ctx-1m-heading branch October 2, 2026 22:16
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

abctl: CONTEXT(1M) heading is clipped at 14 terminal widths (45-58); abbreviate to CTX(1M)

2 participants