Skip to content

Comments

fix: add max prunes to pruner#4191

Closed
MasterPtato wants to merge 1 commit into02-12-fix_add_max_param_to_prune_signals_cmdfrom
02-12-fix_add_max_prunes_to_pruner
Closed

fix: add max prunes to pruner#4191
MasterPtato wants to merge 1 commit into02-12-fix_add_max_param_to_prune_signals_cmdfrom
02-12-fix_add_max_prunes_to_pruner

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 railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4191 February 12, 2026 22:50 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 12, 2026

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

Service Status Web Updated (UTC)
ladle ❌ Build Failed (View Logs) Web Feb 19, 2026 at 10:54 pm
website 😴 Sleeping (View Logs) Web Feb 16, 2026 at 7:46 am
frontend-inspector ❌ Build Failed (View Logs) Web Feb 12, 2026 at 10:52 pm
frontend-cloud ❌ Build Failed (View Logs) Web Feb 12, 2026 at 10:52 pm
mcp-hub ✅ Success (View Logs) Web Feb 12, 2026 at 10:51 pm

Copy link
Contributor Author

MasterPtato commented Feb 12, 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


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@claude
Copy link

claude bot commented Feb 12, 2026

PR Review: fix: add max prunes to pruner

Overall: Small, well-targeted fix. The logic is correct and addresses a real risk of unbounded transaction sizes in the pruner.


What the change does

The pruner loops over FDB key ranges inside transactions and deletes workflow data. Before this fix, a single transaction could process an unlimited number of entries, bounded only by the 3-second EARLY_TXN_TIMEOUT. This PR adds a hard cap of 1000 prunes per transaction, preventing large transactions that could hit FDB's write limits.


Correctness

The pagination logic is sound. When the inner loop breaks due to hitting the limit, new_last_key is already set to [entry.key(), &[0xff]].concat() — the standard FDB exclusive-start key for resuming from the next entry. The outer loop picks this up via last_key = new_last_key and continues correctly from that point. No entries are skipped or double-processed.

One pre-existing nuance: the PruneVariant::None => continue branch deletes the index entry but does not increment prune_count or update new_last_key. This means None variants don't count toward the per-transaction cap and don't advance the pagination cursor. In practice this is fine since None variants are pruned in-line, but worth keeping in mind if the None case ever changes.


Observations

StreamingMode::WantAll interaction: The range query uses WantAll, which asks FDB to return all matching keys in one batch. The break stops loop processing at 1000, but the network fetch may already have retrieved more keys. This is a minor efficiency concern (extra data transferred) but not a correctness issue — the transaction's write buffer is correctly bounded by the 1000-entry limit.

Timeout interaction (pre-existing): When EARLY_TXN_TIMEOUT fires before any entry is processed, new_last_key remains Vec::new(), which causes the outer loop to terminate early at line 1401. Prune work could be silently incomplete in that case. Not introduced here, but worth flagging.

Magic number: The value 1000 is reasonable but has no comment explaining the rationale (e.g. staying well within FDB's 10 MB transaction write limit). A brief inline comment would help future readers.


Summary

Category Assessment
Correctness Pagination resumes correctly after hitting the limit
Performance Prevents oversized transactions; minor WantAll over-fetch is acceptable
Security No concerns
Tests No new tests; acceptable for a defensive internal guard

The core fix is solid. The observations above are all pre-existing issues or minor nits that do not block the change.

@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_param_to_prune_signals_cmd branch from 6d76467 to d19b48a Compare February 18, 2026 02:13
@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_prunes_to_pruner branch from 832c05a to 6804587 Compare February 18, 2026 02:13
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4191 February 18, 2026 02:13 Destroyed
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 18, 2026

More templates

@rivetkit/virtual-websocket

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

@rivetkit/cloudflare-workers

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/sqlite-vfs

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

@rivetkit/traces

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

@rivetkit/workflow-engine

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: c37f972

@graphite-app graphite-app bot force-pushed the 02-12-fix_add_max_param_to_prune_signals_cmd branch from d19b48a to 9f9271d Compare February 18, 2026 02:28
@graphite-app graphite-app bot force-pushed the 02-12-fix_add_max_prunes_to_pruner branch from 6804587 to 9561940 Compare February 18, 2026 02:29
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4191 February 18, 2026 02:29 Destroyed
@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_param_to_prune_signals_cmd branch from 9f9271d to dbb33f8 Compare February 19, 2026 20:46
@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_prunes_to_pruner branch from 9561940 to 1ae21ab Compare February 19, 2026 20:46
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4191 February 19, 2026 20:46 Destroyed
@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_prunes_to_pruner branch from 1ae21ab to c37f972 Compare February 19, 2026 22:41
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4191 February 19, 2026 22:41 Destroyed
@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_prunes_to_pruner branch from c37f972 to 603d888 Compare February 19, 2026 22:51
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4191 February 19, 2026 22:51 Destroyed
@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_param_to_prune_signals_cmd branch from dbb33f8 to 8f1ddf6 Compare February 19, 2026 22:53
@MasterPtato MasterPtato force-pushed the 02-12-fix_add_max_prunes_to_pruner branch from 603d888 to 1e27716 Compare February 19, 2026 22:53
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4191 February 19, 2026 22:53 Destroyed
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 19, 2026

Merge activity

  • Feb 19, 10:54 PM UTC: MasterPtato added this pull request to the Graphite merge queue.
  • Feb 19, 10:54 PM UTC: CI is running for this pull request on a draft pull request (#4241) due to your merge queue CI optimization settings.
  • Feb 19, 10:55 PM UTC: Merged by the Graphite merge queue via draft PR: #4241.

graphite-app bot pushed a commit that referenced this pull request Feb 19, 2026
# 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
@graphite-app graphite-app bot closed this Feb 19, 2026
@graphite-app graphite-app bot deleted the 02-12-fix_add_max_prunes_to_pruner branch February 19, 2026 22:55
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