Skip to content

fix(pb-envoy): reduce round trips for ws connection#4603

Draft
MasterPtato wants to merge 1 commit into04-09-fix_envoy-client_fix_handling_actor_event_ackfrom
04-09-fix_pb-envoy_reduce_round_trips_for_ws_connection
Draft

fix(pb-envoy): reduce round trips for ws connection#4603
MasterPtato wants to merge 1 commit into04-09-fix_envoy-client_fix_handling_actor_event_ackfrom
04-09-fix_pb-envoy_reduce_round_trips_for_ws_connection

Conversation

@MasterPtato
Copy link
Copy Markdown
Contributor

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
Contributor Author

@claude
Copy link
Copy Markdown

claude bot commented Apr 10, 2026

The core optimization is solid. Moving the version to the URL query param and having the server immediately push the init packet instead of waiting for a client round trip is a clean improvement.

Critical Bug: is_serverless always false in Conn

In engine/packages/pegboard-envoy/src/conn.rs, Arc::new(Conn) at the end of init_conn hardcodes is_serverless: false (line 326) instead of the computed local variable from tokio::try_join. Two places are affected:

  • ping_task.rs:43: update_lb is always true for serverless (should be false)
  • ws_to_tunnel_task.rs:390: serverless connections incorrectly call expire on ToRivetStopping

Fix: change is_serverless: false to is_serverless in the struct literal.

Units inconsistency: drain_grace_period

The deprecated serverless_drain_grace_period config is in milliseconds (default 10,000 ms = 10 s). The new drain_grace_period field is documented as Seconds but uses the same raw value 10,000. If truly seconds that is ~2.7 hours. The Seconds doc comment is likely wrong and should say Milliseconds.

Default fallback does not read the actual deprecated config value

The comment says Default to deprecated config value but the code hardcodes 10,000 rather than reading config.pegboard.serverless_drain_grace_period. A non-default operator value will be silently ignored.

Missing newline at end of file

engine/artifacts/errors/ws.timed_out.json is missing a trailing newline.

Old error artifact files not removed

WsError::ConnectionClosed and WsError::TimedOutWaitingForInit were removed from errors.rs but ws.connection_closed.json and ws.timed_out_waiting_for_init.json were not deleted.

Unrelated changes in examples/cursors/package.json

Adds @hono/node-server and hono deps and removes trailing newline. Should be a separate PR.

Minor: handle_metadata allows repeated updates

Previously written once at init; now runs on every ToRivetMetadata message. Atomicity is fine. Worth a comment confirming this is intentional.

Summary: The is_serverless: false bug and the drain_grace_period units issue are the two things that need to be fixed before landing.

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