Skip to content

feat(deploy): add Polymarket tape upload watchdog timer - #657

Merged
proerror77 merged 3 commits into
mainfrom
codex/upload-watchdog
Aug 3, 2026
Merged

proerror77 merged 3 commits into
mainfrom
codex/upload-watchdog

Conversation

@proerror77

Copy link
Copy Markdown
Owner

Change contract

On 2026-08-03 the market-tape upload timer was found silently stopped for 19 h (backlog 145 GB, disk one hour from full), and the reference-upload timer was found dead the same way. This adds a small root oneshot + 2-minute timer (polymarket-market-tape-upload-watchdog.{sh,service,timer}) that self-heals both lanes: an inactive polymarket-market-tape-upload.timer or polymarket-reference-upload.timer is restarted with a WARNING log; an inactive/failed service with rotated tapes older than 90 min gets a --no-block start; every run logs one INFO line with per-lane pending count, oldest tape age, and /data free GB. It never stops, disables, or deletes anything.

Issue relationship

Refs #655

Out of scope

  • Host installation on monday-trade-data-26 (runtime action, needs the named-controller procedure; README documents the install snippet).
  • External alerting channels (PagerDuty/webhook); the watchdog self-heals and journals, it does not page.
  • Uploader throughput and recorder tape caps (separate PRs).

Dependencies and merge order

None

Focused validation

  • sh -n/bash -n OK; shellcheck -s sh exit 0.
  • Functional stub test (fake systemctl/logger/df on PATH, real script under sh): all 5 two-lane scenarios pass, including counterexamples — a dead timer in failed state is healed, a fresh tape (<90 min) triggers no remediation, and the active market-updates.ndjson is never counted or touched.
  • deployment/aliyun/test-polymarket-raw-ops-control-plane.sh: passed (run with GNU coreutils shimmed on macOS; README assertions re-verified directly after the reference-lane extension).
  • systemd-analyze verify not available on macOS — will be run on the host before install (noted in PR).

Rollout and rollback

No production impact until installed per the README snippet; rollback is systemctl disable --now polymarket-market-tape-upload-watchdog.timer and removing the three files.

Scope exception

None

Add polymarket-market-tape-upload-watchdog.{sh,service,timer}: a
two-minute oneshot watchdog that self-heals both Polymarket upload
lanes after the market upload timer sat silently inactive for 19
hours and the reference upload timer was later found dead as well.

Per run it logs one journal INFO line (tag polymarket-upload-watchdog)
with each lane's pending rotated-tape count, oldest rotated-tape age,
and /data free GB; starts an inactive upload timer with a WARNING
carrying the previous state; and starts an inactive upload service
with --no-block when a rotated tape is older than 90 minutes. It only
ever starts units and never modifies tape files. The unit runs as root
for systemctl start but keeps the remaining hardening of the existing
upload units. README documents installation alongside the upload units.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 13 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: 276ef400-10e0-4b7f-9aa3-119bc900d597

📥 Commits

Reviewing files that changed from the base of the PR and between eb92e38 and 9392748.

📒 Files selected for processing (4)
  • deployment/aliyun/README.md
  • deployment/aliyun/polymarket-market-tape-upload-watchdog.service
  • deployment/aliyun/polymarket-market-tape-upload-watchdog.sh
  • deployment/aliyun/polymarket-market-tape-upload-watchdog.timer

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: e559042aa3

ℹ️ 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 deployment/aliyun/polymarket-market-tape-upload-watchdog.sh Outdated
Comment thread deployment/aliyun/polymarket-market-tape-upload-watchdog.sh Outdated
Comment thread deployment/aliyun/README.md
@proerror77

Copy link
Copy Markdown
Owner Author

All three P1 threads addressed in d8a309e4:

  1. Cutover collision: watchdog now skips all remediation when /run/monday/polymarket-upload-watchdog.suppress exists (runtime path, never survives reboot); README documents the mandatory create/remove protocol around any timer-stopping cutover. Wiring suppression into polymarket-raw-ops-cutover.sh itself was deliberately left out — that contract is hash-pinned and test-governed.
  2. Per-lane error isolation: every systemctl start is guarded; a failed start logs daemon.err with the lane name, the other lane is still fully remediated, and the script exits 1 at the end so the failure surfaces in the unit result. Stub test: market start fails → reference lane healed, exit 1.
  3. Governed installation: README now records controller placeholder, exact target, source identity, stop rules, rollback, and post-install readback.

Stub suite: 7/7 scenarios pass; sh -n/bash -n/shellcheck clean; control-plane README assertions re-verified.

@proerror77
proerror77 merged commit a9ed6f6 into main Aug 3, 2026
45 checks passed
@proerror77
proerror77 deleted the codex/upload-watchdog branch August 3, 2026 11:53
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