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 I'll implement. First, the server side in
api/models.py: - Assistant
Now annotate rows in both
all_sessions()retrieval paths (index and full-scan): - Assistant
Now the CLI-merge retrieval path in
api/routes.py: - Assistant
Now the client side in
static/sessions.js— add a helper near_isCliSession: - Assistant
Now let me look at the test infrastructure to write proper regression tests:
- Assistant
All new tests pass. Now check for regressions in related existing suites:
- Assistant
No test asserts cron rows must be absent from
/api/sessions. Let me run the full suite in the background to catch any indirect regressions: - Assistant
While the suite runs, let me verify the SSE/session-events surface uses the same path:
- Assistant
Changelog updated. Now wait for the full suite result:
- Assistant
While waiting, let me verify the messaging dedupe doesn't swallow cron rows:
- Assistant
The diff is complete and coherent. Now I'll wait for the full test suite:
- Assistant
Targeted tests all pass. The full suite is still running — I'll summarize the fix now and confirm the suite result when it completes.
Fix summary
Bug: Cron sessions are auto-assigned to the "Cron Jobs" project (#1079), but
_hide_from_default_sidebar()unconditionally stripped every cron row from the/api/sessionspayload — so selecting that project showed "No sessions in this project yet."Changes:
-
api/models.py—_hide_from_default_sidebar()now keeps cron/background rows that are ; empty or unassigned cron rows stay hidden as before. A new helper flags the survivors with , applied in retrieval modes of (the fast path and the full-scan fallback), which also covers .
-
- Assistant
Now update my test to match the corrected contract:
- Assistant
One test may pass pristine but fail with my change — I need the pristine failure list to compare precisely:
- Assistant
While it runs, let me double-check the diff of the test file change and review anything else referencing the old "cron hidden" contract:
- Assistant
No other tests pin the old contract. Waiting on the final full-suite run to confirm the failure set matches the pre-existing baseline — I'll report when it completes.
Interim status: Fix is implemented and locally verified:
api/models.py— cron/background rows that are non-empty and project-assigned survive_hide_from_default_sidebar()and get flaggedproject_scoped_visibilityin bothall_sessions()retrieval modes (index fast path and full-scan fallback).api/routes.py— the/api/sessionsCLI-merge path applies the same predicate and annotation.static/sessions.js—_isProjectScopedSession()+ project filter: excluded from default (All) view; Unassigned keeps its pinned!s.project_idcontract (project-scoped rows always have aproject_id); shown only under their matching project.- Updated
tests/test_gateway_sync.py::test_cron_sessions_hidden_from_sidebar_by_defaultto pin the new server contract; added 11 tests intests/test_cron_project_visibility.py; CHANGELOG entry added.
- Assistant
The comparison was garbage —
/tmp/failed_pristine.txtwasn't sorted. Redo properly: - Assistant
Final full suite: 6362 passed, 82 failed — and the 82 failures are byte-identical to the pristine baseline (pre-existing environment failures, chiefly the missing
nodebinary needed by JS-runtime tests). Zero regressions from this change.Done — summary of the fix
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.