From ee8a9014eda0704b85e55109c1eb768eab6e4726 Mon Sep 17 00:00:00 2001 From: Sasa Junuzovic <44276455+microsasa@users.noreply.github.com> Date: Fri, 24 Apr 2026 08:02:00 -0700 Subject: [PATCH 1/3] fix: remove misleading 'Since Last Shutdown' from active sessions title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The active-sessions table title in _render_active_section_from hardcoded 'Since Last Shutdown', which is inaccurate for pure-active sessions (has_shutdown_metrics=False) that have never had a shutdown event. Change the title to '🟢 Active Sessions' unconditionally (Option A from issue #1072). The columns already convey what data is being shown. - Update existing resumed-session test to assert absence of qualifier - Add new test for pure-active sessions verifying no 'Since Last Shutdown' - Update e2e _ACTIVE_MARKER constant to match new title Closes #1072 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/copilot_usage/report.py | 2 +- tests/copilot_usage/test_report.py | 27 ++++++++++++++++++++++++--- tests/e2e/test_e2e.py | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/copilot_usage/report.py b/src/copilot_usage/report.py index 809e2141..b77f55cb 100644 --- a/src/copilot_usage/report.py +++ b/src/copilot_usage/report.py @@ -555,7 +555,7 @@ def _render_active_section_from( return table = Table( - title="🟢 Active Sessions (Since Last Shutdown)", border_style="green" + title="🟢 Active Sessions", border_style="green" ) table.add_column("Name", style="bold", max_width=40) table.add_column("Model") diff --git a/tests/copilot_usage/test_report.py b/tests/copilot_usage/test_report.py index b5ecb7d6..38690e71 100644 --- a/tests/copilot_usage/test_report.py +++ b/tests/copilot_usage/test_report.py @@ -3656,9 +3656,9 @@ def test_resumed_free_session_appears_in_active_section(self) -> None: }, ) output = _capture_full_summary([session]) - # Active section table title should indicate it is scoped to the period - # since the last shutdown, which distinguishes it from the historical table. - assert "Since Last Shutdown" in output + # Active section table title should NOT contain the misleading + # "Since Last Shutdown" qualifier (issue #1072). + assert "Since Last Shutdown" not in output # The same resumed session should appear in both the historical and active sections. assert output.count("ResumedFreeSession") == 2 # And the generic empty-active message should not be shown. @@ -3683,6 +3683,27 @@ def test_pure_active_session_not_in_historical(self) -> None: output = _capture_full_summary([session]) assert "No historical shutdown data" in output + def test_pure_active_section_title_no_since_last_shutdown(self) -> None: + """Issue #1072 — pure-active session (has_shutdown_metrics=False) + must NOT show 'Since Last Shutdown' in the active-section title.""" + session = SessionSummary( + session_id="pure-active-title-1234", + name="PureActiveTitle", + model="gpt-5-mini", + start_time=datetime(2025, 1, 15, 10, 0, tzinfo=UTC), + is_active=True, + has_shutdown_metrics=False, + total_premium_requests=0, + user_messages=2, + model_calls=1, + active_model_calls=1, + active_output_tokens=100, + ) + output = _capture_full_summary([session]) + assert "Since Last Shutdown" not in output + # The generic title should still be present. + assert "Active Sessions" in output + class TestBuildEventDetailsCatchAll: """Issue #230 — _build_event_details catch-all branch for event types without explicit details.""" diff --git a/tests/e2e/test_e2e.py b/tests/e2e/test_e2e.py index ec72a3e1..8e364379 100644 --- a/tests/e2e/test_e2e.py +++ b/tests/e2e/test_e2e.py @@ -809,7 +809,7 @@ def test_not_found_shows_available_list(self) -> None: # --------------------------------------------------------------------------- # Marker that separates the historical section from the active section -_ACTIVE_MARKER = "Active Sessions (Since Last Shutdown)" +_ACTIVE_MARKER = "Active Sessions" # Minimal completed session with zero premium requests (free-tier model only). # Used to verify that the historical filter's ``not s.is_active`` branch From 3ae9bfeaff30a493e7e27a2277e146198ebe1166 Mon Sep 17 00:00:00 2001 From: Sasa Junuzovic <44276455+microsasa@users.noreply.github.com> Date: Fri, 24 Apr 2026 08:08:48 -0700 Subject: [PATCH 2/3] fix: resolve CI ruff format violation in report.py The Table() constructor call was left in multi-line format after shortening the title string. With the shorter title, the call fits on a single line (66 chars < 88 line limit), so ruff format requires it to be collapsed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/copilot_usage/report.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/copilot_usage/report.py b/src/copilot_usage/report.py index b77f55cb..a98e6c0f 100644 --- a/src/copilot_usage/report.py +++ b/src/copilot_usage/report.py @@ -554,9 +554,7 @@ def _render_active_section_from( ) return - table = Table( - title="🟢 Active Sessions", border_style="green" - ) + table = Table(title="🟢 Active Sessions", border_style="green") table.add_column("Name", style="bold", max_width=40) table.add_column("Model") table.add_column("Model Calls", justify="right") From 8f20f4c68d954ca17ce5fba0c9f86bc51325b08d Mon Sep 17 00:00:00 2001 From: Sasa Junuzovic <44276455+microsasa@users.noreply.github.com> Date: Fri, 24 Apr 2026 08:18:33 -0700 Subject: [PATCH 3/3] fix: address review comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/copilot_usage/report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/copilot_usage/report.py b/src/copilot_usage/report.py index a98e6c0f..16304504 100644 --- a/src/copilot_usage/report.py +++ b/src/copilot_usage/report.py @@ -592,7 +592,7 @@ def render_full_summary( """Render the two-section summary for interactive mode. Section 1: Historical shutdown data (totals, per-model, per-session). - Section 2: Active sessions since last shutdown. + Section 2: Currently active sessions. *sessions* must be in descending ``start_time`` order — the contract guaranteed by :func:`~copilot_usage.parser.get_all_sessions`. No