Problem
Currently the heartbeat dispatches a Publisher worker for any issue in To Publish queue, regardless of publish_date. The Publisher then reads the date, sees it's in the future, and calls work_finish(blocked) — wasting tokens.
What's needed
In the heartbeat dispatch logic (before a Publisher worker is spawned), read publish_date from the issue body and skip dispatch if the date is in the future.
Implementation
In lib/services/heartbeat/tick-runner.ts (or the queue dispatch loop), add a pre-check for publisher role:
// Before dispatching Publisher:
if (role === "publisher") {
const publishDate = extractPublishDate(issue.description);
if (publishDate && publishDate > new Date()) {
// Skip — not yet time to publish
continue;
}
}
extractPublishDate() should parse publish_date: YYYY-MM-DD from issue body (same pattern as analytics-trigger's extractPublishedAt).
Bonus: GitHub Projects field
If GitHub Projects v2 is set up (issue #4), also check the Publish Date field value on the project item — more reliable than parsing issue body text.
Notes
- Must not affect other roles — only skip Publisher dispatch
- If
publish_date is absent or invalid: dispatch normally (ASAP)
- Log skipped dispatches to audit log with reason "scheduled: publish_date not yet reached"
Problem
Currently the heartbeat dispatches a Publisher worker for any issue in
To Publishqueue, regardless ofpublish_date. The Publisher then reads the date, sees it's in the future, and callswork_finish(blocked)— wasting tokens.What's needed
In the heartbeat dispatch logic (before a Publisher worker is spawned), read
publish_datefrom the issue body and skip dispatch if the date is in the future.Implementation
In
lib/services/heartbeat/tick-runner.ts(or the queue dispatch loop), add a pre-check for publisher role:extractPublishDate()should parsepublish_date: YYYY-MM-DDfrom issue body (same pattern as analytics-trigger's extractPublishedAt).Bonus: GitHub Projects field
If GitHub Projects v2 is set up (issue #4), also check the
Publish Datefield value on the project item — more reliable than parsing issue body text.Notes
publish_dateis absent or invalid: dispatch normally (ASAP)