Skip to content

fix: hide cron agent sessions from sidebar by default#1143

Closed
dso2ng wants to merge 2 commits intonesquena:masterfrom
dso2ng:fix/hide-cron-agent-sessions
Closed

fix: hide cron agent sessions from sidebar by default#1143
dso2ng wants to merge 2 commits intonesquena:masterfrom
dso2ng:fix/hide-cron-agent-sessions

Conversation

@dso2ng
Copy link
Copy Markdown
Contributor

@dso2ng dso2ng commented Apr 27, 2026

Thinking Path

  • Hermes WebUI's sidebar acts as the default interactive conversation picker.
  • Hermes Agent cron jobs also write session rows into state.db.
  • When "Show CLI sessions in sidebar" is enabled, those cron-run sessions can appear alongside user-facing conversations.
  • Cron sessions are useful for diagnostics, but they are background/internal runs and usually should not clutter the default sidebar.
  • Hermes CLI already treats cron sessions as hidden from normal interactive session browsing unless explicitly requested.
  • This PR applies the same default-hiding concept to WebUI's agent-session projection while keeping an explicit opt-out path for diagnostic callers.

What Changed

  • Added an exclude_sources option to read_importable_agent_session_rows().
  • Defaulted exclude_sources to ("cron",) so cron sessions are omitted from the default WebUI sidebar session list.
  • Kept exclude_sources=None as an opt-out for callers that need to inspect all agent sessions, including cron runs.
  • Added regression coverage for:
    • /api/sessions hiding cron sessions by default while still showing non-cron agent sessions.
    • read_importable_agent_session_rows(..., exclude_sources=None) still being able to return cron sessions.
  • Updated an existing watcher test fixture to use a non-cron source now that cron is intentionally hidden by default.

Why It Matters

This keeps the WebUI sidebar focused on user-facing conversations and prevents scheduled/background jobs from crowding out interactive sessions. It also aligns WebUI behavior with Hermes Agent CLI session browsing semantics.

Verification

$HOME/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_gateway_sync.py -q

Result:

29 passed

Risks / Follow-ups

  • This changes the default visibility of cron sessions in the WebUI sidebar when CLI/agent sessions are enabled.
  • Cron sessions are not deleted; they remain in state.db for diagnostics.
  • WebUI does not currently expose a source-specific session filter. If maintainers want UI-level inspection later, the new exclude_sources=None opt-out gives a backend path for that.

Model Used

AI-assisted.

  • Provider: OpenAI Codex / Hermes Agent
  • Model: gpt-5.5
  • Notable tooling: local repository inspection, patching, pytest verification

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Thanks for this PR, @dso2ng! The rationale is solid — cron sessions are background artifacts and shouldn't crowd the interactive sidebar by default.

Scope looks well-targeted:

  • read_importable_agent_session_rows()exclude_sources parameter added with ("cron",) as the default, keeping the opt-out path (exclude_sources=None) for diagnostic callers.
  • /api/sessions uses the new default, hiding cron sessions from the WebUI sidebar without deleting anything.
  • Existing watcher test fixture updated to use a non-cron source (correct — cron was intentionally hidden by the new default).

Test results: 29 passed in tests/test_gateway_sync.py. ✅

Alignment with CLI behavior: WebUI now matches Hermes Agent CLI session browsing semantics, which hides cron sessions unless explicitly requested. Good consistency.

Potential follow-up: The PR notes that WebUI has no UI-level source filter yet. The exclude_sources=None opt-out gives a clean backend path if a future "Show cron sessions" toggle is added to the sidebar settings. Not blocking this PR.

Flagging for maintainer review and merge. 🙏

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Thanks for the follow-up commit — good catch extending the fix to cover imported cron sessions too. The original change correctly excluded locally-created cron sessions from the sidebar, but sessions imported via gateway sync also have source: "cron" and would have bypassed the filter.

The addition in api/models.py and expanded test coverage in tests/test_gateway_sync.py make this complete. The fix now covers both cases consistently.

nesquena-hermes added a commit that referenced this pull request Apr 27, 2026
Merged as v0.50.227. 2634 tests passing, browser QA 21/21 (desktop + mobile). Full attribution below.

Thanks to all 12 contributors:
@jundev0001 (#1138), @franksong2702 (#1142, #1157, #1162), @dso2ng (#1143), @bergeouss (#1145, #1146, #1156, #1159), @jasonjcwu (#1149), @ccqqlo (#1161), @frap129 (#1165)

Two fixes applied during integration and two more by the independent reviewer (@nesquena):
- messages.js: per-turn cost delta capture order (#1159)
- workspace.py: symlink target blocked-roots check + HOME sanity guard (#1149, #1165)
- panels.js: cron unread counter bookkeeping (in-loop increment bug)
- tests/test_symlink_cycle_detection.py: register workspace before session/new
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Merged as v0.50.227 via batch PR #1168. Thank you @dso2ng! 🎉

JKJameson pushed a commit to JKJameson/hermes-webui that referenced this pull request Apr 29, 2026
Merged as v0.50.227. 2634 tests passing, browser QA 21/21 (desktop + mobile). Full attribution below.

Thanks to all 12 contributors:
@jundev0001 (nesquena#1138), @franksong2702 (nesquena#1142, nesquena#1157, nesquena#1162), @dso2ng (nesquena#1143), @bergeouss (nesquena#1145, nesquena#1146, nesquena#1156, nesquena#1159), @jasonjcwu (nesquena#1149), @ccqqlo (nesquena#1161), @frap129 (nesquena#1165)

Two fixes applied during integration and two more by the independent reviewer (@nesquena):
- messages.js: per-turn cost delta capture order (nesquena#1159)
- workspace.py: symlink target blocked-roots check + HOME sanity guard (nesquena#1149, nesquena#1165)
- panels.js: cron unread counter bookkeeping (in-loop increment bug)
- tests/test_symlink_cycle_detection.py: register workspace before session/new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants