Skip to content

chore: add option for server timeout and set default to 5m - #90

Merged
moshloop merged 2 commits into
mainfrom
timeout-5m
Aug 6, 2026
Merged

chore: add option for server timeout and set default to 5m#90
moshloop merged 2 commits into
mainfrom
timeout-5m

Conversation

@yashmehrotra

@yashmehrotra yashmehrotra commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added configurable render timeouts for JSON, multipart, gzip, and streaming requests.
    • Requests can specify a positive timeout value; invalid values return a clear error.
    • Increased the default render timeout to 300 seconds.
    • Updated API documentation with the new timeout options.
  • Bug Fixes

    • Timeout errors now report the effective timeout duration.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yashmehrotra, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 39 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c1db5f0-55da-4381-b393-b3553d15fade

📥 Commits

Reviewing files that changed from the base of the PR and between afe2aad and b4c8a49.

📒 Files selected for processing (6)
  • cli/src/server/config.test.ts
  • cli/src/server/config.ts
  • cli/src/server/request.test.ts
  • cli/src/server/request.ts
  • cli/src/server/routes.ts
  • openapi.yaml

Walkthrough

Changes

Render timeout control

Layer / File(s) Summary
Timeout configuration and defaults
cli/src/server/config.ts, cli/src/cli.ts, cli/src/server/config.test.ts, chart/values.yaml, README.md
The default render timeout is 300,000 ms. CLI and environment values use validated integer parsing. Tests cover defaults, precedence, and invalid values.
Request timeout contract and parsing
cli/src/server/request.ts, cli/src/server/request.test.ts, openapi.yaml
JSON, multipart, and gzip requests accept optional timeout values. Invalid or nonpositive values return errors. Valid values become integer timeoutMs values.
Route timeout application
cli/src/server/routes.ts
Standard and streaming routes use request-specific timeouts when provided. Timeout errors include the effective duration.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant RequestParsers
  participant handleRender
  participant Renderer
  Client->>RequestParsers: Send render request with optional timeout
  RequestParsers->>RequestParsers: Validate and normalize timeoutMs
  RequestParsers->>handleRender: Pass parsed render request
  handleRender->>Renderer: Render with timeoutMs or config.renderTimeout
  Renderer-->>Client: Return render result or timeout error
Loading

Possibly related PRs

  • flanksource/facet#64: Both changes update CLI server numeric-option parsing and shared configuration validation.

Suggested reviewers: moshloop

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the added server timeout option and the new five-minute default.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch timeout-5m
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch timeout-5m

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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 `@cli/src/server/config.ts`:
- Around line 56-59: Update cli/src/server/config.ts lines 56-59 in intOption
and line 73 so timeout values accept only integer numbers within 1..2147483647,
rejecting fractional, boolean/coerced, zero, negative, and oversized values
while preserving fallback behavior; update cli/src/server/request.ts lines 90-96
to enforce the same bound for request timeouts. Extend coverage in
cli/src/server/config.test.ts lines 53-73 and cli/src/server/request.test.ts
lines 50-55 for these invalid values. Add maximum: 2147483647 to both timeout
OpenAPI schemas in openapi.yaml lines 104-109 and 283-288.

In `@cli/src/server/routes.ts`:
- Around line 89-90: Update the timeout handling around timeoutPromise and
Promise.race so the setTimeout handle is retained and cleared in a finally block
after the race settles, regardless of whether renderPromise succeeds, fails, or
times out. Keep the existing timeout error behavior unchanged.
- Around line 87-90: Update handleRender and handleRenderStream in
cli/src/server/routes.ts (anchor lines 87-90 and sibling lines 137-141) to
create and pass an abort signal through doRender and doRenderStreamed, aborting
it when the per-request timeout fires. Propagate cancellation through SSR
rendering, PDF worker work, S3 uploads, and cache writes so timed-out requests
cannot continue or persist late results.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 376b1ee3-8986-4c82-b697-5813d202caa0

📥 Commits

Reviewing files that changed from the base of the PR and between d17f28f and afe2aad.

📒 Files selected for processing (9)
  • README.md
  • chart/values.yaml
  • cli/src/cli.ts
  • cli/src/server/config.test.ts
  • cli/src/server/config.ts
  • cli/src/server/request.test.ts
  • cli/src/server/request.ts
  • cli/src/server/routes.ts
  • openapi.yaml

Comment thread cli/src/server/config.ts Outdated
Comment thread cli/src/server/routes.ts Outdated
Comment thread cli/src/server/routes.ts Outdated
@yashmehrotra
yashmehrotra requested a review from moshloop August 6, 2026 10:50
@moshloop
moshloop merged commit 1510de6 into main Aug 6, 2026
17 checks passed
@moshloop
moshloop deleted the timeout-5m branch August 6, 2026 10:58
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