Skip to content

feat(platform)!: createdAt ends in Z, and useChat knows when Base44 has a prompt or answer - #354

Merged
amitbardos merged 3 commits into
mainfrom
amitb/platform-chat-accepted
Oct 26, 2026
Merged

amitbardos merged 3 commits into
mainfrom
amitb/platform-chat-accepted

Conversation

@amitbardos

@amitbardos amitbardos commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Answers two review questions on @base44/platform/react 0.5.0.

1. createdAt formats

ChatItem.createdAt passed Base44's created_date through with no zone, so new Date() read it as local time. A pending prompt's createdAt ended in Z. Outside UTC the two disagreed, and Base44's times showed off by the offset.

toItems now gives every timestamp its Z, in the pending prompt's shape (2026-10-25T11:00:00.000Z). Only ISO date-times are touched, because new Date() guesses at other shapes ("1Z" parses as 2001). The docs caveat is gone.

Breaking: anyone who appended a Z themselves now gets …ZZ. Noted in the changelog.

2. "Resolve once Base44 accepts the request"

Send chat message and Submit tool-call input stay open until the turn ends, and nothing answers "accepted" before that. A backend that awaited them got a rejection whenever a server timeout hit mid-turn. The hook then dropped the prompt, reopened the question and showed an error for a turn that was still running.

The hook now reads acceptance from the live updates:

  • Prompt: Base44's copy of it arrives.
  • Answer, or the auto-decline of an unknown kind: the tool call stops waiting.

send() and the answer actions resolve at that point. A backend failure after it doesn't set error, drop the prompt or reopen the question. A refusal before it behaves as before.

ChatBackend's docs now say to forward the request and return its result. They also say that a Next.js server action shouldn't wait out the turn, because server actions run one at a time.

Checked live (Tiny Sunny dev workspace)

Check Result
Refusals 404 in 0.3s, 401 in 0.4s
created_date 2026-10-25T13:42:11.682000, no zone
Caller aborts Send chat message after 8s The turn still finished: a disconnect doesn't cancel it
Send while the AI is busy 200 {"queued": true} in 0.4s, so a queued prompt needs no special handling

Tests

  • New unit tests for the timestamp helper and for a late failure after Base44's copy arrived, after an answer was taken, and after a decline was taken.
  • tsc, type tests, eslint and all 160 unit tests pass.

🤖 Generated with Claude Code

…as a prompt or answer

ChatItem.createdAt passed Base44's created_date through with no zone, so
new Date() read it as local time, while a pending prompt's ended in Z. The
hook now gives every timestamp its Z, in the pending prompt's shape.

Send chat message and Submit tool-call input stay open until the turn ends,
and there is no "accepted" response to resolve on. The hook now reads it from
the live updates instead: Base44's copy of the prompt, the prompt in its
queue (event or snapshot), or the question no longer waiting. send() and the
answer actions resolve then, and a backend failure after that, such as a
server timeout mid-turn, no longer sets error, drops the prompt or reopens
the question. ChatBackend's docs now say to forward the request and return
its result.

BREAKING CHANGE: ChatItem.createdAt always ends in Z. Remove any Z you added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available! (@base44/platform)


Install this PR's preview build with npm:

npm i @base44-preview/platform@0.5.0-pr.354.eeb83f0

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/platform:

npm i "@base44/platform@npm:@base44-preview/platform@0.5.0-pr.354.eeb83f0"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/platform": "npm:@base44-preview/platform@0.5.0-pr.354.eeb83f0"
  }
}

Preview published to npm registry — try new features instantly!

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.57-pr.354.eeb83f0

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/sdk:

npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.57-pr.354.eeb83f0"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.57-pr.354.eeb83f0"
  }
}

Preview published to npm registry — try new features instantly!

amitbardos and others added 2 commits October 25, 2026 14:25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checked live on a Tiny Sunny app: a send while the AI is busy answers
200 {"queued": true} in under a second, so a queued prompt's send never
waits long enough to fail late. Also checked: refusals (404, 401) come back
in under half a second, and a caller that disconnects doesn't cancel the
turn. ChatBackend's docs now note that a Next.js server action shouldn't
wait out the turn, since server actions run one at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amitbardos
amitbardos requested a review from ozsay October 25, 2026 14:53
@amitbardos
amitbardos merged commit 403a890 into main Oct 26, 2026
8 checks passed
wixysam added a commit that referenced this pull request Oct 29, 2026
…xamples for sendMessage and submitToolCallInput (#356)

#354 changed how a send or an answer ends, so the intros that said a failure
sets `error` now say when it does. The Backend calls closing paragraph is split
into the route-handler case and the server-action case, without colons.

sendMessage() gets a route handler and a server action that waits a few seconds
for a refusal, modeled on the starter's waitForRefusal. submitToolCallInput()
gets a route handler that forwards extra_user_input, which Submit tool-call
input now documents.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

2 participants