Skip to content

research(pm): remove retired legacy loop engine - #681

Merged
proerror77 merged 2 commits into
mainfrom
codex/pm-remove-legacy-loop-engine
Aug 4, 2026
Merged

research(pm): remove retired legacy loop engine#681
proerror77 merged 2 commits into
mainfrom
codex/pm-remove-legacy-loop-engine

Conversation

@proerror77

@proerror77 proerror77 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Change contract

Remove the superseded non-MCTS prediction library loop engine, its engine-only state/ledger/crash-recovery helpers and tests, and the two now-unused filesystem helpers. Preserve the shared proposal/evaluation contracts, mission/snapshot validation, prior helper, and bounded MCTS runner. Rotate the governed prediction policy identity in both BTC/SOL mission templates and align the architecture/task contract with the MCTS fail-closed checkpoint behavior.

Issue relationship

None

Out of scope

Production deployment, collector changes, MCTS behavior changes, live activation, historical evidence deletion, and unrelated prediction-market refactors.

Dependencies and merge order

PR #679 must already be merged. This branch is based on main@a738b5143f1862e7b2ee8182688b8825de063e16.

Focused validation

  • Managed worktree preflight: PASS
  • cargo fmt -p ploy-research -- --check: PASS
  • cargo test -p ploy-research --locked: PASS (341 library tests, 4 binary tests)
  • cargo clippy -p ploy-research --locked --all-targets --no-deps -- -D warnings: PASS
  • Governed policy identity: sha256:1e3387ac2e5a8d62d516e7700f7037ab76fc69ea3be23b5eb19cccb6c1774559, matched by both BTC/SOL templates
  • Retired --legacy-loop: rejected with exit status 2
  • Retired library run_or_resume( entry: absent
  • Standards review: no findings
  • Spec review: no findings

Rollout and rollback

No production or runtime rollout. Live trading remains disabled. Roll back by reverting this PR as one unit.

Scope exception

This deletion exceeds 750 non-generated lines because the user explicitly approved removing the entire retired library loop and the required architecture-contract synchronization. Splitting the engine, its private state/ledger/recovery helpers, engine-only tests, and governed policy pins would leave a half-retired compatibility surface or stale policy identity. Named reviewer approval: user/coordinator authorization in the cleanup task.

Summary by CodeRabbit

  • Behavior Changes

    • Interrupted prediction research calls now fail safely when resumed, without replaying or issuing duplicate calls.
    • Research runs now report a streamlined set of pause, budget-exhausted, and failure outcomes.
    • Removed legacy recovery and retry behavior from the superseded research workflow.
  • Documentation

    • Updated prediction-market documentation and task guidance to reflect the current bounded research behavior.
  • Configuration

    • Updated policy snapshot references for Bitcoin and Solana five-minute market research examples.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

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: e3f69d63-98d8-41d2-bcaa-d4d325f2cf34

📥 Commits

Reviewing files that changed from the base of the PR and between a738b51 and e4f4c65.

📒 Files selected for processing (6)
  • docs/architecture/PREDICTION_MARKETS.md
  • rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json
  • rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json
  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_loop.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_loop_fs.rs
  • rust_hft/prediction-markets/tasks/todo.md
💤 Files with no reviewable changes (1)
  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_loop_fs.rs

📝 Walkthrough

Walkthrough

The PR removes the durable non-MCTS prediction LoopRun engine and related persistence helpers. It retains policy contracts and prior construction, narrows status types, documents fail-closed bounded MCTS checkpoints, and updates two mission policy snapshots.

Changes

Prediction Loop retirement

Layer / File(s) Summary
Policy contract reduction
rust_hft/prediction-markets/crates/ploy-research/src/prediction_loop.rs
The module retains prediction-policy contracts and prior construction. It removes feedback access, Running and Kept statuses, and durable-loop retry ownership.
Durable execution and persistence removal
rust_hft/prediction-markets/crates/ploy-research/src/prediction_loop.rs, rust_hft/prediction-markets/crates/ploy-research/src/prediction_loop_fs.rs
The durable execution loop, ledger, checkpoint, recovery, budget reconciliation, terminal evidence, stale-file cleanup, and content-addressed text writing are removed with their implementation-specific tests.
Documentation and mission snapshot alignment
docs/architecture/PREDICTION_MARKETS.md, rust_hft/prediction-markets/config/research_missions/*, rust_hft/prediction-markets/tasks/todo.md
Documentation records bounded MCTS checkpoint behavior and fail-closed interruption handling. The BTC and SOL examples use updated policy snapshot identifiers. The task list records retirement of the superseded engine.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies removal of the retired legacy loop engine, which is the primary change in the pull request.
Description check ✅ Passed The description covers all required sections and clearly states the change, scope, dependencies, validation, rollout, rollback, and scope exception.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/pm-remove-legacy-loop-engine

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 merged commit 38e634d into main Aug 4, 2026
47 checks passed
@proerror77
proerror77 deleted the codex/pm-remove-legacy-loop-engine branch August 4, 2026 04:50
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