Repository navigation
fix(platform): give the model dates instead of epoch numbers - #3037
Merged
Merged
Conversation
Israeltheminer
force-pushed
the
fix/chat-tool-dates
branch
3 times, most recently
from
August 22, 2026 11:53
e207d6e to
539bc5c
Compare
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
force-pushed
the
fix/chat-tool-dates
branch
from
August 22, 2026 12:05
539bc5c to
242367b
Compare
This was referenced Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
dueDate, a conversation'slastMessageAt, an attachment'sreceivedAt, a document'screatedAtcreatedAtandupdatedAt, astask_findandtask_getanswer with themThe helper sits in
lib/shared/rather than beside either lane's tool definitions. Both lanes need it, and the sandbox lane has never imported fromlib/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_findresult 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.