ISSUE DESCRIPTION Cron sessions do not appear under their assigned project Non-empty…
- User
ISSUE DESCRIPTION
Cron sessions do not appear under their assigned project
Non-empty cron or background sessions assigned to a project must be shown when that project is selected. They remain hidden in default, unassigned, empty, and unrelated-project views. The behavior must be consistent across supported session retrieval modes.
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /hermes-webui, current file: none) bash-$
Assistant
Let's look at
test_session_discoverability_invariants.py, which sounds closely related to this issue.Assistant
Now let's view the full
_hide_from_default_sidebarcontext and update it.Assistant
Now let's modify
_hide_from_default_sidebarto respect an assigned project.Assistant
Let's add a helper function near
_isCliSessionand update the projectFiltered logic.Assistant
Now update the projectFiltered logic:
Assistant
Looks good. Let's check the new helper function insertion point too.
Assistant
Braces and parens balanced overall. Now let's write a reproduction test using the Python test harness (server) to confirm the fix works end-to-end via
/api/sessions.Assistant
Good, test server works. Let's write a temporary reproduction test that simulates a full flow: create a cron session directly in state.db, hit
/api/sessions, and check whether it appears in the response.Assistant
The server now returns the cron session with its project assigned. Let's confirm that before the fix, this same test would fail (revert temporarily to verify).
Assistant
Confirmed: without the fix the cron session is completely absent from
/api/sessions; with the fix, it's present with itsproject_id. Now let's remove the temp test file and run the broader test suite to check for regressions.Assistant
This confirms the correct behavior: raw cron sessions stay hidden by default until imported into the local session store, after which they surface with their assigned project. Let's verify this same test fails prior to the fix (only the
all_sessions()/_hide_from_default_sidebarpart reverted) to make sure our core fix is what enables this.Assistant
Confirmed. Now let's rerun the previously-failing
test_gateway_sync.pytest to make sure it passes again with the refined fix.Assistant
All pass now. Let's clean up the temp repro test and rerun the full suite to compare against the baseline failures (which were mostly due to missing
node).Assistant
Confirmed identical failure lists (the only remaining failures are pre-existing environment issues unrelated to our change — missing
node). Let's view final diff of our change set.Assistant
Good, search endpoint doesn't independently filter cron sessions. Let's view the search endpoint quickly to be safe.
Assistant
All edge cases behave as expected. Let's also double check
_is_intentionally_background_sidebar_sessionused unchanged, and confirmtest_session_discoverability_invariants.pypasses explicitly.Assistant
All targeted tests pass. Let's do a final review of the diff and clean up temp files.
Assistant
Now let's go through the checklist explicitly.
Assistant
Checklist review
-
If an error was reported in the issue description, I have successfully reproduced it. Yes. The issue was a hidden-visibility bug, not a crash. I wrote reproduction scripts (temp test files, removed before submission) that proved cron sessions imported into the WebUI store and assigned to their auto-created "Cron Jobs" project never appeared in
/api/sessions, regardless of project selection — confirming_hide_from_default_sidebar()(used by bothall_sessions()retrieval paths: index-based and full-scan fallback) unconditionally stripped any cron/cron_-prefixed session from the result set, discarding theproject_idassignment entirely. -
If an error was reported in the issue description, I have confirmed that my fix resolves the error. Yes. After the fix:
- A raw (not-yet-imported) cron row from state.db still stays correctly hidden by default (matches existing
test_gateway_sync.py::test_cron_sessions_hidden_from_sidebar_by_default, and general expectations for un-imported background candidates). - Once that same cron session is imported into the WebUI's local session store (
/api/session/import_cli, tagging it with the "Cron Jobs" project viaensure_cron_project()), it now correctly appears in/api/sessionscarrying itsproject_id, verified via a temporary reproduction test (removed before submission) that failed pre-fix and passed post-fix. - Client-side (
static/sessions.js), added_isBackgroundSidebarSession()and updated the project-chip filtering logic so cron/background rows are hidden in the default "All" view (matching the "hidden in default/unassigned/unrelated-project views" requirement) but surfaced when their own assigned project chip is selected.
- A raw (not-yet-imported) cron row from state.db still stays correctly hidden by default (matches existing
-
I have thought about edge cases and made sure my fix handles them as well. Yes:
- Unassigned cron sessions (no
project_id) remain unconditionally hidden everywhere (verified via direct unit check of_hide_from_default_sidebar). - Empty (0-message) cron sessions never reach the visible pipeline —
import_cli_sessionrejects empty imports, and the pre-existing 0-message "Untitled" filter and_project_agent_session_rowsempty-tip filter still apply uniformly. - The
pre_compression_snapshothiding behavior of_hide_from_default_sidebar(unrelated to cron) is preserved exactly as before, verified explicitly. - Selecting an unrelated (non-Cron) project chip still correctly excludes cron sessions (project_id mismatch).
- The raw/un-imported CLI candidate list (
deduped_cli) intentionally keeps the old unconditional cron-hide behavior (via_is_intentionally_background_sidebar_session), since project-based visibility only makes sense once a specific session has actually been surfaced into the user's own session store with a realproject_id— this distinction keeps the fix consistent with howensure_cron_project()/import_cli_sessionalready work.
- Unassigned cron sessions (no
-
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. Yes. I ran the full test suite before and after the change and diffed the failure lists — they are identical (82 failures, all pre-existing and solely due to
nodenot being installed in this sandbox, unrelated to Python/JS logic). All cron/project/session-discoverability-related tests (test_gateway_sync.py,test_1079_cron_session_project.py,test_issue1614_project_profile_filtering.py,test_session_discoverability_invariants.py,test_sidebar_first_turn_visibility.py,test_cron_session_title.py) pass.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →