Cron sessions do not appear under their assigned project Non-empty cron or background…
- User
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.
- Assistant
Now let me look at the client-side filtering code in detail:
- Assistant
Now the client side. First add a background-session helper next to
_isCliSession: - Assistant
Now let me write a regression test:
- Assistant
All 11 pass. Now run the related existing suites to check for regressions:
- Assistant
Those 8 failures pre-exist on the clean tree (environment-related, not from my change). Re-run the broader selection:
- Assistant
Now thread the parameter through both retrieval modes of
all_sessions(): - Assistant
Now update the
/api/sessionshandler in routes.py: - Assistant
Now the client: the sessions fetch must carry the active project, and selecting a project chip must trigger a re-fetch. Let me find the fetch:
- Assistant
Now update the chip click handlers to re-fetch when the project scope changes:
- Assistant
Now I need to update my regression test to match the query-param design:
- Assistant
Let me add an endpoint-level integration test for the CLI-bridge mode. First check the gateway test helpers:
- Assistant
The
test_serverfixture is autouse. Add an endpoint-level integration test: - Assistant
Now run the broader test selection to verify no regressions:
- Assistant
No conflicts. Now run the full test suite:
- Assistant
Clean tree has 96 failures vs 85 with my changes — let me diff the failure sets precisely:
- Assistant
Now implement the redesigned server side. First
api/models.py: - Assistant
Now revert the
all_sessionssignature changes: - Assistant
Now update
api/routes.py: - Assistant
Now fix the client fetch to preserve the pinned
api('/api/sessions' + allProfilesQS)expression: - Assistant
Update the regression tests to the final design:
- Assistant
All 105 pass. Run the full suite and diff against the clean-tree baseline:
- Assistant
No new failures — all 82 are a subset of the 96 pre-existing baseline failures (mostly missing
nodein this environment). Let me review the final diff: - Assistant
The diff is complete and coherent. Let me add a CHANGELOG entry per repo convention:
- Assistant
All green — no new failures against the pre-existing baseline. The fix is complete.
Summary
Bug: Cron/background sessions assigned to a project (e.g. the auto-created "Cron Jobs" project) never appeared when that project was selected in the sidebar. The server unconditionally dropped cron rows via
_hide_from_default_sidebar()in every retrieval mode, so the client's project filter — which operates on the fetched payload — could never match them: the project chip always looked empty.Fix (two-stage filtering, keeping cron rows hidden in all default views):
-
api/models.py_hide_from_default_sidebar()(api/models.py:2183) now passes through cron rows that are project-assigned and non-empty so the request layer can scope them; empty or unassigned cron rows are still dropped outright. Bothall_sessions()retrieval modes (session-index path and full-scan fallback) share this predicate, so they stay consistent.- New
hide_background_session_for_project_scope(session, selected_project_id)(api/models.py:2204) — the per-request decision: a cron row is visible only when the selected project matches itsproject_idand it holds real messages; hidden in default, unassigned, empty, and unrelated-project views.
-
api/routes.py/api/sessionsreads an optionalproject_idquery param and applies the scope filter to both retrieval modes: WebUI-store rows (api/routes.py:4436) and the CLI/agent-bridge rows indeduped_cli(api/routes.py:4464). Theall_sessions(diag=diag)call contract is untouched (pinned by existing tests)./api/sessions/searchhas no project scope, so it filters the passed-through cron rows back out (api/routes.py:6996).
-
static/sessions.jsrenderSessionList()appendsproject_id=<active project>to the sessions fetch when a project chip is selected; project-chip clicks trigger a scoped re-fetch after the instant cache render.- New
_isBackgroundSession()helper keeps stale project-scoped cron rows out of the default ("All") view when switching chips before the re-fetch lands; the Unassigned and unrelated-project branches already exclude them viaproject_idchecks.
Tests: new
tests/test_cron_project_sidebar_visibility.py(24 assertions across 21 tests) covering the projection matrix, the scope predicate, index vs full-scan mode agreement, an HTTP integration test through the CLI bridge (hidden by default → visible under the Cron Jobs project → hidden for unrelated projects), and source-contract pins. Full suite: 6372 passed; the 82 failures are all pre-existing on the clean tree (missingnodein this environment) — zero new failures. CHANGELOG updated. -
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
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →