Skip to content

fix(collector): leave Polymarket API rate headroom - #876

Merged
proerror77 merged 3 commits into
mainfrom
codex/polymarket-v2-rate-headroom
Aug 14, 2026
Merged

proerror77 merged 3 commits into
mainfrom
codex/polymarket-v2-rate-headroom

Conversation

@proerror77

@proerror77 proerror77 commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Change

Raise the shared Polymarket Data API request-start spacing from 100ms to 125ms. This keeps the production-plus-shadow rate below the documented 200 requests / 10 seconds limit instead of running exactly at it, which caused the formal Shadow Gate to fail on four HTTP 429 responses. The fail-closed health predicate remains strict and now requires the new spacing.

Issue relationship

None

Validation

  • cargo test -p hft-collector --locked polymarket_raw (91 passed, 2 ignored)
  • cargo clippy -p hft-collector --locked --all-targets -- -D warnings
  • PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" bash deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
  • git diff --check

Runtime impact and rollback

The collector starts at most 8 Data API trade requests per second per process instead of 10, leaving headroom during production-plus-shadow overlap. The 200-poll cycle still has about 155 seconds of watchdog headroom. Roll back by redeploying the prior immutable Polymarket release; do not cut over unless the new formal Shadow Gate passes.

Summary by CodeRabbit

  • Performance

    • Increased minimum spacing between Polymarket Data API requests from 100 ms to 125 ms.
    • Maintained a maximum of four concurrent requests.
    • Adjusted polling capacity and pacing calculations to provide additional request headroom.
  • Reliability

    • Updated health-policy validation to enforce the safer request-spacing limit.
  • Tests

    • Updated deployment and configuration checks to reflect the new 125 ms minimum.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@proerror77, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 107 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a39c48c1-74cd-4462-965e-cbbcde63fe82

📥 Commits

Reviewing files that changed from the base of the PR and between f801d1c and 526fb20.

📒 Files selected for processing (2)
  • rust_hft/tools/collector/src/bin/polymarket-raw-ops.rs
  • rust_hft/tools/collector/src/polymarket_raw.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b4356207-b563-4914-bb47-ba3c1f23b457

📥 Commits

Reviewing files that changed from the base of the PR and between bb8929e and f801d1c.

📒 Files selected for processing (5)
  • deployment/aliyun/README.md
  • deployment/aliyun/polymarket-reference-collector.service
  • deployment/aliyun/polymarket-rust-health-policy.jq
  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
  • rust_hft/tools/collector/src/polymarket_raw.rs

📝 Walkthrough

Walkthrough

The PR raises the minimum Polymarket trade request spacing from 100 ms to 125 ms. It updates Rust defaults, health validation, control-plane fixtures, and deployment pacing documentation.

Changes

Polymarket request spacing

Layer / File(s) Summary
Update spacing contract and validation
rust_hft/tools/collector/src/polymarket_raw.rs, deployment/aliyun/polymarket-rust-health-policy.jq
The minimum trade request spacing and default per-market delay increase to 125 ms. The default configuration test verifies the new value.
Align fixtures and deployment documentation
deployment/aliyun/test-polymarket-raw-ops-control-plane.sh, deployment/aliyun/README.md, deployment/aliyun/polymarket-reference-collector.service
Control-plane fixtures use 125 ms as the valid value and 124 ms as the invalid value. Deployment documentation reflects 125 ms spacing and 1,440 request starts per cycle.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f801d

The PR makes a localized request-spacing adjustment to add rate-limit headroom, with no actionable merge-blocking risk remaining after normal checks and review.

Possibly related PRs

  • proerror77/monday#34: Introduces the request-spacing minimum, defaults, health policy, and control-plane tests updated here.
  • proerror77/monday#37: Adds the 100 ms request-spacing constants, validation, documentation, and tests changed here.
  • proerror77/monday#80: Modifies related Polymarket request-spacing validation and scheduling logic.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: increasing request spacing to leave Polymarket API rate headroom.
Description check ✅ Passed The description includes all required sections and explains the change, issue relationship, validation, runtime impact, and rollback.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/polymarket-v2-rate-headroom

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44e7371012

ℹ️ 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".

Comment thread rust_hft/tools/collector/src/polymarket_raw.rs Outdated
@proerror77
proerror77 enabled auto-merge (squash) August 14, 2026 04:41
@proerror77
proerror77 merged commit 454f54d into main Aug 14, 2026
42 checks passed
@proerror77
proerror77 deleted the codex/polymarket-v2-rate-headroom branch August 14, 2026 04:51
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