Skip to content

fix(gateway): confirm { accepted: true } send acks via the transcript clientNonce - #153

Open
scort1213 wants to merge 1 commit into
ScriptedAlchemy:mainfrom
scort1213:fix/send-accepted-nonce
Open

scort1213 wants to merge 1 commit into
ScriptedAlchemy:mainfrom
scort1213:fix/send-accepted-nonce

Conversation

@scort1213

Copy link
Copy Markdown

Problem

With the current Grok Bot desktop app (0.70.2, macOS), the gateway answers sendPrompt with { "accepted": true } and no messageId. Since #43 only a string messageId counts as a receipt, so every delivered gbot send reports delivery: "unknown" — which tells callers to check the thread before resending, for every single message.

Fix

The never-a-silent-accept contract stays: a bare flag is still not a receipt. When the ack arrives without a messageId, read the transcript tail once (limit 20) and look for the entry that carries this request's clientNonce (already sent by sendPrompt). That entry's id becomes the messageId and delivery becomes accepted. A miss or any read failure keeps unknown. Responses without accepted: true (e.g. { ok: true }) are unchanged and trigger no extra read.

Evidence

  • Live, macOS + Grok Bot 0.70.2: before, result was { "accepted": true } and delivery was unknown; the user entry with the same clientNonce was already in the transcript tail about 1 s after the call returned. After: { "delivery": "accepted", "messageId": "t14u" }.
  • Tests: three new cases in test/gateway-send.test.js (nonce found → accepted; nonce missing → unknown; tail read fails → unknown).
  • npm run test:unit: 445/445 on this branch. npm run typecheck: clean. On a clean main, "CLI concurrent starts share one owner, durable request replay sends once, worker restart retains receipt" failed once locally and passed on rerun — unrelated to this change.
  • Changeset added; artifact/ rebuilt.

🤖 Generated with Claude Code

…pt clientNonce

Current Grok Bot gateways (desktop app 0.70.x) answer sendPrompt with
`{ accepted: true }` and no messageId, so every delivered message was
reported as `delivery: "unknown"`.

A bare flag is still not treated as a receipt. When the ack arrives
without a messageId, read the transcript tail once and use the id of the
entry that carries this request's clientNonce. Any miss or read failure
keeps the send `unknown`, so the never-a-silent-accept contract holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 92bdd62

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
grok-bot-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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