Skip to content

fix: various serverless bug fixes#4313

Merged
NathanFlurry merged 1 commit intomainfrom
02-25-fix_various_serverless_bug_fixes
Feb 27, 2026
Merged

fix: various serverless bug fixes#4313
NathanFlurry merged 1 commit intomainfrom
02-25-fix_various_serverless_bug_fixes

Conversation

@MasterPtato
Copy link
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

@railway-app
Copy link

railway-app bot commented Feb 26, 2026

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

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Feb 27, 2026 at 12:01 am
frontend-inspector ❌ Build Failed (View Logs) Web Feb 26, 2026 at 1:13 am
ladle ❌ Build Failed (View Logs) Web Feb 26, 2026 at 1:13 am
mcp-hub ✅ Success (View Logs) Web Feb 26, 2026 at 1:13 am
frontend-cloud ❌ Build Failed (View Logs) Web Feb 26, 2026 at 1:13 am

Copy link
Contributor Author

MasterPtato commented Feb 26, 2026

@claude
Copy link

claude bot commented Feb 26, 2026

PR Review: fix: various serverless bug fixes

Note: This PR is already merged. This review is provided for documentation and retrospective purposes.

Overall a solid set of targeted bug fixes for the serverless actor lifecycle. The changes are well-scoped and address real correctness issues.


Workflow Determinism Fix (actor/mod.rs)

Critical fix, well-implemented. Moving util::timestamp::now() out of the workflow loop body and into a GetTs activity is the correct approach. Direct calls to now() inside a workflow are non-deterministic and will diverge on replay. Wrapping it in an activity ensures the result is recorded in workflow history and replayed consistently.

The activity is only called when state.alarm_ts.is_some() via ctx.v(3), which is correct — no need to record a timestamp activity when the result isn't used.


Bug Fix: Wrong Runner Workflow Type (serverless/conn.rs)

Real bug fixed. drain_runner was sending runner::Stop (the old MK1 runner workflow signal) when it should have been targeting runner2::Stop. This would have caused serverless runner drains to silently fail on MK2 runners.


Serverless Pool Scale-Down Signal (actor/runtime.rs)

The Bump signal when an actor is destroyed or goes to sleep (without being allocated) is the right mechanism to let the pool scale down. The WorkflowNotFound error is handled gracefully with a warning log instead of a hard failure, which is the correct behavior when a runner config has been deleted.

One concern: the same ~27-line block is duplicated across two match arms (the Destroy path and the Sleep path). This is a good candidate for a helper function to prevent the two paths from drifting in the future.


Database Operation Refactoring (actor/runtime.rs)

The change from manual key packing + tx.get().is_some() + tx.clear() to tx.with_subspace() + tx.exists() + tx.delete() is cleaner and more idiomatic. No concerns.


attempted Field (runner2.rs)

The attempted: usize field is added to AllocatePendingActorsOutput with #[serde(default)] for backward compatibility, but searching the codebase shows it is never read by any caller. If this is scaffolding for future observability or telemetry, a short comment would prevent it from being removed as dead code later.


Runner Pool Loop API Migration (runner_pool.rs)

The migration from ctx.loope() to ctx.lupe().commit_interval(5).with_state() is straightforward. The commit_interval(5) will reduce checkpoint overhead. The signal buffer reduction from 512 to 256 is fine — 256 is still a large batch size.


Load Test Threshold Removal (actor-lifecycle.js)

The removal of http_req_duration thresholds is understandable while active bugs are being addressed. These should be reinstated once the system is stable — otherwise latency regressions won't be caught automatically by the load test.


Load Shedding Defaults (config/runtime.rs)

Shifting the default thresholds from 60%/80% to 70%/90% CPU gives the system more headroom before shedding load. Comments and the JSON schema are updated in sync. No concerns.


Summary

Area Assessment
GetTs activity (workflow determinism) Critical fix, correct
runner2::Stop bug fix Real bug fixed
Serverless Bump signal on sleep/destroy Correct; bump logic should be extracted to avoid duplication
DB exists/delete refactor Clean improvement
attempted field Never read by callers; add a comment or use it
lupe loop migration Straightforward
Load test thresholds Should be re-added once stable

@MasterPtato MasterPtato marked this pull request as ready for review February 26, 2026 01:41
@MasterPtato MasterPtato force-pushed the 02-25-fix_various_serverless_bug_fixes branch from 460c180 to 1f8ab8e Compare February 26, 2026 02:14
@MasterPtato MasterPtato force-pushed the 02-20-fix_guard_runner_enforce_http_body_size_and_ws_msg_size branch from e89cab8 to a7065e4 Compare February 26, 2026 02:14
@MasterPtato MasterPtato force-pushed the 02-25-fix_various_serverless_bug_fixes branch from 1f8ab8e to ea391b1 Compare February 26, 2026 19:42
@MasterPtato MasterPtato force-pushed the 02-20-fix_guard_runner_enforce_http_body_size_and_ws_msg_size branch from a7065e4 to 6df70f8 Compare February 26, 2026 19:42
@MasterPtato MasterPtato force-pushed the 02-25-fix_various_serverless_bug_fixes branch from ea391b1 to 4aa5dca Compare February 27, 2026 00:12
@MasterPtato MasterPtato force-pushed the 02-20-fix_guard_runner_enforce_http_body_size_and_ws_msg_size branch from 6df70f8 to 350c871 Compare February 27, 2026 00:12
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 27, 2026

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/sqlite-vfs

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

@rivetkit/traces

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

@rivetkit/workflow-engine

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

@rivetkit/virtual-websocket

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 4aa5dca

Base automatically changed from 02-20-fix_guard_runner_enforce_http_body_size_and_ws_msg_size to main February 27, 2026 00:30
@NathanFlurry NathanFlurry force-pushed the 02-25-fix_various_serverless_bug_fixes branch from 4aa5dca to 0a28359 Compare February 27, 2026 00:30
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4313 February 27, 2026 00:30 Destroyed
@NathanFlurry NathanFlurry merged commit 52cb141 into main Feb 27, 2026
4 of 8 checks passed
@NathanFlurry NathanFlurry deleted the 02-25-fix_various_serverless_bug_fixes branch February 27, 2026 00:30
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