Skip to content

fix(web): clamp dashboard session search limit parameter - #35316

Closed
aydnOktay wants to merge 2 commits into
NousResearch:mainfrom
aydnOktay:fix/web-session-search-limit
Closed

fix(web): clamp dashboard session search limit parameter#35316
aydnOktay wants to merge 2 commits into
NousResearch:mainfrom
aydnOktay:fix/web-session-search-limit

Conversation

@aydnOktay

Copy link
Copy Markdown
Contributor

Summary

This PR clamps the limit query parameter on GET /api/sessions/search in the web dashboard so invalid or excessive values cannot overload SQLite FTS queries.

Problem

The dashboard session search endpoint forwarded limit directly to SessionDB.search_messages(). Callers could pass limit=0, negative values, or very large numbers (e.g. 9999), which is unnecessary load for a UI search endpoint and produces surprising behavior.

Solution

  • Add _clamp_session_search_limit() with default 20, minimum 1, maximum 100.
  • Apply it at the start of search_sessions() before opening the DB connection.

Tests

  • Unit tests for the clamp helper (invalid, zero, excessive values).
  • Endpoint test verifying the clamped limit is passed through to SessionDB.search_messages().

4 tests passed locally.

Notes

  • Focused change in hermes_cli/web_server.py only; no workflow or unrelated file changes.
  • Complements (but does not duplicate) lower-level SessionDB pagination hardening if submitted separately.

Bound the /api/sessions/search limit query parameter so invalid or excessive values cannot overload FTS queries from the web dashboard, with unit and endpoint regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels May 30, 2026
When progressive edits fail before finish(), deliver only the missing tail instead of retrying a doomed finalize edit. Mirrors the segment-break flush path and fixes test_edit_failure_sends_only_unsent_tail_at_finish.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #32564 and #35308 (same author, same clamping pattern applied to hermes_state.py). This PR is the web_server.py / dashboard variant.

@alt-glitch alt-glitch added the comp/dashboard Web dashboard / control panel UI (dashboard/, landing) label Jun 26, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused dashboard hardening. This is an automated hermes-sweeper review; current main already provides the requested behavior, so this PR is superseded.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages 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 labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants