Files
loki/scripts
CatoandClaude Opus 5 451ac5ded7 fix(dispatch): a deadline four months gone is not a near-term commitment (#800)
Every dispatch this fleet sends opens with the operator's goals and
deadlines, under the instruction "align your priorities" — and on
2026-09-20 the two it listed were:

  The operator's near-term commitments/deadlines (be mindful of these):
  - Get a $50 signup bonus when you spend $100 within 30 days of getting
    a new Coinbase One Card — due 2026-05-03
  - You can unpause your project from the dashboard within 90 days. After
    this period, the project cannot be restore — due 2026-07-03

Four and a half months and eleven weeks gone, handed to every agent on
every project as something to aim at. Filed as #584 on 2026-09-10 after
the same block reached Heidi; it has shipped in every dispatch since,
including the one that produced this commit.

Two separate defects, and the interesting one is not the label.

listUpcomingCommitments takes everything active due before now+14d with
no floor, which is deliberate and documented — "overdue included, those
are the most urgent" — but it then ordered by due_date ASC and capped at
8. Ascending order over a set that reaches backwards means the OLDEST
rows sort first and take the whole cap, so the least recoverable items
crowd out the ones still worth doing. "Soonest first" and "most urgent
first" read as the same sentence and are opposites here. Distance from
today is what urgent actually means, so that is what the ORDER BY says
now; verified against the live table, where it flips the two rows into
the right order.

The label is the half that changes today's prompt. Overdue rows still
belong in this block — a commitment someone missed is exactly what an
agent should know — they just have to arrive marked as missed:

  - ... — was due 2026-07-03 (OVERDUE)
  - Reduce Monthly Burn (40%) — target 2026-06-30 (PAST, not met)

and the heading no longer calls the list "near-term" while carrying rows
that are not.

isOverdue lands in lib/dates.ts as the one definition, deliberately not
`isPast`: that is instant-granular and would call a 09:00 deadline missed
by lunchtime. It compares PRINTED dates — the same toLocalDateStr the
block renders with — so the word and the date beside it cannot disagree,
which an instant boundary computed in a different timezone from the
formatter can and does.

The same predicate goes into the daily brief, whose entire premise is
handing the model settled answers instead of rows to filter. It asked
"commitments due inside 3 days" and described its own SQL as
`due_date <= now()+3d`, both true of the code and neither true of the
rows: overdue ones were in the answer, unlabelled. Its dateLabel also
printed a UTC day next to a word now decided on the local one, so both
now go through toLocalDateStr.

The format test moves out of the source file into scripts/test/, where
test-unit.ts actually globs it — as an inline `--self-test` nothing ever
ran it. Extended to pin the boundaries, built from local calendar parts
rather than UTC instants (green under UTC, Zurich, Kolkata, New York,
Kiritimati and Midway).

Not touched: getGoalsDueSoon and getEventsDueSoon share the missing
floor, but /today's GoalsDueCard and EventsDueCard render them and are
meant to show overdue items to the human. Their `method` strings now
state that honestly instead of being made to lie less.

verify: 214/214 unit tests, tsc clean, lint 0 errors (2 pre-existing
warnings).

Refs #584

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 08:18:29 -07:00
..
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00