fix(collector): raise retained trade ID cap to 4M and make it configurable - #576
Conversation
…rable The 2026-08-01 shadow gate (invocation e50c2f50) failed when the collector bailed at the 1M retained-ID cap: at the current catalog a budget-200 backfill accumulates ~42k IDs/min, reaching the cap in ~15 minutes and crash-looping on every restart. Raise the default to 4M (memory math in the constant's comment) and add --max-retained-trade-ids for future tuning; no unit/cmdline changes, so gate identity pins are unaffected. Refs #553
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe collector increases the default retained trade-ID capacity to 4,000,000. ChangesRetained trade-ID capacity
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rust_hft/tools/collector/src/bin/polymarket-raw-ops.rs`:
- Around line 61-62: Update the focused test
collect_reference_cli_uses_the_library_discovery_capacity_default to assert that
the CLI’s max_retained_trade_ids value matches DEFAULT_MAX_RETAINED_TRADE_IDS,
covering the new option and detecting future CLI/library default mismatches.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0562421c-1852-42dc-9174-a3c402b671c0
📒 Files selected for processing (2)
rust_hft/tools/collector/src/bin/polymarket-raw-ops.rsrust_hft/tools/collector/src/polymarket_raw.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd91aa518b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Change contract
Raise the reference collector's retained trade-ID dedupe cap 1M → 4M (default), add
--max-retained-trade-idsfor tuning. No unit/cmdline changes, so gate identity pins are untouched.Production evidence
2026-08-01 shadow gate invocation e50c2f50 (candidate e5c661ed): the collector bailed with
collector state exceeds configured market or retained trade ID limitafter ~15 minutes — at the current catalog, a budget-200 backfill accumulates ~42k IDs/min (953,566 recorded in the state checkpoint), and every restart re-hits the cap within minutes, so the shadow can never complete a gate observation window.Memory math (in the constant's comment)
~150-200B per ID in memory → 4M IDs cost well under the units' 1536M/2048M watermarks (#574).
Out of scope
Dependency / merge order
None. Required before the next gate attempt — the current shadow crash-loops on this cap.
Focused validation
cargo test -p hft-collector --locked: 262 lib + 72 bin tests greenRollout / rollback impact
Config default only. Rollback = revert.
Issue relationship
Refs #553
Summary by CodeRabbit
New Features
Bug Fixes