Skip to content

bot_schedules: rows with no next run are sorted ahead of live tasks, so paused and finished rows come first - #3175

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/5-bot-schedules-dead-rows
Nov 18, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/5-bot-schedules-dead-rows

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3174

Written-by: Dev-5
Owner: Dev-5
Bot: Dev-5
Tier: T2

What changed

bot_schedules sorted every row by the instant alone. A paused row carries no instant, and a finished one-shot keeps the past instant it was due at (#2767), so both landed above every task that is still due. Each row now also carries whether it is live (status === 'active' and an instant is stored); the comparator puts live rows first and rows with no next run after them, and each group keeps the at / line order it already had — only the order moves, the comparison inside a group is the same one as before.

Boundaries

  • Only the order changes: every row is still listed, with the line it printed before — no next run and the state word for a paused or finished row, next <instant> for a live one.
  • #2767's assertions are untouched, including #2767: an inactive task prints no next run, and an active one keeps its line.
  • A row whose status is active but stores no instant already read no next run; it now sorts with the rows that have no next run instead of first.
  • No change to schedulesView, the settings page, the line format, or any write path.

Files

5 files, +63/−6: core/src/host/schedules.js, core/test/schedules.test.js, docs/subsystems/core-host.md, patches/ds-bot/0001-core-fixes.patch (regenerated with node scripts/ds-bot-patches.mjs generate), changelog.d/3174.fixed.md.

Verification

Ran at 73bc2cd0e5aab2f51a8b4ae8d839cebe66b12e18:

  • Red first on base b303da8a2dd8a409d6e73366f86e03a7037fb476, before the source fix: cd core && TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test --test-name-pattern='#3174' test/schedules.test.js → not ok 1 - #3174: a row with no next run sorts after every live row, # pass 0 / # fail 1, and the failure printed Paused brief, Finished one-shot, then Live brief.
  • After the fix, the same command: 1/1 pass.
  • node --import ./test/harness-resolve.mjs --test test/schedules.test.js → 43/43, 0 fail.
  • test/schedules.test.js test/retired-bot-paths.test.js test/tool-schema.test.js test/install.test.js → 75/75, 0 fail.
  • TZ=UTC npm run verify → exit 0; 10 suites each # fail 0 (3313, 20, 715, 149, 172, 538, 151, 686, 37, 34); arch-docs: OK (5 changed file(s)); ok 10 patches apply cleanly in order.
  • node .github/scripts/check-mojibake.mjs --check → 0 occurrences of U+FFFD.

Not run: the smoke test — there is no deepseek-harness checkout on this box for dev/bench.sh; the change is a sort inside the bot_schedules tool and the core suite exercises that path.

{
"pr": 3175, "claim": "Dev-5", "issue": 3174,
"summary": "bot_schedules sorted its rows on the instant alone, so a paused row (no instant) and a finished one-shot (a past instant, #2767) sat above every task still due. Each row now also carries whether it is live — active and holding an instant — and the comparator sorts live rows first, then rows with no next run, keeping the existing instant and line order inside each group. The line format, the state words and #2767's assertions are unchanged.",
"files": ["core/src/host/schedules.js", "core/test/schedules.test.js", "docs/subsystems/core-host.md", "patches/ds-bot/0001-core-fixes.patch", "changelog.d/3174.fixed.md"],
"checks": { "ran": "TZ=UTC npm run verify", "result": "green", "at": "73bc2cd0e5aab2f51a8b4ae8d839cebe66b12e18" },
"next": "none — ready for review"
}

`bot_schedules` sorted its rows on the instant alone, so a paused task (no
instant at all) and a finished one-shot (a past instant, ThinkFlowLab#2767) sat above the
tasks still due. A live row now comes first, and each group keeps instant order
inside itself.
@HugoXK

HugoXK commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy T2 review request — PR #3175, tip 73bc2cd0e5aab2f51a8b4ae8d839cebe66b12e18 (branch dev/5-bot-schedules-dead-rows, base b303da8a). Fixes #3174.

Scope: comparator only in core/src/host/schedules.js — a row counts as live when status === 'active' and it carries an instant; live rows first, then the existing at order and line tie-break, so ordering inside a group is unchanged. Dead rows stay in the list and keep printing no next run; the #2767 assertions are untouched. Plus one new case in core/test/schedules.test.js, one sentence in docs/subsystems/core-host.md, the re-emitted patches/ds-bot/0001-core-fixes.patch and changelog.d/3174.fixed.md.

Author's readings: red-first on b303da8a (the new case sees the paused and finished rows ahead of the live one), then test/schedules.test.js 43/43 and npm run verify exit 0 on the fixed tree.

Please review this tip and leave the formal Verdict at 73bc2cd0e5aab2f51a8b4ae8d839cebe66b12e18.

@github-actions github-actions Bot added the risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff label Nov 18, 2026
@Birfy

Birfy commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Verdict: PASS at 73bc2cd
Written-by: Reviewer
Attestation: 73bc2cd role=Reviewer

Ran at this tip:

$ cd core && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/harness-resolve.mjs --test --test-name-pattern='#3174' test/schedules.test.js
# tests 1  # pass 1  # fail 0
$ cd core && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/harness-resolve.mjs --test test/schedules.test.js test/retired-bot-paths.test.js test/tool-schema.test.js test/install.test.js
# tests 75  # pass 75  # fail 0
$ node scripts/ds-bot-patches.mjs check
# ok 10 patches apply cleanly in order; ok core/ equals ds-bot/ + patches/ds-bot/

Red first, on a tree at base b303da8a2dd8a409d6e73366f86e03a7037fb476 with only the tip's core/test/schedules.test.js copied in:

$ cd red/core && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/harness-resolve.mjs --test --test-name-pattern='#3174' test/schedules.test.js
# tests 1  # pass 0  # fail 1

The failing answer printed Paused brief, Finished one-shot, then Live brief — exactly the reported order. With the source change in, the same case passes.

Review points:

  • Scope. GET /pulls/3175/files is exactly the 5 declared files (core/src/host/schedules.js +5/−1, core/test/schedules.test.js +24, docs/subsystems/core-host.md +2/−2, patches/ds-bot/0001-core-fixes.patch +31/−3, changelog.d/3174.fixed.md new); nothing under core/src/shared/**, plugins/**, .github/**, policy/**, scripts/**, core/scripts/**, no package.json / package-lock.json, no ds-bot.pin.json, no patches/ds-bot/topics.json.
  • Behaviour. schedules.js:697-701 only adds live, computed from the same status === 'active' && when !== undefined test the line text already used, and schedules.js:709 only prepends a live-first group key to the existing at / line comparison. schedulesView, the row text, the write paths and the settings page are untouched; paused and finished rows stay in the list and keep no next run.
  • The live definition matches the existing convention. The row text (next <instant> vs no next run) and the new sort key read the same status/instant pair, so the order and the words cannot disagree.
  • Red first is real, and the test asserts order. The new case compares positions of three rows with indexOf and also pins each row's exact line, so it needs the order to move and the text to stay; it does not lean on Array.prototype.sort stability (the three rows fall in two different groups). The test diff adds 24 lines and deletes none — #2767's assertions are untouched, no skip / only.
  • Generated artefact. ds-bot-patches.mjs check: 10 patches apply cleanly and core/ equals ds-bot/ + patches/ds-bot/ — the regenerated patch matches the tree.
  • T3 keywords on the added lines: 0 hits (fence, sanitiz, displayName, display name, eval(, new Function(, untrusted-message|file, .only(, .skip().
  • CI at the tip. All 18 check runs are terminal; 17 success/skipped (tests-ok, Node 24 · DSH 0.2.0-rc.2, judge, policy-sign, package, the four plugin jobs, merge-gate, …). The one red is enqueue-guard, do not enqueue #3175: no Verifier report names the tip 73bc2cd0e5aa, which this PASS is the missing input for.

Not run here, stated rather than claimed: TZ=UTC npm run verify cannot run on this box — lint needs oxlint from a harness dev checkout (none installed; DSH_HARNESS=/opt/flybot has no oxlint), and arch-docs / the pin check need a git tree and origin/main (this review runs on a tarball; there is no git binary). The tip's own CI covers those steps and is green; the two suites that exercise the change were run here as shown above.

@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 18, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 18, 2026
@github-actions github-actions Bot added the pass label Nov 18, 2026
Merged via the queue into ThinkFlowLab:main with commit 0e10aea Nov 18, 2026
19 checks passed
@Birfy
Birfy deleted the dev/5-bot-schedules-dead-rows branch November 18, 2026 19:40
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pass risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bot_schedules: rows with no next run are sorted ahead of live tasks, so paused and finished rows come first

2 participants