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
I’ll first map the repository and locate session/project filtering code and tests. Then I’ll reproduce the filtering mismatch, implement the narrowest general fix across retrieval modes, and run the relevant test suites.
- Assistant
An issue-specific test file already exists, so I’ll inspect it alongside the session discoverability and retrieval implementations. This should reveal the expected matrix of project, emptiness, cron/background, and retrieval-mode behavior.
- Assistant
The existing #1079 tests cover automatic project assignment but not this visibility regression. The route explicitly applies a default-sidebar cron hide predicate after obtaining CLI sessions, which is suspicious because project filtering may happen separately. I’ll inspect
all_sessions, CLI retrieval, hide predicates, and the/api/sessionsroute in full context. - Assistant
Project selection is client-side, so the API must return assigned cron/background rows even though those rows should remain absent from default/all and unrelated views. That implies either the selected project must be sent to the API or hidden rows need another retrieval path. I’ll inspect current hide semantics and all supported storage modes before deciding where to pass project context.
- Assistant
The model layer deliberately hides cron rows and then restores only “messageful” hidden snapshots via a lineage helper; that restoration likely does not account for explicit project selection and may explain inconsistent index/full-scan/CLI behavior. I’ll inspect that helper and CLI row construction precisely, plus route response completion and existing visibility tests.
- Assistant
The wording “no new interfaces” favors keeping
/api/sessionsunchanged: return eligible assigned hidden rows as metadata, then enforce contextual visibility in the existing client-side project filter. I need identify all background classifications (not just cron) and verify how state-db/CLI rows receive message counts and project IDs, because eligibility must be non-empty and consistent for index, full-scan, and CLI retrieval. - Assistant
In this codebase, “background” is the conceptual category and cron is the persisted subtype intentionally hidden by the sidebar; ad-hoc parallel task sessions are deleted after completion. The fix therefore needs to preserve assigned messageful cron rows in API metadata, bypass generic CLI visibility rules that can reject low-turn cron output, and hide them client-side unless their exact project is selected. I’ll inspect invariant tests and UI source-filter behavior to avoid accidentally requiring users to switch to the CLI tab for the Cron project.
- Assistant
There are two additional traps: project cron rows are classified as CLI and therefore excluded by the default WebUI source tab, and the global CLI cap could discard them before project filtering. I’ll inspect the cap and then implement a shared eligibility predicate used by index/full-scan and route merging, with frontend context filtering that bypasses source tabs only for the explicitly selected project.
- Assistant
The cap function location was found but the previous context range missed it. I’ll read and adjust it so assigned background rows are exempt from the ordinary CLI quota; otherwise older cron sessions could still disappear from their project.
- Assistant
I’ll now make the backend change in three places: define one strict predicate (background identity + assigned project + positive message count), include such rows after ordinary hidden filtering in both
all_sessionsretrieval paths, and use the same predicate during CLI merge/filter/capping. This keeps empty and unassigned rows excluded. - Assistant
I’ll apply the shared predicate and replace both duplicated model filtering sites, then import it into routes and update the CLI gates/cap.
- Assistant
One backend import needs correcting, and the
show_cli_sessions=falsebranch must also preserve eligible project rows. Then I’ll add a frontend classifier and apply the visibility rule before source filtering/counts, while explicitly including a matching assigned background row regardless of WebUI/CLI tab. - Assistant
The code compiles and passes whitespace checks. I’ll run the issue-specific, discoverability, session-index, profile/project, CLI filtering, and frontend static test groups. This should expose compatibility assertions and verify both model retrieval paths.
- Assistant
One guessed test filename does not exist, so no tests ran. I’ll locate the actual CLI visibility tests and rerun the valid set.
- Assistant
All functional tests passed; one source-structure regression assertion expects the original default-filter line. I’ll preserve that line and add eligible project rows in a second deduplicated step in both retrieval paths, retaining behavior and satisfying the established structural invariant.
- Assistant
The relevant suite now passes. I’ll explicitly reproduce the reported matrix against both model retrieval modes using an isolated temporary session directory: assigned/non-empty cron must be returned as transport metadata; assigned/empty and unassigned/non-empty cron must remain excluded. Then I’ll validate the frontend filter matrix with Node if available.
- Assistant
Node is unavailable, but the frontend logic is straightforward and can be checked via source/static tests. I’ll run the isolated backend reproduction now, suppressing index rebuild so the second call definitely exercises full-scan fallback.
- Assistant
Reviewing the requirement’s explicit “cron or background” wording reveals a broader edge case: ad-hoc background sessions currently have no background source marker and do not inherit their parent’s project, despite being described as hidden in the route. I’ll align them with the same policy by marking them
background, inheriting the parent project, and extending the shared/server/client classifier. This remains strict: unassigned and empty background rows stay hidden. - Assistant
The combined edit aborted before writing because the two classifiers are not text-identical. I’ll inspect the exact snippets and patch them individually.
- Assistant
I’ll patch each exact classifier and background creation now.
- Assistant
The broader behavior is implemented. I’ll rerun all relevant tests, including background task tests, then repeat the retrieval-mode matrix for both cron and background sources.
- Assistant
The expanded relevant suite passes. I’ll run the isolated matrix with assigned/non-empty, empty, unassigned, and unrelated ordinary sessions for both source types and both index/full-scan modes.
- Assistant
The explicit reproduction now confirms identical index and full-scan behavior. I’ll run the complete test suite to catch any unrelated assumptions about sidebar payloads or background session creation.
- Assistant
The full suite exposed one relevant contract failure: an existing API integration test correctly treats
/api/sessionsitself as the default view and requires cron rows to be absent, not merely client-hidden. Therefore transporting hidden rows in every response is too broad. I’ll revise the design to make project selection contextual on the existing sessions endpoint: default requests remain unchanged, while the UI includes its selected project ID and the backend admits only matching assigned/non-empty background rows. I’ll also preserve existing static source-filter assertions. - Assistant
I’ll implement contextual retrieval now:
all_sessionsonly admits matching project-background rows when a project ID is supplied; route CLI gates and caps use the same context; the frontend addsproject_idonly for a real selected project and refreshes when project chips change. Default and unassigned requests send no project context. - Assistant
The contextual implementation compiles. I’ll inspect the route block for control-flow correctness, then rerun the formerly failing gateway default-view test, static source-filter test, and relevant suite.
- Assistant
The focused behavior passes, but my automated replacement accidentally nested the first route branch and omitted project context on stale reconciliation; I’ll clean that up. One static compatibility assertion also requires the legacy all-profiles request expression, so I’ll retain it as the non-project branch and use the contextual URL only when a project is selected.
- Assistant
The corrected relevant suite passes, including the existing default API contract. I’ll repeat the reproduction with both contexts: default
all_sessions()must hide every background row, whileall_sessions(project_id='project-a')must include only assigned/non-empty rows matching that project, identically for index and full scan. - Assistant
The context matrix now exactly matches the requirement in both retrieval modes. I’ll review the final diff for naming, comments, duplicated logic, and accidental changes before the final verification.
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 →
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 →