Skip to content

Clamp session.list limit to avoid unbounded fetches - #74784

Closed
aydnOktay wants to merge 1 commit into
NousResearch:mainfrom
aydnOktay:fix/tui-session-list-limit-clamp
Closed

Clamp session.list limit to avoid unbounded fetches#74784
aydnOktay wants to merge 1 commit into
NousResearch:mainfrom
aydnOktay:fix/tui-session-list-limit-clamp

Conversation

@aydnOktay

Copy link
Copy Markdown
Contributor

The TUI gateway session.list RPC accepted unbounded and negative limit values, which could force oversized SQL fetches and cause Python negative-slice semantics to return nearly the full session list. This change clamps limit to a safe range of 1–500 while preserving the existing default of 200 for the resume picker.

Negative or huge limit values on the TUI gateway session.list RPC could over-fetch via SQL and flip Python rows[:limit] into nearly-full results. Clamp to 1-500 while preserving the default of 200.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 30, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks — this fixes a verified current-main defect in the TUI session-list RPC.

Suggested changes

  • Consider a separate follow-up for spawn_tree.list: tui_gateway/methods_session.py:2858 accepts an unchecked limit and :2903 slices with it, preserving the negative-slice pattern. This is outside the scope of the present session.list change and is non-blocking.

session.list on current main passes its caller-controlled limit through to the SQL-backed list_sessions_rich fetch (tui_gateway/methods_session.py:178-192; hermes_state.py:5227). PR commit 48f561614bae bounds that value to 1–500 and adds regression coverage for excessive, negative, zero, and default inputs.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/sessions Session lifecycle, resume, persistence, history labels Jul 30, 2026
@aydnOktay

Copy link
Copy Markdown
Contributor Author

Closing to concentrate review on a single linked product bug: #89979.

@aydnOktay aydnOktay closed this Aug 19, 2026
@aydnOktay

Copy link
Copy Markdown
Contributor Author

Closing to concentrate review on a single linked product bug: #89979.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions Session lifecycle, resume, persistence, history comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants