Skip to content

fix(platform): give the model dates instead of epoch numbers - #3037

Merged
Israeltheminer merged 1 commit into
mainfrom
fix/chat-tool-dates
Aug 22, 2026
Merged

Israeltheminer merged 1 commit into
mainfrom
fix/chat-tool-dates

Conversation

@Israeltheminer

@Israeltheminer Israeltheminer commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Chat reported three attachment arrival dates as mid-September when they arrived in mid-August, and rendered the same document as created "2026-05-27" on one turn and "2026-08-21" on another.

Why

Tool results handed the model raw epoch milliseconds — receivedAt: 1787124301288 — and left it to work out a calendar date. It cannot do that reliably. On a live deployment all three attachment dates came back exactly four weeks late.

The stored values were correct and so was the sort order. Only the arithmetic was wrong, which is the kind of work not to hand a language model.

What changed

Every timestamp an agent tool emits is now ISO 8601 UTC, from one helper. That is the format the system prompt already uses for its Current time: line, so the model compares like with like instead of prose against a number.

Six fields across both agent lanes:

  • chat tools — a task's dueDate, a conversation's lastMessageAt, an attachment's receivedAt, a document's createdAt
  • sandbox workspace tools — a task's createdAt and updatedAt, as task_find and task_get answer with them

The helper sits in lib/shared/ rather than beside either lane's tool definitions. Both lanes need it, and the sandbox lane has never imported from lib/chat; a second copy is how two lanes start disagreeing about what a date is.

Risk

A value that is not a usable timestamp is omitted, not rendered. One bad stored number degrades to a missing field rather than a failed turn.

Zero is kept. The epoch is a real instant, so a truthiness check would have silently dropped it. Covered by a test, because that is the obvious way to write this wrong.

Nothing reads these numerically. The six fields reach the model only. No schema declares them, no doc describes them as epoch milliseconds, and the automation engine's task lane builds its own shape rather than sharing this one.

Tests

Four on the helper: the ISO rendering of a real arrival time, agreement with the format the system prompt uses, omission for undefined/NaN/Infinity, and the epoch surviving.

One per lane at the dispatch layer: a chat task's due date and a task_find result both arrive as '2026-08-19T07:25:01.288Z', as strings rather than numbers.

Each behaviour was then deliberately broken in the source, one at a time, to confirm a test catches it. All were caught — returning the raw number, treating zero as missing, accepting a non-finite value, and leaving a field as an epoch in either lane.

Scope

Does not change which fields the tools return, only how a time is written. Does not touch UI date rendering or the REST surface, which format their own.

Found while verifying #3035 on a live deployment: the listing was correct and its dates were not.

Gate: typecheck, oxlint --type-aware, oxfmt, SAST 0 findings, knip, platform tests green.

@Israeltheminer
Israeltheminer force-pushed the fix/chat-tool-dates branch 3 times, most recently from e207d6e to 539bc5c Compare August 22, 2026 11:53
Chat reported three attachment arrival dates as mid-September when they arrived
in mid-August — uniformly four weeks late — and rendered the same document as
created "2026-05-27" on one turn and "2026-08-21" on another. The stored values
were right and the ordering was right. Only the arithmetic was wrong, because
tool results handed over raw epoch milliseconds and left the model to work out
a calendar date.

Every timestamp a chat tool emits is now ISO 8601 UTC, which is also the format
the system prompt already uses for `Current time:` — so a comparison is between
like and like rather than between prose and a number. Four fields: a task's due
date, a conversation's last message, an attachment's arrival, and a document's
creation.

A value that is not a usable timestamp yields an omitted field rather than a
failed turn. Zero is kept, because the epoch is a real instant and not a
missing one.

Found while verifying the attachment listing on a live deployment: the listing
was correct, and its dates were not.
@Israeltheminer
Israeltheminer merged commit a2c4710 into main Aug 22, 2026
59 of 60 checks passed
@Israeltheminer
Israeltheminer deleted the fix/chat-tool-dates branch August 22, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant