Repository navigation
Release 1.0.0-alpha.10: timeoutMs is the client's rule with any Transport - #65
Merged
Merged
Conversation
Each attempt has timeoutMs whatever the transport. Above a custom transport the client hands over a signal that fires at the deadline and stops waiting then, whether or not the transport lets go; what an abandoned request answers later is discarded. TIMEOUT is transient, so an idempotent request is sent once more and a write is not. 0 is no client timeout. The built-in transport uses the same deadline, and a body that stalls after the headers is now a TIMEOUT. The fake expands a type family in the search request it records. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
The example leaves timing to the client: its own timeout mapping goes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
The deadline cannot tell a person from a slow network: a custom transport that waits for a sign-in inside request turns the client's timeout off. The built-in transport's hook runs outside the deadline, with a test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
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.
Head
87acf90, withmastermerged in.Breaking, for a consumer with its own
TransporttimeoutMsnow binds every transport. It was a timer inside the built-in fetch transport only. With a custom transport the client timed nothing, and a transport's own timeout was resent only if it happened to report itself as anApiErrorcodedTIMEOUT, which nothing said it should.Now, per attempt, whatever the transport:
signalthat fires aftertimeoutMs(default 60000) and when the caller aborts.TIMEOUT, whether or not the transport lets go. The client does not wait for the abort to land: the transport's promise is raced against the timer.TIMEOUTis transient, so an idempotent request is sent once more, with a deadline of its own. A plain write is not: a timeout says the client stopped waiting, never that the server did not act.timeoutMs: 0means no timeout of the client's.ABORTED, notTIMEOUT, and is likewise not waited on.What a transport owes is unchanged and already checked by the conformance suite: honour
signal. No new check.What changes for a consumer: requests through its transport now time out at 60 seconds by default where they waited on its HTTP client alone. An HTTP client with no timeout configured (an axios instance left at its default) now gets one. The signal a transport receives is the attempt's own, not the object the caller passed.
A transport that waits for a person inside
requestmust settimeoutMs: 0. The deadline cannot tell a slow network from someone signing in again. An HTTP client that shows a sign-in prompt and replays the request when the user is back would see a slow sign-in end asTIMEOUT, and the replay would carry a signal that has already fired. The built-in transport is not affected: itsonUnauthorizedhook runs outside the deadline (tested). The doc comment ontimeoutMs, the changelog's migration line, the README and spec 000 §6 say so.Changed
deadline()insrc/core/retry.ts):timeoutMs: 0means no timeout there too, and a response whose headers arrive in time but whose body stalls is aTIMEOUT(it surfaced as the runtime's own abort error).examples/11-axios-transport.tsleaves timing to the client: its own mapping of axios's timeout toTIMEOUTis gone.Fixed
FakeAgilityClient: a search naming a family by its abstract type (types: ["Workitem"]) is expanded to the concrete types in the request the fake records, as against a server. Found by the smoke test of the published alpha.9. Rows andfake.searchedwere already right.Things a reviewer should know
withRetry(withTimeout(transport)), so each attempt has its own deadline and a resend is not cut short by the first attempt's timer.Retry-After), using the shared deadline; the client does not wrap it a second time.timeoutMs: 0, because its transport waits for a person insiderequest(the case above); that is where the documented caveat came from.timeoutMs: 0is the answer today.d7f8fcdis red in CI (a type error in a new test, pushed without waiting for the check);87acf90, the next commit, fixes it.ClientConfig.timeoutMs's doc comment says what happens to the abandoned request.Verification
npm run verifyon87acf90: 258 unit tests in 33 files, all passing. On a custom transport with real short timers: times out and is resent once when idempotent (the second attempt gets a fresh signal); a plain write times out and is not resent; a transport that ignores the signal still yieldsTIMEOUTat the deadline, and its late answer and late error are discarded with no unhandled rejection;timeoutMs: 0waits and hands over the caller's own signal (with a control that times out); a transport's own shorter timeout wins; the caller's abort isABORTEDbefore sending, in flight, and against a transport that ignores it. On the built-in transport: the same deadline, a stalled body,timeoutMs: 0, and a re-authentication hook three times longer than the timeout.1a0673b(its client runs over a custom transport, so every live request passed through the new rule): 79 passed, 3 skipped by design; fixtures deleted. After mergingmaster, the examples suite ran again: 12 passed. The commits since change the example, documentation and one unit test.After merge
Tag
v1.0.0-alpha.10to stage the publish.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm