Abort stalled GraphQL invocations after a configurable timeout#1420
Open
morluto wants to merge 1 commit into
Open
Abort stalled GraphQL invocations after a configurable timeout#1420morluto wants to merge 1 commit into
morluto wants to merge 1 commit into
Conversation
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.
Fixes #1414
Summary
invokeOptions.timeoutMs.GraphqlInvocationErrorwithreason: "invocation_timeout"to direct SDK callers andgraphql_request_timeoutto tool callers.executorpatch changeset.Why
The GraphQL transport previously waited without an application-level deadline. An upstream could send successful response headers and an incomplete JSON body, leaving the tool call pending until an external limit ended it.
GraphQL responses are decoded before the tool returns, so the timeout covers the full body read. This differs from the OpenAPI streaming path, where a timeout ends after response headers so a valid stream can remain open.
Regression proof
On
origin/main, the new test reaches its independent one-second guard because the invocation is still pending, with an observed elapsed time of about 1,015 ms.With this change and a 100 ms test timeout, the tool returns
graphql_request_timeoutaround the configured deadline and the test observes the TCP socket closing.Compatibility
invokeOptionsis optional, so existing plugin construction and direct invocation call sites remain source-compatible. Calls that complete within 110 seconds retain their current behavior. Calls that exceed the deadline now fail explicitly instead of waiting for an external limit.Validation
bun run test -- src/sdk/invocation-timeout.test.ts src/sdk/plugin.test.ts: 2 files and 34 tests passed.bun run typecheck: passed with pre-existing Effect language-service suggestions.git diff --checkpassed.origin/mainreturned no actionable findings.Review order
packages/plugins/graphql/src/sdk/invoke.ts, timeout boundary and cancellation behavior.packages/plugins/graphql/src/sdk/plugin.tsanderrors.ts, option plumbing and failure mapping.packages/plugins/graphql/src/sdk/invocation-timeout.test.ts, real-socket regression proof.