Skip to content

chore(api): RequestTimeout + distinguish between client cancel and request timeout in telemetry#2165

Merged
jakubno merged 12 commits into
mainfrom
cancel-cause
Mar 20, 2026
Merged

chore(api): RequestTimeout + distinguish between client cancel and request timeout in telemetry#2165
jakubno merged 12 commits into
mainfrom
cancel-cause

Conversation

@jakubno

@jakubno jakubno commented Mar 18, 2026

Copy link
Copy Markdown
Member

Enables RequestTimeout with 70s deadline


Note

Medium Risk
Introduces a new per-request context deadline and changes how cancellations are classified in logs/traces/metrics, which can affect long-running endpoints and observability signals if misclassified.

Overview
Enables a 70s per-request RequestTimeout across the API and centralizes the middleware in shared/pkg/middleware using context.WithTimeoutCause so callers can distinguish server-side timeouts from client disconnects. Updates logging, tracing, and metrics to record ErrRequestTimeout vs context.Canceled (including emitting 499 via StatusClientClosedRequest and setting request.timeout/client.canceled attributes) based on the captured cancel cause, and adjusts timeout tests to validate the new cancel-cause behavior.

Written by Cursor Bugbot for commit 44afa40. This will update automatically on new commits. Configure here.

Comment thread packages/orchestrator/internal/server/sandboxes.go Outdated
Comment thread packages/shared/pkg/grpc/timeout.go Outdated
Comment thread packages/orchestrator/internal/server/sandboxes.go Outdated
Comment thread .golangci.yml Outdated
Comment thread .golangci.yml Outdated
Comment thread packages/shared/pkg/grpc/timeout.go Outdated
Comment thread packages/shared/pkg/middleware/logging.go Outdated
@jakubno jakubno changed the title feat: enforce WithTimeoutCause via forbidigo lint + fix all violations chore(api): distinguish between client cancel and request timeout in telemetry Mar 19, 2026
@jakubno jakubno assigned dobrac and unassigned sitole Mar 19, 2026
@jakubno jakubno marked this pull request as ready for review March 19, 2026 15:16

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fdcc1d59ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/shared/pkg/middleware/timeout.go
Comment thread packages/shared/pkg/middleware/timeout.go
Comment thread packages/shared/pkg/middleware/timeout.go
Comment thread packages/shared/pkg/middleware/timeout.go
Comment thread packages/api/main.go

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread packages/shared/pkg/middleware/logging.go
@jakubno jakubno changed the title chore(api): distinguish between client cancel and request timeout in telemetry chore(api): RequestTimeout + distinguish between client cancel and request timeout in telemetry Mar 20, 2026
@jakubno jakubno merged commit bde9fa2 into main Mar 20, 2026
36 checks passed
@jakubno jakubno deleted the cancel-cause branch March 20, 2026 14:23
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.

4 participants