feat(daemon): scored verified candidates (roadmap-v0.6 B.2)#80
Merged
Conversation
Adds crustcore_daemon::score: score_candidate(PatchMetadata, RiskTier) -> PatchScore and pick_best, selecting the best verifier-accepted fan-out candidate instead of merely the first accepted. Correctness dominates by construction: VERIFIED_BONUS (100) exceeds the sum of every other term (diff penalty <=50, gates <=20, security <=8), so a verified candidate ALWAYS outranks an unverified one — scoring reorders accepted candidates but can never promote an unverified patch (invariants 6, 13). Among verified, smaller diff + more gates rank higher with a small security boost; ties keep the first proposer (deterministic). Pure + total — missing metadata defaults to zero and never fails (the live executor fills it from the real VerifiedPatch, the existing P11-exec-live seam). 7 new tests incl. the golden fail/pass-large/pass-small ranking; daemon-only; zero nano impact. `cargo xtask verify` green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Roadmap-v0.6 B.2 — a new
crustcore_daemon::scorethat picks the best verifier-accepted fan-out candidate, not merely the first accepted.score_candidate(meta, risk) → PatchScore— pure: correctness dominates (+VERIFIED_BONUS = 100), then smaller diff (bounded penalty), more gates passed, and a security-review boost.pick_best(candidates, risk) → Option<T>— highest score, ties keep the first proposer (deterministic).Safety (the key property)
VERIFIED_BONUS(100) is larger than the sum of every other term (diff ≤50 + gates ≤20 + security ≤8 = 28 of swing), so a verified candidate's score (≥50) can never be overtaken by an unverified one (≤28). Scoring reorders accepted candidates but can never promote an unverified patch — it's a tie-break among verifier-accepted candidates, never a bypass of verifier-owned completion (invariants 6, 13).CI core vs live seam
SubagentExecutorextracting diff metadata from a realVerifiedPatchis the existingP11-exec-liveseam — no new seam (the scorer stays pure, defaulting missing metadata to 0).Tests run
cargo xtask verify— green. Nano unchanged at 53.5% (daemon-only). Independent offmain.🤖 Generated with Claude Code