Skip to content

Release 1.0.0-alpha.11: no resend after a timeout or of any write; SERVER_TIMEOUT; explain says what is known - #67

Merged
jallers merged 6 commits into
masterfrom
claude/no-resend-after-timeout
Nov 26, 2026
Merged

jallers merged 6 commits into
masterfrom
claude/no-resend-after-timeout

Conversation

@jallers

@jallers jallers commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Breaking

1. A request that timed out is no longer sent again, a read included.

Since alpha.5 an idempotent request (a GET, a query.v1 read) that timed out was sent once more, about 150 ms later. A timeout ends the client's wait; it does not stop the work on the server. So a slow query was run twice, possibly while the first was still running, and the caller waited two timeouts.

  • Not resent, whoever gave up: the client (TIMEOUT), the server (a 408), a gateway in front of it (a 504), or the server's own SQL execution timeout (SERVER_TIMEOUT, below).
  • Resent once, as before: a read after a lost connection (NETWORK_ERROR), a 429, any other 5xx.
  • client.pages and client.all stop at the first timeout.
  • The built-in transport and a custom one behave alike: both use one predicate, resendable() in src/core/retry.ts.

2. A guarded write is no longer sent again automatically.

Since alpha.5 a guarded batch with no creates (client.sendGuarded, batch.run with guard: true) was marked idempotent and resent once after a lost connection or a 5xx. A second send harms no data: it matches nothing, because the first advanced the Moment. But "matched nothing" is how a conflict is reported. So when the first send had landed and only its answer was lost, the caller was told that someone else changed the asset and nothing was applied, about its own change.

  • No write is ever marked idempotent now. A guarded write with no answer rejects like any write; explain gives the unconfirmed-change sentence with outcome: "unknown".
  • What to do instead: read the asset again. You see your change or you do not, and the guard makes sending again safe.
  • The unauthorized hook follows: retryable is false for a guarded write, so "retry" does not resend it after a 401 and "retry-write" does. retryable: false does not mean it cannot be resumed after signing in again; the hook's doc comment says so.

3. SendOptions.idempotent is removed from /wire's assetApi.send. Nothing can be marked safe to resend any more. A caller deletes the option; one that guarded a batch itself and relied on the resend catches the error, reads the assets again and decides.

Changed

client.explain no longer tells a person to try again after a write that got no answer. For every transient error it said "Agility could not be reached, or is busy. The same request may work in a moment." For a write whose fate is unknown, that is how a duplicate gets made.

What happened Sentence retrySafe outcome
A write (guarded or not) with no answer, a timeout or a 5xx Agility did not confirm the change. It may or may not have been made: check before trying again. false "unknown"
A read the server itself gave up on (SERVER_TIMEOUT) Agility gave up on this request: it takes more work than the server allows. Sending it again will cost the same. Ask for less: a smaller page, fewer selected paths, a tighter filter. false null
A read that timed out otherwise Agility did not answer in time. The request may still be running: wait before trying again. true null
A read that never got through, or a 5xx Agility could not be reached, or is busy. The same request may work in a moment. true null
A 429 Agility is busy. The same request may work in a moment. true "notApplied" for a write, null for a read
The error does not say what was asked Agility could not be reached, or is busy. null null

What is known about "retry-write" (no behaviour change). The hook's answer that resends a write rests on the consumer's assertion that a refusal means nothing ran. That has now been checked once, by a browser-app consumer, on one product release: an api/asset create sent with no session, and one with an invalid session, were each answered 401 with an empty body before any command ran, and nothing was created. Not checked: a session that was valid and has expired, a 403, rest-1. The doc comment, spec 000 and example 09 say this in place of "cannot be verified".

Added

  • SERVER_TIMEOUT: a server-side SQL execution timeout, as an instance answers it. The server gives up on a request that takes longer than it allows and answers an error document, not a 408: exceptions holding a SqlException whose message begins "Execution Timeout Expired" and a Win32Exception "The wait operation timed out". It used to surface as a bare "Server Error", and a read was sent again. apiErrorFromResponse now recognises it by the exception's type and the start of its message, whatever the status: code: "SERVER_TIMEOUT", kind: "transient", the exception's words as the message, the whole document in details. Never resent; a 400 carrying it is not re-coded as a rejected query.
  • transportConformance checks that a refused response carries the code apiErrorFromResponse gives it, with that document as one case, and gains a 401 with an empty body (kind auth from the status alone). Only refused responses are compared; a transport that builds refusals with apiErrorFromResponse passes unchanged.
  • Explanation.retrySafe (boolean | null): may the same request be sent again as it is? Nothing more than that.
  • Explanation.outcome ("unknown" | "notApplied" | null): is it known whether the change was made?
    • "unknown": a write with no confirmation (no answer, a timeout of the client's or the server's, a cancelled wait, a 5xx, an unreadable answer).
    • "notApplied": the server answered a refusal before doing the work (a 4xx or a 429 in answer to a write, a conflict), and each failed command when a batch's failures are explained. For a batch it speaks of that command alone; the others are in the Outcome.
    • null: a read, or an error that does not say what was asked.
  • ApiError.request: { method, path, idempotent }, stamped by the client on every error it lets out, with any transport. Never the body or the headers (a test asserts the keys). An error from a /wire or /services function used on a transport no client wrapped has no stamp.

Things a reviewer should know

  • Why two fields. retrySafe: false covers a write whose fate is unknown and a read that will fail the same way again, which call for opposite actions (look before acting; do not look, ask for less). An earlier commit on this branch told consumers to derive the difference from request.idempotent; that was wrong (a refused write is also not idempotent, and its outcome is known) and is replaced by outcome.
  • retrySafe is false for a read with SERVER_TIMEOUT. Repeating it harms no data, but a consumer that shows a retry button when retrySafe is true would invite running the same costly query again. A judgement call.
  • TIMEOUT and SERVER_TIMEOUT are kind: "transient". The kind says what the failure is; the resend rule is narrower than the kind.
  • SERVER_TIMEOUT was not provoked live: that would mean running a query that costly on a shared instance. Not confirmed, and the changelog says so: the HTTP status it arrives with (so the body decides); whether api/asset reports it in this exceptions shape or in its own Exceptions list of strings (both are recognised); that rest-1 uses the same shape for it.
  • A 5xx in answer to a write is treated like no answer: after the server began work, nobody knows what was applied.
  • Spec 000 §6 states both resend rules and why; the timeoutMs and retries doc comments, the guard's doc comment, the README, example 09 and the changelog agree with it.

Verification

At the head commit (b04afa3):

  • npm run verify: 267 unit tests in 33 files, all passing.
    • Timeouts: a timed-out read is attempted once on a custom transport and on the built-in one, with retries: 3; a 408 and a 504 once; a lost connection and a 502 twice; all stops at the first timeout.
    • Guarded writes: sendGuarded and batch.run with guard: true, each over a transport that fails the send with a 502 or a lost connection, retries: 3: sent once, marked idempotent: false, explained with outcome: "unknown".
    • SERVER_TIMEOUT: the error document exactly as an instance sent it, through client.query (query.v1), client.queryPage (api/asset), client.deleted (rest-1) and a write, at statuses 500 and 400, each sent once. Controls that get no code: another SqlException, another server error, the same words inside a 400's message, a plain-text body.
    • outcome: each case above, including 400, 401, 403, 404, 413, 429 and 408 in answer to a write, a conflict, a read, an unstamped error and one failed command.
  • The full integration tier against the API-testing instance: 80 passed, 3 skipped by design (12 files passed, 1 skipped). It includes the guard test that the second rule rests on: the same guarded batch sent twice applies once, and the second send lists no modified or operated asset and reports no failure, which is exactly how a conflict reads.

After merge

Tag v1.0.0-alpha.11 to stage the publish.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm

…from a failed read; 1.0.0-alpha.11

A timeout ends the client's wait and does not stop the work on the
server, so a request that timed out (TIMEOUT, a 408, a 504) is no longer
sent again, a read included: a slow query was being run twice. A lost
connection, a 429 and other 5xx are resent once as before.

Every ApiError the client lets out says what was asked (method, path,
idempotent). explain uses it: a write that got no answer is 'the change
may or may not have been made', never 'try again', and Explanation gains
retrySafe.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…esent

A server-side SQL execution timeout, as an instance answers it, arrives
as an error document (a SqlException beginning "Execution Timeout
Expired", a Win32Exception "The wait operation timed out"), not as a
408. It surfaced as a bare "Server Error" and a read was sent again.

apiErrorFromResponse now codes it SERVER_TIMEOUT by the exception's type
and the start of its message, whatever the status; the resend rule
leaves it alone; explain says to ask for less, with retrySafe false; a
400 carrying it is not re-coded as a rejected query; the conformance
suite checks a refusal's code. Unit-tested with the document as sent,
through query.v1, api/asset and rest-1. Not provoked live.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
@jallers jallers changed the title Release 1.0.0-alpha.11: nothing is resent after a timeout; explain and an unanswered write Release 1.0.0-alpha.11: nothing is resent after a timeout; SERVER_TIMEOUT; explain and an unanswered write Nov 26, 2026
…outcome is unknown

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
retrySafe false covered a write whose fate is unknown and a read that
will fail the same way, which call for opposite actions. The fact is now
a field: unknown (a write with no confirmation), notApplied (the server
refused before doing the work; one failed command of a batch), null (a
read, or nothing known of the request). Replaces the previous commit's
advice to derive it from request.idempotent, which was wrong for a write
the server refused.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
A second send of a guarded batch harms no data (it matches nothing), but
"matched nothing" is how a conflict reads. When the first send landed
and only its answer was lost, the resend told the caller that someone
else changed the asset and nothing was applied, about its own change.

No write is marked idempotent now. A guarded write with no confirmation
rejects like any write and is explained as an unconfirmed change with
outcome "unknown"; the caller reads the asset again and decides.
SendOptions.idempotent is removed from assetApi.send. Proved live: the
second send lists no asset and reports no failure.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
@jallers jallers changed the title Release 1.0.0-alpha.11: nothing is resent after a timeout; SERVER_TIMEOUT; explain and an unanswered write Release 1.0.0-alpha.11: no resend after a timeout or of any write; SERVER_TIMEOUT; explain says what is known Nov 26, 2026
… the unauthorized hook

The premise of retry-write has been checked once (a missing and an
invalid session on api/asset: a 401 before any command ran); the doc
comment, spec 000, example 09 and the changelog say that and its limits.
The removal of SendOptions.idempotent is its own Breaking entry. The
conformance suite gains a 401 with an empty body; batch.run with a guard
is tested to send once when its answer is lost.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
@jallers
jallers merged commit 8baf62a into master Nov 26, 2026
4 checks passed
@jallers
jallers deleted the claude/no-resend-after-timeout branch November 26, 2026 18:17
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