Skip to content

fix(research): collapse reduced MCTS to canonical baseline - #407

Merged
proerror77 merged 2 commits into
mainfrom
codex/mission-v3-mcts-324-canonical-baseline
Jul 27, 2026
Merged

fix(research): collapse reduced MCTS to canonical baseline#407
proerror77 merged 2 commits into
mainfrom
codex/mission-v3-mcts-324-canonical-baseline

Conversation

@proerror77

@proerror77 proerror77 commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Closes part of #324.

Change contract

For the reduced-authority MarketMidpointOnly profile, evaluate exactly one canonical root baseline candidate and expose no semantically equivalent scale-only or LLM expansion; preserve FullSurface behavior.

A PRD is unnecessary because this is a small, already-specified correction inside the approved #324 shared-MCTS contract.

Out of scope

Authenticated evaluator metrics, typed receipts, experiment manifest, hft-search-kernel, snapshot authority changes, CEX/alpha-harness, collector/runtime/deployment, and profitability claims.

Dependency / merge order

Stacked on #405 (codex/mission-v3-mcts-324-metrics). Merge order: #405 -> this PR -> authenticated evaluator layer.

Focused validation

  • TDD counterexample: old code returned DeterministicMutation; new test requires the canonical Baseline candidate and no further expansion.
  • cargo test --locked -p ploy-research prediction_mcts -- --nocapture (30 passed)
  • cargo test --locked -p ploy-research (340 library + 4 binary passed)
  • cargo clippy --locked -p ploy-research --features ml --all-targets --no-deps -- -D warnings
  • cargo fmt -p ploy-research -- --check
  • checked-in BTC/SOL template policy ID matches sha256:fb89448ee15a3d62d43a4a260b1bb8b4794b6ff9ca7ad93421a8cecd290325e3
  • dual-axis spec and standards reviews: CLEAN

Review size: 4 files, 70 insertions / 41 deletions; below the repository review limit.

Rollout / rollback impact

Research-only search semantics and policy identity. Rollback restores semantically redundant midpoint-weight candidates; immutable artifacts remain versioned and are not reinterpreted.

Summary by CodeRabbit

  • Bug Fixes

    • Refined midpoint-based market research evaluation to process only the canonical baseline candidate, preventing unsupported follow-up expansions.
    • Improved validation of pending research states for more consistent deterministic behavior.
  • Configuration

    • Updated the search-policy snapshots used by BTC and SOL short-term research missions.
  • Tests

    • Updated automated coverage to verify the revised candidate evaluation and expansion behavior.

@coderabbitai

coderabbitai Bot commented Jul 27, 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: 5 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: 93d404c0-4c01-4f86-b40c-7362fbb47cc8

📥 Commits

Reviewing files that changed from the base of the PR and between a444f10 and 8f37931.

📒 Files selected for processing (3)
  • 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_mcts.rs
📝 Walkthrough

Walkthrough

The MCTS engine now treats MarketMidpointOnly as a single canonical baseline evaluation, updates pending-state validation and tests, and refreshes BTC and SOL mission snapshot identifiers.

Changes

Market midpoint MCTS behavior

Layer / File(s) Summary
Canonical pending-candidate flow
rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs
MarketMidpointOnly no longer generates deterministic increases, proposes node 0 as its initial pending candidate, and reports no further expandability after proposal.
Pending-state validation and selection tests
rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs, rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts_run.rs
Checkpoint validation recognizes the canonical baseline state, while tests verify single-candidate evaluation and updated candidate IDs.
Mission snapshot updates
rust_hft/prediction-markets/config/research_missions/polymarket-*.example.json
BTC and SOL five-minute mission configurations use new search_policy_snapshot_id hashes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PredictionMctsRun
  participant PredictionMctsEngine
  participant FakeEvaluator
  PredictionMctsRun->>PredictionMctsEngine: propose() with MarketMidpointOnly
  PredictionMctsEngine->>PredictionMctsEngine: mark candidate node 0 pending
  PredictionMctsEngine-->>PredictionMctsRun: return canonical candidate
  PredictionMctsRun->>FakeEvaluator: observe candidate training
  PredictionMctsRun->>PredictionMctsEngine: check expandability
  PredictionMctsEngine-->>PredictionMctsRun: return false
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change to collapse reduced MCTS to the canonical baseline.
Description check ✅ Passed The description covers all template sections with contract, out-of-scope, merge order, validation, and rollback details.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/mission-v3-mcts-324-canonical-baseline

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/mission-v3-mcts-324-metrics branch from 0fab7a6 to 313a78f Compare July 27, 2026 02:08
@proerror77
proerror77 force-pushed the codex/mission-v3-mcts-324-canonical-baseline branch from e96da55 to a482359 Compare July 27, 2026 02:09

@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: e96da55d99

ℹ️ 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/prediction-markets/crates/ploy-research/src/prediction_mcts.rs Outdated
Base automatically changed from codex/mission-v3-mcts-324-metrics to main July 27, 2026 02:27
@proerror77
proerror77 force-pushed the codex/mission-v3-mcts-324-canonical-baseline branch from a482359 to 71bf456 Compare July 27, 2026 02:31
@proerror77
proerror77 force-pushed the codex/mission-v3-mcts-324-canonical-baseline branch from 71bf456 to a444f10 Compare July 27, 2026 03:02

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs (1)

858-910: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Enforce the one-candidate limit inside propose and checkpoint validation.

A midpoint-only advisor passes blend_allowed; after observing the baseline, a direct second propose() bypasses has_expandable_candidate() and expands that advisor. The resulting LLM child also passes checkpoint validation, so this profile is not actually limited to its canonical root candidate.

  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs#L858-L910: return a terminal error for every MarketMidpointOnly call after proposal 0, and reject LLM advice for this profile.
  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs#L586-L595: reject non-root/expanded MarketMidpointOnly checkpoint states.
  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs#L1216-L1229: add a midpoint-only-advisor counterexample and assert a second propose() fails.

As per PR objectives, this profile must evaluate exactly one canonical root candidate.

🤖 Prompt for 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.

In `@rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs`
around lines 858 - 910, Enforce the one-candidate MarketMidpointOnly contract:
in propose, return a terminal error for every call after proposal 0 and reject
LLM advice for this profile; in checkpoint validation, reject any non-root or
expanded MarketMidpointOnly state. Update the midpoint-only advisor test to
cover the counterexample and assert that a second propose() fails. Apply these
changes at
rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs:858-910,
:586-595, and :1216-1229; the profile must evaluate exactly one canonical root
candidate.
🤖 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.

Outside diff comments:
In `@rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs`:
- Around line 858-910: Enforce the one-candidate MarketMidpointOnly contract: in
propose, return a terminal error for every call after proposal 0 and reject LLM
advice for this profile; in checkpoint validation, reject any non-root or
expanded MarketMidpointOnly state. Update the midpoint-only advisor test to
cover the counterexample and assert that a second propose() fails. Apply these
changes at
rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts.rs:858-910,
:586-595, and :1216-1229; the profile must evaluate exactly one canonical root
candidate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c34c7f77-2664-48ce-accc-70659b46aa63

📥 Commits

Reviewing files that changed from the base of the PR and between dfb27ef and a444f10.

📒 Files selected for processing (4)
  • 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_mcts.rs
  • rust_hft/prediction-markets/crates/ploy-research/src/prediction_mcts_run.rs

Direct engine proposals bypassed the caller expansion guard, and checkpoint validation admitted expanded reduced-profile state. Enforce the one-candidate/no-LLM contract at construction, proposal, and restore boundaries.
@proerror77
proerror77 merged commit 5f7ca6c into main Jul 27, 2026
40 checks passed
@proerror77
proerror77 deleted the codex/mission-v3-mcts-324-canonical-baseline branch July 27, 2026 04:04
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