You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bot_schedules: rows with no next run are sorted ahead of live tasks, so paused and finished rows come first #3174
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 44b7e940f7554f829a7211d43895b7b1
Branch: dev/5-bot-schedules-dead-rows
Base: b303da8
At: 2026-11-18T16:52:07Z
Bot: FlyBot Dev-5
bot_schedules sorts its rows by the at string alone (core/src/host/schedules.js, the rows.sort((a, b) => a.at.localeCompare(b.at) || a.line.localeCompare(b.line)) call). A paused entry has no instant, and a finished one-shot keeps the instant it was scheduled for — which is in the past — so every row that will not run again is sorted ahead of the rows that will. The list's first rows are exactly the ones a caller does not care about.
Reproduction
Two live entries and two dead ones in one chat (the state behind test/schedules.test.js):
- "Paused brief" (s-paused) — no next run, paused, own chat, session w2
- "Finished one-shot" (s-done) — no next run, inactive, own chat, session w2
- "Live brief" (s-live) — next 2030-01-01T01:00:00.000Z, active, own chat, session w2
not ok 1, # pass 0 / # fail 1. The live task is last.
Expected
Every row that will run again comes before every row that will not; within each group the existing order is kept.
The dead rows stay in the list, still saying no next run and their status word; only their position changes.
core/src/host/schedules.js: the comparator only — a row is live when status === 'active' and it carries an instant; live rows first, then the existing at order, then the existing line tie-break, so ordering inside a group is the one callers see today.
New case in core/test/schedules.test.js naming this issue (no P-654 placeholder left in a test name or comment).
docs/subsystems/core-host.md: one sentence in the bot_schedules paragraph — live rows first, rows with no next run after them.
patches/ds-bot/0001-core-fixes.patch re-emitted by node scripts/ds-bot-patches.mjs generate; check stays clean.
changelog.d/<issue>.fixed.md (fixed, with the issue link).
Tier T2 (core/src/host/**): a reviewer PASS at the exact tip is required before the queue.
Boundary: this is a display order change only — no filtering, no new field, no change to which tasks run or when. An active entry without a stored instant already prints no next run today and falls into the same group; DSH does not produce such an entry.
Dedup
Searched bot_schedules sort rows no next run plus title searches for the row wording: only closed #2767 (2026-11-10, an inactive row printed next ) and #2024 (paused-only list wording) are near this code — both are wording/printing fixes, neither orders the rows. No open issue or PR covers the ordering.
Does not touch policy/gates.jsongateFiles; the frozen gate PRs are not involved.
Activity