Skip to content

feat: add options to disable abort/timeout mechanisms#638

Open
djwhitt wants to merge 3 commits intodevelopfrom
feat/disable-abort-timeout-options
Open

feat: add options to disable abort/timeout mechanisms#638
djwhitt wants to merge 3 commits intodevelopfrom
feat/disable-abort-timeout-options

Conversation

@djwhitt
Copy link
Copy Markdown
Collaborator

@djwhitt djwhitt commented Mar 11, 2026

Summary

  • Add TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS to disable connection timeout aborts for trusted gateway requests
  • Add TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS to disable stream stall aborts for trusted gateway responses
  • Add DISABLE_REQUEST_ABORT_SIGNAL to disable client-disconnect abort propagation globally
  • Fix unguarded clearTimeout on the success path in GatewaysDataSource

Test plan

  • Verify config tests pass: yarn test:file test/config.test.ts
  • Verify gateway data source tests pass: yarn test:file src/data/gateways-data-source.test.ts
  • Verify abort signal middleware tests pass: yarn test:file src/middleware/abort-signal.test.ts
  • Verify default behavior unchanged (all three flags default to false)
  • Test with each flag set to true to confirm timeouts/aborts are properly disabled

🤖 Generated with Claude Code

djwhitt and others added 2 commits March 11, 2026 14:23
Post-release cleanup for release 72:
- Updated version to 73-pre
- Reset core docker image tags to latest (observer/AO remain pinned)
- Updated AR_IO_NODE_RELEASE to 73-pre
- Added [Unreleased] section to CHANGELOG.md

Development branch ready for release 73 features and fixes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…eways

Add three new environment variables for selectively disabling abort and
timeout behaviors:
- TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS: disable connection timeout aborts
- TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS: disable stream stall aborts
- DISABLE_REQUEST_ABORT_SIGNAL: disable client-disconnect abort propagation

Also fix unguarded clearTimeout on the success path in GatewaysDataSource
for consistency with the error path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a0c696d2-66cc-4ad4-90fa-d5e00ce81e4e

📥 Commits

Reviewing files that changed from the base of the PR and between fdbb235 and 46d86b1.

📒 Files selected for processing (3)
  • src/config.ts
  • src/middleware/abort-signal.ts
  • test/config.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/config.ts

📝 Walkthrough

Walkthrough

Adds three config flags to disable AbortController-based timeouts and abort propagation; wires them into config, docs, docker-compose, middleware, GatewaysDataSource, tests, and bumps the release to 73-pre.

Changes

Cohort / File(s) Summary
Configuration, Docs & Release
CHANGELOG.md, docker-compose.yaml, docs/envs.md, src/config.ts, src/version.ts
New Unreleased changelog section; three new env-backed boolean config exports (TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS, TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS, DISABLE_REQUEST_ABORT_SIGNAL); docs updated; docker-compose default images and AR_IO_NODE_RELEASE bumped to 73-pre; version constant set to 73-pre.
Middleware & App wiring
src/middleware/abort-signal.ts, src/app.ts
createAbortSignalMiddleware now accepts { disableRequestAbortSignal?: boolean } and conditionally skips attaching the client-disconnect abort listener; app.ts passes DISABLE_REQUEST_ABORT_SIGNAL into the middleware.
Gateways Data Source
src/data/gateways-data-source.ts
GatewaysDataSource adds disableRequestTimeoutAborts and disableStreamStallAborts fields and constructor options (defaulting to config flags); connection and stall timeout timers are conditionally created/attached and telemetry attributes updated.
Tests
src/data/gateways-data-source.test.ts, src/middleware/abort-signal.test.ts, test/config.test.ts
Added tests covering parsing of the three new env flags, abort-signal middleware behavior (including disabled case), and GatewaysDataSource behavior when request-timeout and stream-stall aborts are disabled.

Sequence Diagram(s)

mermaid
sequenceDiagram
rect rgba(200,220,255,0.5)
participant Client
end
rect rgba(200,255,200,0.5)
participant App
end
rect rgba(255,230,200,0.5)
participant GatewaysDataSource
end
rect rgba(255,200,200,0.5)
participant Gateway
end

Client->>App: HTTP request
App->>App: createAbortSignalMiddleware(disableRequestAbortSignal?)
App->>GatewaysDataSource: fetch via GatewaysDataSource(disableRequestTimeoutAborts?, disableStreamStallAborts?)
GatewaysDataSource->>Gateway: proxied request (may attach AbortSignal)
Gateway-->>GatewaysDataSource: stream response
alt stream stall/timeout enabled
    GatewaysDataSource->>GatewaysDataSource: start stall/connection timers
else disabled via flags
    GatewaysDataSource-->>GatewaysDataSource: timers not created
end
Gateway-->>App: stream data
Note right of App: if client disconnects and middleware enabled\nabort the request signal
App-->>Client: response complete

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • dtfiedler
  • hlolli
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding configuration options to disable abort and timeout mechanisms across the codebase.
Description check ✅ Passed The description is directly related to the changeset, providing a clear summary of the three new configuration flags, the bug fix, and a comprehensive test plan.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/disable-abort-timeout-options

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/config.ts (1)

201-212: Document the new abort toggles inline.

These are new operator-facing config exports, but unlike the surrounding settings they were added without inline docs. Please add short TSDoc/comments describing what each flag disables and its default behavior.

Suggested doc shape
+/**
+ * Disable connection-timeout aborts for trusted gateway requests.
+ * Defaults to false.
+ */
 export const TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS =
   env.varOrDefault(
     'TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS',
     'false',
   ) === 'true';

+/**
+ * Disable stream-stall aborts for trusted gateway responses.
+ * Defaults to false.
+ */
 export const TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS =
   env.varOrDefault('TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS', 'false') ===
   'true';

+/**
+ * Disable request abort propagation from client disconnects.
+ * Defaults to false.
+ */
 export const DISABLE_REQUEST_ABORT_SIGNAL =
   env.varOrDefault('DISABLE_REQUEST_ABORT_SIGNAL', 'false') === 'true';

As per coding guidelines: **/*.{ts,tsx,js}: Add or improve TSDoc comments when modifying code to enhance documentation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/config.ts` around lines 201 - 212, Add short TSDoc comments above the
three new exports to document operator-facing behavior: for
TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS explain it disables aborting
trusted-gateway proxied requests when the upstream request timeout elapses and
that it defaults to false (do not abort); for
TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS explain it disables aborting
trusted-gateway proxied streaming responses on perceived stream stalls and that
it defaults to false (do not abort); for DISABLE_REQUEST_ABORT_SIGNAL explain it
disables attaching/propagating an AbortSignal to outgoing requests (useful for
legacy clients) and that it defaults to false. Include the constant names
(TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS,
TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS, DISABLE_REQUEST_ABORT_SIGNAL) in
the comments and keep each TSDoc to one or two short sentences.
src/middleware/abort-signal.ts (1)

9-24: Consider documenting the new parameter in TSDoc.

The existing TSDoc describes the middleware's purpose but doesn't mention the disableRequestAbortSignal option. Adding a @param entry would improve discoverability.

📝 Suggested TSDoc enhancement
 /**
  * Middleware that attaches an AbortSignal to each request.
  * The signal is aborted when the client disconnects before the response completes.
  *
  * Usage in handlers:
  *   const signal = req.signal;
  *   await someAsyncOperation({ signal });
  *
  * This allows downstream operations to be cancelled when clients disconnect,
  * preventing wasted work on requests that will never be delivered.
+ *
+ * `@param` options.disableRequestAbortSignal - If true, the signal is not aborted
+ *   when the client disconnects. Defaults to false.
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/middleware/abort-signal.ts` around lines 9 - 24, Add a `@param` entry to
the TSDoc for createAbortSignalMiddleware documenting the
disableRequestAbortSignal option: describe its type (boolean), default (false),
and effect (when true the middleware will not attach/abort request signals).
Reference the option name disableRequestAbortSignal and briefly show intended
behavior (disable Request AbortSignal attachment/abortion) so callers can
discover and understand the flag.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/config.test.ts`:
- Around line 96-137: Add assertions that the default values for
TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS and DISABLE_REQUEST_ABORT_SIGNAL
are false in the same "Trusted gateway timeout config" suite: when their env
vars are deleted (or unset) import ../src/config.js with the cache-busting query
and assert config.TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS === false and
config.DISABLE_REQUEST_ABORT_SIGNAL === false; keep these new checks alongside
the existing TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS default test so
regressions to a truthy default are caught.

---

Nitpick comments:
In `@src/config.ts`:
- Around line 201-212: Add short TSDoc comments above the three new exports to
document operator-facing behavior: for
TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS explain it disables aborting
trusted-gateway proxied requests when the upstream request timeout elapses and
that it defaults to false (do not abort); for
TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS explain it disables aborting
trusted-gateway proxied streaming responses on perceived stream stalls and that
it defaults to false (do not abort); for DISABLE_REQUEST_ABORT_SIGNAL explain it
disables attaching/propagating an AbortSignal to outgoing requests (useful for
legacy clients) and that it defaults to false. Include the constant names
(TRUSTED_GATEWAYS_DISABLE_REQUEST_TIMEOUT_ABORTS,
TRUSTED_GATEWAYS_DISABLE_STREAM_STALL_ABORTS, DISABLE_REQUEST_ABORT_SIGNAL) in
the comments and keep each TSDoc to one or two short sentences.

In `@src/middleware/abort-signal.ts`:
- Around line 9-24: Add a `@param` entry to the TSDoc for
createAbortSignalMiddleware documenting the disableRequestAbortSignal option:
describe its type (boolean), default (false), and effect (when true the
middleware will not attach/abort request signals). Reference the option name
disableRequestAbortSignal and briefly show intended behavior (disable Request
AbortSignal attachment/abortion) so callers can discover and understand the
flag.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6c316065-7b46-41dd-83a1-1c5b802c1645

📥 Commits

Reviewing files that changed from the base of the PR and between 611b5cf and fdbb235.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • docker-compose.yaml
  • docs/envs.md
  • src/app.ts
  • src/config.ts
  • src/data/gateways-data-source.test.ts
  • src/data/gateways-data-source.ts
  • src/middleware/abort-signal.test.ts
  • src/middleware/abort-signal.ts
  • src/version.ts
  • test/config.test.ts

Comment thread test/config.test.ts
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.78%. Comparing base (611b5cf) to head (46d86b1).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #638      +/-   ##
===========================================
+ Coverage    76.73%   76.78%   +0.05%     
===========================================
  Files          105      106       +1     
  Lines        36346    36426      +80     
  Branches      2654     2663       +9     
===========================================
+ Hits         27891    27971      +80     
  Misses        8421     8421              
  Partials        34       34              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…nfig

Address CodeRabbit PR feedback: add missing default-value test assertions
for stream stall and request abort signal configs, add TSDoc comments on
new config exports, and add @param documentation for middleware option.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant