Skip to content

fix(collector): retry uploader readback on a 600s deadline, not 12 attempts - #575

Merged
proerror77 merged 4 commits into
mainfrom
codex/upload-readback-deadline
Aug 1, 2026
Merged

proerror77 merged 4 commits into
mainfrom
codex/upload-readback-deadline

Conversation

@proerror77

@proerror77 proerror77 commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Change contract

Uploader readback-after-upload: up to 60 attempts bounded by a 600s wall-clock budget (budget-clamped sleeps, per-file timeout stays 60s), replacing the 12×5s loop.

Evidence

Fourth identical failure, 2026-08-01T18:23 CST (gate invocation 8d986d26): a 109MiB shadow upload (27-part multipart) took ~150s to become HEAD-able — Last-Modified equals the final 404 second, exactly as in the three earlier cases. The 12×5s loop (~90s) ran out mid-publication. Every observed failure has been inside the uploader's own post-PUT verification (the .upload-staging/.oss-verify path), never the gate script's readback — this PR targets the layer that actually fails.

Out of scope

  • OSS-side publication lag root cause; publish-order change (upload status only after verified readback is the durable design, already the case — the retry budget is what was wrong)

Dependency / merge order

None. Supersedes the retry constants from #565.

Focused validation

  • cargo test -p hft-collector --lib polymarket_upload --locked: 62 passed, 0 failed, ~1s

Rollout / rollback impact

Retry timing only; fail-closed semantics unchanged. Rollback = revert.

Issue relationship

Refs #556

Summary by CodeRabbit

  • Bug Fixes
    • Improved data retrieval reliability by allowing more readback retry attempts.
    • Ensured retries stop within the configured time limit, preventing excessive wait times.

…tempts

Fourth identical production failure (2026-08-01T18:23 CST): a 109MiB
multipart shadow upload took ~150s to become HEAD-able, exhausting the
12x5s loop at ~90s. Every observed readback failure has been inside the
uploader's own post-PUT verification (the .upload-staging/.oss-verify
path), never the gate script's. Retry up to 60 attempts bounded by a
600s wall-clock budget with budget-clamped sleeps; per-file timeout
stays 60s.

Refs #556
@coderabbitai

coderabbitai Bot commented Aug 1, 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: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: b0d07719-10d5-49e2-9644-7a2c98a5da6f

📥 Commits

Reviewing files that changed from the base of the PR and between 8d0e186 and c5165df.

📒 Files selected for processing (3)
  • deployment/aliyun/polymarket-raw-ops-shadow-gate.sh
  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh
  • rust_hft/tools/collector/src/polymarket_upload.rs
📝 Walkthrough

Walkthrough

The OSS readback retry flow now allows 60 attempts within a 600-second budget. Backoff sleeps are capped by the remaining budget, and the loop skips sleeping when the budget is exhausted.

Changes

OSS readback retries

Layer / File(s) Summary
Retry budget and backoff
rust_hft/tools/collector/src/polymarket_upload.rs
The retry limit increased from 12 to 60 attempts. The wall-clock budget increased from 300 to 600 seconds. Backoff now uses the remaining budget as its maximum sleep duration.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: extending uploader readback retries to a 600-second deadline.
Description check ✅ Passed The description covers the change, evidence, scope, dependencies, validation, rollout, rollback, and issue relationship; only the scope exception section is missing.
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/upload-readback-deadline

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.

@proerror77
proerror77 enabled auto-merge (squash) August 1, 2026 10:38

@coderabbitai coderabbitai 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.

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/polymarket_upload.rs`:
- Around line 68-71: Update the readback retry flow around budget_remaining and
download_remote_artifacts_with to use one absolute deadline, recomputing the
remaining duration before each data, manifest, and success download and skipping
attempts with no time left. Treat elapsed time equal to
OSS_READBACK_MAX_WALL_CLOCK as expired before starting an attempt, while
preserving the existing sleep clamp. Add a deterministic counterexample test
covering the exact-deadline boundary and sequential-download budget enforcement.
🪄 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: bba85ee7-520e-4158-904c-968f5feb9266

📥 Commits

Reviewing files that changed from the base of the PR and between 0af26a7 and 8d0e186.

📒 Files selected for processing (1)
  • rust_hft/tools/collector/src/polymarket_upload.rs

Comment thread rust_hft/tools/collector/src/polymarket_upload.rs

@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: 8d0e186a8f

ℹ️ 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_upload.rs Outdated
Comment thread rust_hft/tools/collector/src/polymarket_upload.rs
Sonic Shih added 3 commits August 1, 2026 18:45
CodeRabbit round on #575: (1) per-file timeouts now consume the shared
budget sequentially instead of each receiving the full remainder;
(2) attempt count raised to 120 so the 600s deadline, not the count,
bounds the loop; (3) the gate's real-market preflight budget is
raised 300s -> 1200s so it cannot kill the wider uploader readback
mid-flight.

Refs #556
@proerror77
proerror77 merged commit f427c34 into main Aug 1, 2026
51 checks passed
@proerror77
proerror77 deleted the codex/upload-readback-deadline branch August 1, 2026 10:58
proerror77 added a commit that referenced this pull request Aug 1, 2026
…577)

* fix(deploy): widen gate-script OSS readback retry to 30x20s (~600s)

Production evidence (2026-08-01T20:31:07+08, gate invocation 55808db5):
a 117MiB multipart shadow object became HEAD-able exactly 168s after
publication began — one second past the fifteenth 12s retry. The
uploader-side budget (600s, #575) already covers this; the gate
script's own readback did not.

Refs #556

* fix(deploy): clamp the 20s readback backoff to the caller deadline

CodeRabbit on #577: with 14-19s remaining the 13s guard permitted a
20s sleep past the deadline.

Refs #556

---------

Co-authored-by: Sonic Shih <sonic.shih@mandonothing.com>
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