Skip to content

feat(rivetkit): support gateway bypass client overrides#4928

Closed
NathanFlurry wants to merge 1 commit intosqlite-soak/depot-fault-harness-serializationfrom
mock-agentic-loop/gateway-bypass-client-overrides
Closed

feat(rivetkit): support gateway bypass client overrides#4928
NathanFlurry wants to merge 1 commit intosqlite-soak/depot-fault-harness-serializationfrom
mock-agentic-loop/gateway-bypass-client-overrides

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Member Author

NathanFlurry commented May 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

PR Review: feat(rivetkit): support gateway bypass client overrides

Overview

This PR adds layered gateway bypass configuration support, allowing bypassConnectable to be set at three levels of granularity: client-wide defaults, per-action, and per-connect. The pattern uses resolveActorGatewayOptions(defaults, overrides) to merge the layers at call time.


Issues

Medium

Redundant double-nesting in test file (tests/driver/gateway-bypass-client.test.ts): describeDriverMatrix("Gateway Bypass Client", ...) already wraps everything in a suite named "Gateway Bypass Client", but the inner describe("Gateway Bypass Client", ...) repeats the same label. The inner describe is unnecessary.

Fragile actor creation ordering in tests: Several tests create two handles for the same actor key -- one without trackRequest (the "view") and one with { trackRequest: true } (the "tracking" handle). The test implicitly relies on enabledTracking.action(...) being the first call that actually creates the actor so trackRequest: true takes effect. If the framework ever eagerly creates on getOrCreate, or test execution order shifts, the request info will not be tracked. Cleaner to create the actor with a single handle that includes trackRequest: true from the start, then read via a second get-only handle.

Minor

isActorHttpRequestPath computes stripped before guard check (engine-client/mod.ts): No correctness problem since short-circuit evaluation protects it, but computing stripped = path.slice("/request".length) unconditionally before the path.startsWith("/request") guard is slightly misleading. Moving the slice inside or using an early-return makes intent clearer.

Unresolved options passed to buildGatewayUrl (actor-handle.ts, getGatewayUrl method): getGatewayUrl() passes this.#gatewayOptions (typed as ActorGatewayOptions with optional fields) directly to the driver. Every other call site resolves options first via resolveActorGatewayOptions. This path should do the same to ensure consistent defaults.

Inconsistent resolved vs. unresolved field types: ActorConnRaw.#gatewayOptions is typed ResolvedActorGatewayOptions (resolved at construction), while ActorHandleRaw.#gatewayOptions is typed ActorGatewayOptions (resolved per call). The asymmetry is workable but worth a brief comment explaining that handles resolve late to support per-call overrides while connections resolve once at construction.

canUseDirectBypassPath allowlist has no documentation: The allowlist approach is the right security posture (fail closed for unknown paths), but there is no comment explaining why it exists or what it protects against. Future contributors adding new actor routes may not know to update it.


What Looks Good

  • The three-level override pattern (client -> handle -> call) is clean and consistent. resolveActorGatewayOptions(defaults, overrides) is a simple, correct merge strategy.
  • Using an allowlist in canUseDirectBypassPath rather than a blocklist is the right default.
  • #resolveGatewayTargetForBypass in ActorConnRaw correctly short-circuits to already-known IDs before doing a round-trip resolution.
  • Test coverage spans all four call paths: action with bypass on/off, action overriding client default, connect with bypass, connect overriding client default.

@NathanFlurry NathanFlurry force-pushed the sqlite-soak/depot-fault-harness-serialization branch from 29f3416 to d83cee1 Compare May 4, 2026 04:13
@NathanFlurry NathanFlurry force-pushed the mock-agentic-loop/gateway-bypass-client-overrides branch from 059a77d to cb7241f Compare May 4, 2026 04:13
@NathanFlurry NathanFlurry marked this pull request as ready for review May 4, 2026 08:05
@NathanFlurry
Copy link
Copy Markdown
Member Author

Landed in main via stack-merge fast-forward push. Commits are in main; closing to match.

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