Skip to content
TheChatArchiveThe Chat Archive
fable-5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Cron sessions do not appear under their assigned project Non-empty cron or background…

  1. 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.

  2. Assistant

    Let me look at how tests interact with the sessions API and check the conftest for the test server setup.

  3. Assistant

    Now I have a full picture. Let me implement the fix. First, the server-side helper in api/models.py:

  4. Assistant

    Now update both retrieval modes (index path and full-scan fallback) in all_sessions:

  5. Assistant

    Now the CLI-merge retrieval mode in api/routes.py:

  6. Assistant

    Now the client side. Let me check the area around NO_PROJECT_FILTER definition:

  7. Assistant

    Let me check existing tests that pin the cron-hidden behavior, so I don't break them:

  8. Assistant

    Now let me write a regression test file:

  9. Assistant

    Now run the new tests:

  10. Assistant

    Passes alone — check whether this cross-test interaction predates my change:

  11. 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:

  12. Assistant

    28 failures are pre-existing; my change introduces 2 new ones. Let me examine them:

  13. Assistant

    Now thread project_id through all_sessions:

  14. Assistant

    Now rework the client. First restore the pinned withMessages expressions and move the background filter upstream:

  15. Assistant

    Remove the duplicated comment block:

  16. Assistant

    Now wire the fetch to send project_id when a project is selected:

  17. Assistant

    Let me add an end-to-end test against the live test server, reusing the gateway_sync helpers:

  18. Assistant

    Now append the end-to-end test to my test file:

  19. Assistant

    Sanity check: confirm the new tests fail without the fix (test file is untracked, so a stash keeps it):

  20. Assistant

    All 6 fail without the fix, pass with it. Now re-run the broad sweep to confirm no new regressions:

  21. Assistant

    Two possibly-new failures. Let me inspect:

  22. Assistant

    The all_sessions interface legitimately grew, so I'll update the two pinned tests. First look at them:

  23. Assistant

    Now update the fake in the #2157 test to match the grown all_sessions signature:

  24. Assistant

    Check for other all_sessions fakes/monkeypatches that might break:

  25. Assistant

    One stale comment to fix on _isBackgroundSession:

  26. Assistant

    While the suite runs, let me save a memory about this repo's test-harness quirks:

  27. Assistant

    The full suite is still running. I'll summarize once it completes — the monitor will notify.

  28. 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_sidebar dropped every cron row from the /api/sessions payload 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).
    • api/routes.py — GET /api/sessions parses ?project_id=, threads it to all_sessions(), and applies the same predicate to the show_cli_sessions state.db merge path (deduped_cli), so all three retrieval modes behave consistently.
    • static/sessions.js
      • renderSessionList() appends project_id= to the /api/sessions query when a project chip is active (built on top of the existing all_profiles variant).
      • Project-chip click renders instantly from cache, then refetches to pull in the project's cron rows.
      • New _isBackgroundSession() guard in renderSessionListFromCache() 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): both all_sessions modes, 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... (fake all_sessions signature), test_issue1855... (diag wiring literal).

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.