Skip to content

fix(clients): report a request that ran out of time as a timeout - #1418

Merged
Goran Gajic (gorangajic) merged 3 commits into
mainfrom
goran/trpc-client-timeout-config-89e693
Jul 31, 2026
Merged

fix(clients): report a request that ran out of time as a timeout#1418
Goran Gajic (gorangajic) merged 3 commits into
mainfrom
goran/trpc-client-timeout-config-89e693

Conversation

@gorangajic

@gorangajic Goran Gajic (gorangajic) commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Relates to NOVA-1403

Overview of Changes

Every call the CLI makes to the platform shares one fifteen-second deadline, and reaching it was indistinguishable from a dead host — so a request the CLI simply stopped waiting for printed "Check your network connection and QAWOLF_HOST_URL", sending the caller to look in the wrong place. A reached deadline is now its own wire-error kind carrying how long it waited, described as a timeout everywhere WireError is turned into a message, and applied at all three fetch sites (tRPC calls, identity, signed-URL downloads).

A call can also carry its own deadline now: RequestOptions.timeoutMs threads from callPublicApi through the tRPC client to the request. Nothing asks for one yet, so every call keeps today's fifteen seconds; the point is that an endpoint whose work outlasts a database read — starting a container, say — can ask for the time it needs, with the number declared in the domain that knows why. Retry behavior is unchanged: timeouts stay retryable exactly where network errors were, and writes still never retry.

The transport moved into sendWireRequest.ts to stay under the file-length limit, and the timeout tests live in their own *.timeout.test.ts files for the same reason.

Testing

bun run typecheck
bun run lint
bun run format:check
bun run knip
bun run test
bun run build

Checklist

  • Changes follow the code style of this project
  • Self-review completed
  • Tests added/updated (or not applicable)
  • No breaking changes (or described below)

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 704d33c0-9143-408d-95b1-c6425abd2d6e

📥 Commits

Reviewing files that changed from the base of the PR and between 8f9f16a and 18f6ca1.

📒 Files selected for processing (7)
  • src/shell/platform/createPlatformClient.timeout.test.ts
  • src/shell/platform/createTrpcClient.timeout.test.ts
  • src/shell/platform/fetchSignedUrl.test.ts
  • src/shell/platform/fetchSignedUrl.ts
  • src/shell/platform/getIdentity.ts
  • src/shell/platform/sendWireRequest.ts
  • src/shell/platform/slowFetch.testUtils.ts

Walkthrough

The CLI adds timeout detection and duration formatting. sendWireRequest applies deadlines, classifies wire failures, unwraps tRPC responses, and deserializes SuperJSON data. tRPC and public API calls accept per-call timeout options. Timeout failures are retryable and retain their durations across identity, signed URL, bundle, and team-storage flows. Tests cover deadlines, overrides, retries, delayed responses, and messages.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CallPublicApi
  participant TrpcClient
  participant SendWireRequest
  participant Fetch
  CallPublicApi->>TrpcClient: Send request with timeout options
  TrpcClient->>SendWireRequest: Resolve and pass timeoutMs
  SendWireRequest->>Fetch: Abort-controlled fetch
  Fetch-->>SendWireRequest: Response or TimeoutError
  SendWireRequest-->>TrpcClient: Return WireResult
  TrpcClient-->>CallPublicApi: Return API result
Loading

Suggested reviewers: smonn, chajac

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits, uses an allowed type and scope, uses imperative wording, and clearly describes the timeout change.
Description check ✅ Passed The description includes the required overview, testing commands, completed checklist, and issue reference, with clear details about the timeout changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch goran/trpc-client-timeout-config-89e693

Comment @coderabbitai help to get the list of available commands.

Every platform call shared one fifteen-second deadline, and reaching it was
reported as an unreachable host -- so the caller was told to check their network
and QAWOLF_HOST_URL when the truth was that the CLI stopped waiting. A reached
deadline is now its own wire-error kind, named as the wait it was.

A call can also carry its own deadline now, for endpoints whose work outlasts a
database read. Nothing asks for one yet; every call keeps the same default.
@gorangajic
Goran Gajic (gorangajic) force-pushed the goran/trpc-client-timeout-config-89e693 branch from 61f7368 to 5d43046 Compare July 31, 2026 08:02
@gorangajic Goran Gajic (gorangajic) changed the title fix(runner): wait for a runner that takes longer than 15s to start fix(clients): report a request that ran out of time as a timeout Jul 31, 2026
@gorangajic
Goran Gajic (gorangajic) marked this pull request as ready for review July 31, 2026 08:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/shell/platform/getIdentity.ts`:
- Around line 34-39: Separate response-body parsing from the initial fetch in
getIdentity.ts (34-39), fetchSignedUrl.ts (23-25), and sendWireRequest.ts
(43-48). Classify isTimeoutError failures from response.json() or
response.arrayBuffer() as timeout, while preserving parse handling for other
body errors and network classification for writeFile filesystem failures. Add
delayed-body timeout tests covering all three request paths so requestWithRetry
receives timeout errors.

In `@src/shell/platform/sendWireRequest.ts`:
- Around line 43-48: Update the response body parsing catch in sendWireRequest
to check the caught error with isTimeoutError before classifying it. Return kind
"timeout" for deadline errors raised by response.json(), while preserving kind
"parse" for other body-read failures.
- Around line 15-60: Extract the shared fetch, timeout, network, HTTP-status,
and response-body handling from sendWireRequest, getIdentity, and fetchSignedUrl
into a reusable helper, and update all three callers to use it. Ensure
TimeoutError from response body reads is classified as timeout with the
configured timeoutMs, while preserving network, HTTP, and JSON/schema parse
classifications for their respective failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 85210c3d-a00d-48d7-a33f-a73002d1bdee

📥 Commits

Reviewing files that changed from the base of the PR and between 5fda766 and 5d43046.

📒 Files selected for processing (18)
  • .changeset/patient-requests-explain.md
  • AGENTS.md
  • src/core/errors.test.ts
  • src/core/errors.ts
  • src/core/formatSeconds.ts
  • src/core/messages/auth.ts
  • src/shell/platform/callPublicApi.test.ts
  • src/shell/platform/callPublicApi.ts
  • src/shell/platform/createPlatformClient.testUtils.ts
  • src/shell/platform/createPlatformClient.timeout.test.ts
  • src/shell/platform/createTrpcClient.timeout.test.ts
  • src/shell/platform/createTrpcClient.ts
  • src/shell/platform/describeErrors.ts
  • src/shell/platform/fetchSignedUrl.ts
  • src/shell/platform/getIdentity.ts
  • src/shell/platform/requestWithRetry.ts
  • src/shell/platform/sendWireRequest.ts
  • src/shell/platform/slowFetch.testUtils.ts

Comment thread src/shell/platform/getIdentity.ts
Comment thread src/shell/platform/sendWireRequest.ts
Comment thread src/shell/platform/sendWireRequest.ts
Comment thread src/core/errors.ts Outdated
Comment thread src/core/formatSeconds.ts Outdated
Comment thread src/shell/platform/createTrpcClient.ts Outdated
Comment thread src/shell/platform/createTrpcClient.ts Outdated
Comment thread src/shell/platform/sendWireRequest.ts Outdated
Comment thread src/shell/platform/sendWireRequest.ts Outdated
Review feedback: drop comments that restate their code, and name the
type-guard parameters for what they hold.
The deadline outlives the headers, so a response that arrives and then stops
part-way through its body reaches it during the read. That was reported as a
body we could not parse -- or, for a download, as a network fault -- which cost
the caller both the retry and the true reason. A failed write is still local.
@gorangajic
Goran Gajic (gorangajic) merged commit 95b8bed into main Jul 31, 2026
7 checks passed
@gorangajic
Goran Gajic (gorangajic) deleted the goran/trpc-client-timeout-config-89e693 branch July 31, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants