Skip to content

feat: actor query in gateway#4553

Merged
NathanFlurry merged 1 commit intomainfrom
gateway-query-resolution-v2
Apr 5, 2026
Merged

feat: actor query in gateway#4553
NathanFlurry merged 1 commit intomainfrom
gateway-query-resolution-v2

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

@railway-app
Copy link
Copy Markdown

railway-app bot commented Apr 4, 2026

🚅 Deployed to the rivet-pr-4553 environment in rivet-frontend

Service Status Web Updated (UTC)
kitchen-sink ❌ Build Failed (View Logs) Web Apr 5, 2026 at 11:43 am
frontend-cloud ❌ Build Failed (View Logs) Web Apr 5, 2026 at 8:58 am
frontend-inspector ❌ Build Failed (View Logs) Web Apr 5, 2026 at 8:58 am
website 😴 Sleeping (View Logs) Web Apr 5, 2026 at 6:33 am
ladle ❌ Build Failed (View Logs) Web Apr 5, 2026 at 6:22 am
mcp-hub ✅ Success (View Logs) Web Apr 4, 2026 at 6:22 pm

@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 4, 2026 18:22 Destroyed
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from 9df8c59 to f789515 Compare April 4, 2026 19:36
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 4, 2026 19:36 Destroyed
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from f789515 to 53cca42 Compare April 4, 2026 23:45
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 4, 2026 23:45 Destroyed
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 4, 2026

More templates

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@4553

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@4553

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@4553

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@4553

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@4553

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@4553

@rivetkit/sqlite-vfs

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sqlite-vfs@4553

@rivetkit/traces

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/traces@4553

@rivetkit/workflow-engine

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/workflow-engine@4553

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@4553

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@4553

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@4553

commit: 53cca42

@NathanFlurry NathanFlurry changed the base branch from main to graphite-base/4553 April 4, 2026 23:50
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from 53cca42 to 25b2a62 Compare April 4, 2026 23:51
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4553 to 04-04-feat_add_sleep_and_reschedule_endpoints_for_actors April 4, 2026 23:51
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 4, 2026 23:51 Destroyed
@claude
Copy link
Copy Markdown

claude bot commented Apr 4, 2026

PR Review: feat: actor query in gateway

This is a well-structured PR adding query-based actor routing to the gateway, allowing clients to route by actor name+namespace+key using matrix parameters rather than requiring a pre-resolved actor ID. The architecture is clean, the error handling is thorough, and test coverage is good.

Issues

Base64 encoding inconsistency (potential bug)

In actor_path.rs, the input parameter is decoded from URL-safe no-padding base64 (URL_SAFE_NO_PAD). In resolve_actor_query.rs, the raw bytes are re-encoded using standard base64 (STANDARD, with +/slash and padding) before being passed to the actor creation op. If downstream consumers expect URL-safe base64 consistent with what the client sent, inputs whose bytes map to + or slash would be encoded differently. Verify what encoding pegboard::ops::actor::create::Input.input expects and whether the TypeScript mirror in gateway.ts uses the same encoding.

Potential panic in production path -- actor_path.rs, build_actor_query_from_gateway_params

The validation above guards the runner_name expect() call, but expect panics in a hot request path. Prefer ok_or_else(|| errors::QueryMissingRunnerName.build())? to make the invariant explicit in the type system rather than relying on a panic that would crash the process if the guard is refactored away.

Security: CBOR parsing without size bounds -- actor_path.rs, validate_cbor

There is no maximum byte-length check before CBOR deserialization. A deeply-nested CBOR structure could exhaust stack space via recursive deserialization. The decoded bytes should be bounded (e.g., reject if len > 64 KB) before calling this function.

Unused error artifact -- guard.query_ambiguous_runner_configs.json

The artifact is defined but resolve_query_target_dc_label never raises it. It silently picks the first matching DC via .into_iter().next(). Either raise this error when more than one DC matches, or remove the artifact. A defined error that is never emitted will confuse anyone reading the error catalog.

Error mapping gap -- guard.query_no_runner_configs.json

This artifact exists, but the no-runner-config case raises pegboard::errors::Actor::NoRunnerConfigConfigured instead. Verify whether this maps to query_no_runner_configs on the wire. If not, clients receive an opaque pegboard error rather than the documented guard error.

Style: missing newline at end of artifact JSON files

All 13 new files under engine/artifacts/errors/ are missing the final newline.

Positive observations

  • Comprehensive error types with matching artifact JSON files and formatted messages.
  • Race condition handling: the optimistic create-then-retry pattern in resolve_query_get_or_create_actor_id correctly handles concurrent getOrCreate races.
  • Test coverage in parse_actor_path.rs is thorough -- encoding edge cases, empty keys, unknown params, disallowed params. The cross-reference comment to the TypeScript equivalent is good practice.
  • Clean refactor: moving ActorPathInfo into routing/actor_path.rs and splitting pegboard_gateway.rs into a module directory is a clear improvement.
  • Cache key design: excluding the token from the query path cache key is correct and clearly documented.

Questions

  1. Token priority: Token can come from either the token= matrix param or the x-rivet-token / sec-websocket-protocol header, with path taking precedence. Is this intentional and consistent with direct-path behavior?

  2. Remote DC authorization: In resolve_query_get_or_create_actor_id, when the target DC differs from the local one, the call goes through request_remote_datacenter. Does this path carry the gateway token through for auth, or does it bypass the token check?

  3. Key serialization stability: serialize_actor_key uses serde_json::to_string, producing e.g. ["a","b"]. Is this format documented and stable? A serialization change would silently make all existing keyed actors unreachable.

The base64 encoding inconsistency is the only potentially breaking item. The expect panic and CBOR size bound are the main items to address before merge.

@NathanFlurry NathanFlurry changed the title feat: US-001 - ManagerDriver accepts ActorQuery targets for gateway operations feat: actor query in gateway Apr 5, 2026
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from 25b2a62 to 99c27ce Compare April 5, 2026 04:50
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 5, 2026 04:50 Destroyed
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from 99c27ce to 41c6f98 Compare April 5, 2026 05:35
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 5, 2026 05:35 Destroyed
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from 41c6f98 to 34f50a8 Compare April 5, 2026 06:21
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 5, 2026 06:21 Destroyed
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from 34f50a8 to b554e3d Compare April 5, 2026 07:55
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 5, 2026 07:55 Destroyed
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from b554e3d to 5ed38c2 Compare April 5, 2026 08:56
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 5, 2026 08:56 Destroyed
@NathanFlurry NathanFlurry marked this pull request as ready for review April 5, 2026 10:59
Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 5, 2026

Merge activity

  • Apr 5, 11:11 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 5, 11:43 AM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 5, 11:43 AM UTC: @NathanFlurry merged this pull request with Graphite.

@NathanFlurry NathanFlurry changed the base branch from 04-04-feat_add_sleep_and_reschedule_endpoints_for_actors to graphite-base/4553 April 5, 2026 11:40
@NathanFlurry NathanFlurry changed the base branch from graphite-base/4553 to main April 5, 2026 11:41
@NathanFlurry NathanFlurry force-pushed the gateway-query-resolution-v2 branch from 5ed38c2 to 148d3f6 Compare April 5, 2026 11:42
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4553 April 5, 2026 11:42 Destroyed
@NathanFlurry NathanFlurry merged commit 3f6e4dc into main Apr 5, 2026
10 of 19 checks passed
@NathanFlurry NathanFlurry deleted the gateway-query-resolution-v2 branch April 5, 2026 11:43
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