Skip to content

fix: runner alloc idx logic, api auth for actor get#4443

Open
MasterPtato wants to merge 1 commit intomainfrom
03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get
Open

fix: runner alloc idx logic, api auth for actor get#4443
MasterPtato wants to merge 1 commit intomainfrom
03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get

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

@railway-app
Copy link
Copy Markdown

railway-app bot commented Mar 17, 2026

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

Service Status Web Updated (UTC)
frontend-cloud 😴 Sleeping (View Logs) Web Mar 31, 2026 at 5:27 am
frontend-inspector 😴 Sleeping (View Logs) Web Mar 19, 2026 at 3:17 pm
website ❌ Build Failed (View Logs) Web Mar 17, 2026 at 7:41 pm
mcp-hub ✅ Success (View Logs) Web Mar 17, 2026 at 7:39 pm
ladle ❌ Build Failed (View Logs) Web Mar 17, 2026 at 7:38 pm

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 17, 2026

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/sqlite-vfs

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

@rivetkit/traces

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

@rivetkit/workflow-engine

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

@rivetkit/virtual-websocket

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: d5c2eee

@claude
Copy link
Copy Markdown

claude bot commented Mar 17, 2026

PR Review: fix: runner alloc idx logic, api auth for actor get

Summary

The PR addresses two bug fixes: eviction handling in the runner allocation index lifecycle, and relaxing auth requirements on the actor list endpoint when filters are provided. Overall the changes are sound and fix real issues. A few observations below.


Runner Allocation Index Logic

Draining vs. Expired separation - The removal of ExpiredTsKey writes in the Draining state (runner.rs:691 and runner2.rs:540) is the correct fix. Previously a draining runner was marked as both draining and expired, causing the allocation index to treat it as permanently gone. Now DrainTsKey and ExpiredTsKey are distinct, which is semantically correct.

Eviction propagation - Moving eviction signalling from Err(WsError::Eviction) to Ok(Err(LifecycleResult::Evicted)) in the two task files is clean. It lets the coordinator in lib.rs decide whether to clear the alloc idx before converting it back to an error.

Minor style nit - The if let / else block in lib.rs:235-255 is valid but slightly unusual Rust. Consider using matches! instead.

UpdatePing condition change in update_alloc_idx.rs:177 - The old guard checked whether the old alloc key existed in the index. The new guard checks whether the runner is not draining. These are not equivalent: if a runner lost its alloc key but is not draining, the new code proceeds where the old code would short-circuit. This is probably fine in practice, but it is a subtle semantic shift worth a comment explaining why the draining check is the correct gate here.


API Auth for Actor List (api-public/src/actors/list.rs)

The comment about reading being allowed and list requiring auth is terse. Something like 'Auth is required to enumerate all actors; individual lookups by ID or key are allowed unauthenticated' would make the policy clearer to future readers.

The logic itself looks correct. Note the intentional asymmetry: actor_ids and key are checked with is_none() while actor_id uses is_empty() - this reflects their different types (Option vs String). An explicit empty-string actor_id correctly still triggers the auth path.


Other Changes

  • runner2.rs mark_eligible: Capturing the response and warning on non-empty notifications is a good observability addition.
  • rocksdb/database.rs: Changing debug-format db_path to display-format db_path.display() is the correct structured-logging format per the codebase conventions.
  • OpenAPI / type doc: The 'Arbitrary base64 encoded binary data.' description added to input is a useful clarification.

Verdict

No blocking issues. The core logic changes are correct and the two bugs (draining-as-expired, premature alloc-idx clear on eviction) are fixed cleanly. The minor points above are suggestions, not blockers.

Generated with Claude Code

@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 5b2bead to cfc4fad Compare March 17, 2026 20:38
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from cfc4fad to 65280b5 Compare March 18, 2026 22:12
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 65280b5 to 84dbf32 Compare March 21, 2026 01:55
@MasterPtato MasterPtato mentioned this pull request Mar 21, 2026
11 tasks
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 84dbf32 to 90c2e97 Compare March 24, 2026 00:30
@MasterPtato MasterPtato mentioned this pull request Mar 24, 2026
11 tasks
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch 5 times, most recently from b2f4422 to 7baeb4c Compare March 28, 2026 00:20
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 7baeb4c to 791a38d Compare March 30, 2026 19:40
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 791a38d to d5c2eee Compare March 31, 2026 01:40
@MasterPtato MasterPtato mentioned this pull request Mar 31, 2026
11 tasks
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