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
Let me look at how tests interact with the sessions API and check the conftest for the test server setup.
- Assistant
Now I have a full picture. Let me implement the fix. First, the server-side helper in
api/models.py: - Assistant
Now update both retrieval modes (index path and full-scan fallback) in
all_sessions: - Assistant
Now the CLI-merge retrieval mode in
api/routes.py: - Assistant
Now the client side. Let me check the area around
NO_PROJECT_FILTERdefinition: - Assistant
Let me check existing tests that pin the cron-hidden behavior, so I don't break them:
- Assistant
Now let me write a regression test file:
- Assistant
Now run the new tests:
- Assistant
Passes alone — check whether this cross-test interaction predates my change:
- Assistant
The flake is pre-existing (reproduces on the clean tree — index rebuild thread race), not caused by my change. Now run the cron/project server-backed tests:
- Assistant
28 failures are pre-existing; my change introduces 2 new ones. Let me examine them:
- Assistant
Now thread
project_idthroughall_sessions: - Assistant
Now rework the client. First restore the pinned
withMessagesexpressions and move the background filter upstream: - Assistant
Remove the duplicated comment block:
- Assistant
Now wire the fetch to send
project_idwhen a project is selected: - Assistant
Let me add an end-to-end test against the live test server, reusing the gateway_sync helpers:
- Assistant
Now append the end-to-end test to my test file:
- Assistant
Sanity check: confirm the new tests fail without the fix (test file is untracked, so a stash keeps it):
- Assistant
All 6 fail without the fix, pass with it. Now re-run the broad sweep to confirm no new regressions:
- Assistant
Two possibly-new failures. Let me inspect:
- Assistant
The
all_sessionsinterface legitimately grew, so I'll update the two pinned tests. First look at them: - Assistant
Now update the fake in the #2157 test to match the grown
all_sessionssignature: - Assistant
Check for other
all_sessionsfakes/monkeypatches that might break: - Assistant
One stale comment to fix on
_isBackgroundSession: - Assistant
While the suite runs, let me save a memory about this repo's test-harness quirks:
- Assistant
The full suite is still running. I'll summarize once it completes — the monitor will notify.
- Assistant
Full suite is clean: the 82 remaining failures are byte-identical to the clean-tree baseline (pre-existing
node-missing JS-eval tests), and all new/updated tests pass.Summary
Bug: Cron/background sessions assigned to a project never appeared when that project was selected —
_hide_from_default_sidebardropped every cron row from the/api/sessionspayload unconditionally, so the auto-created "Cron Jobs" project (#1079) always showed empty.Fix — the reveal is request-scoped, keeping the default payload contract (existing tests pin that cron rows must not appear in default retrievals):
api/models.py- New
_background_session_visible_in_project(session, project_id): exempts a hidden cron/background row only when it is non-empty, project-assigned, and that exact project is the selected one. all_sessions(diag=None, project_id=None): applies the exemption identically in both retrieval modes — the index-backed path and the full-scan fallback (api/models.py:2438).
- New
api/routes.py—GET /api/sessionsparses?project_id=, threads it toall_sessions(), and applies the same predicate to theshow_cli_sessionsstate.db merge path (deduped_cli), so all three retrieval modes behave consistently.static/sessions.jsrenderSessionList()appendsproject_id=to the/api/sessionsquery when a project chip is active (built on top of the existingall_profilesvariant).- Project-chip click renders instantly from cache, then refetches to pull in the project's cron rows.
- New
_isBackgroundSession()guard inrenderSessionListFromCache()re-hides stale cached cron rows in the default ("All"), Unassigned, and unrelated-project views.
Tests:
- New
tests/test_cron_project_view_visibility.py(6 tests): bothall_sessionsmodes, the shared predicate (empty/unassigned/unrelated/default all stay hidden), CLI-merge consistency, client wiring, and an end-to-end HTTP test against the live test server (hidden by default → revealed via?project_id=<Cron Jobs>→ hidden for unrelated project). All 6 fail on the unfixed tree. - Updated three tests that pinned the old literal call/fetch shapes with intent preserved:
test_issue1611...(fetch query string),test_issue2157...(fakeall_sessionssignature),test_issue1855...(diag wiring literal).
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 →
- fable-5Compare side by side →