Skip to content

feat(research): switch prediction runner to shared MCTS - #201

Merged
proerror77 merged 1 commit into
mainfrom
codex/prediction-mcts-runner-switch-187
Jul 22, 2026
Merged

proerror77 merged 1 commit into
mainfrom
codex/prediction-mcts-runner-switch-187

Conversation

@proerror77

Copy link
Copy Markdown
Owner

Closes #187

Change contract

Make monday-prediction-research use the durable shared-kernel prediction controller, while preserving --legacy-loop as an explicit rollback path.

Out of scope

Deleting legacy state, changing settlement metrics, Alpha Search artifact format, collector/snapshot, result publication, promotion, execution, risk, or deployment.

Dependency / merge order

Stacked on #200, which is stacked on #199. Merge #199, then #200, then this PR.

Focused validation

  • cargo test -p ploy-research prediction_mcts --no-default-features
  • cargo test -p ploy-research --bin monday-prediction-research --no-default-features
  • cargo test -p ploy-research --bin monday-prediction-evaluator --features db --no-default-features
  • cargo test -p ploy-research checked_in_btc_and_sol_templates_pin_current_brief_and_rust_policy --no-default-features
  • cargo clippy -p ploy-research --no-default-features --no-deps -- -D warnings
  • cargo fmt --check

Rollout / rollback impact

Default CLI uses the new checkpoint; --legacy-loop directly resumes the old controller and its own checkpoint without translation. Reverting restores the old default.

Review

Matt standards and spec reviews passed after the split. The exact selected candidate is persisted, forwarded, and validated against the governed prior before held-out evaluation.

@coderabbitai

coderabbitai Bot commented Jul 22, 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: 39 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

Run ID: 7768875d-8af7-4270-b92f-7bcab7f64a2e

📥 Commits

Reviewing files that changed from the base of the PR and between ea118ba and 896efc7.

📒 Files selected for processing (5)
  • 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/bin/monday-prediction-evaluator.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/bin/monday-prediction-research.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_loop.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/prediction-mcts-runner-switch-187

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 force-pushed the codex/prediction-mcts-runner-library-198 branch from 413bf79 to 2800d96 Compare July 22, 2026 05:39
@proerror77
proerror77 force-pushed the codex/prediction-mcts-runner-switch-187 branch from 06e1b16 to 896efc7 Compare July 22, 2026 05:41
@proerror77
proerror77 changed the base branch from codex/prediction-mcts-runner-library-198 to main July 22, 2026 05:41
@proerror77
proerror77 merged commit b66b1d8 into main Jul 22, 2026
2 checks passed

@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: 06e1b162db

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

&mut evaluator,
)
} else {
run_or_resume_prediction_mcts(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject existing output state before starting MCTS

When the default command is pointed at a resumed legacy result bundle—or any non-empty output directory without prediction-mcts-state.json—this path initializes a fresh MCTS run alongside the existing files. Unlike run_or_resume, run_or_resume_prediction_mcts does not call reject_unbound_output_directory, so a paused legacy run resumed without the new --legacy-loop flag silently starts over and can upload a bundle containing evidence from two controllers or missions instead of failing closed.

Useful? React with 👍 / 👎.

&mut evaluator,
)
} else {
run_or_resume_prediction_mcts(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve advisor-call evidence in the default runner

For every non-baseline mission, switching the default to this runner drops the governed LLM audit trail: run_or_resume_prediction_mcts parses ProposalCallOutput.raw_response into blends and persists only those blends plus an optional failure string, discarding the exact response, provider, model, and usage. The legacy default records those fields as durable append-only response evidence, so default MCTS runs can no longer audit or reproduce the advisor call from their result bundle.

Useful? React with 👍 / 👎.

training_candidate_json: None,
selected_candidate_json: Some(candidate_path),
},
timeout,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Stop expired MCTS runs before launching another evaluator

When the final training evaluation consumes the remaining wall-clock budget, or a baseline/held-out pause is resumed after its persisted deadline, the MCTS controller still calls this adapter with a zero timeout; PredictionEvaluator::evaluate then spawns the evaluator and immediately kills it, records another pause, and repeats that behavior on every resume. The legacy loop checks its budget before entering each frontier, so the new default needs the same gate before baseline, advisor, and selected evaluation rather than attempting work after expiry.

Useful? React with 👍 / 👎.

eprintln!("ERROR: load governed research snapshot: {error:#}");
std::process::exit(2);
});
validate_prediction_run_inputs(&mission, &snapshot).unwrap_or_else(|reason| {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the pinned policy when resuming legacy runs

For a checkpoint created before this change, the saved mission pins the previous policy ID (the checked-in missions used sha256:7fe89...), but this unconditional validation now compares it with the new MCTS-inclusive policy ID (sha256:f475...) before consulting legacy_loop. Consequently, even an operator who supplies --legacy-loop cannot resume an existing paused legacy checkpoint—the command exits with a policy mismatch—so the advertised rollback path only starts legacy logic for newly rewritten missions rather than resuming the runs it is meant to preserve.

Useful? React with 👍 / 👎.

@proerror77
proerror77 deleted the codex/prediction-mcts-runner-switch-187 branch July 24, 2026 08:44
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.

Switch monday-prediction-research to the shared MCTS controller

1 participant